Periodically fetch release notes.

This commit is contained in:
Cody Henthorne
2022-02-02 10:45:04 -05:00
parent 9114dc83d7
commit 8348badcd6
25 changed files with 789 additions and 34 deletions

View File

@@ -0,0 +1,27 @@
package org.thoughtcrime.securesms.util
import android.content.Context
import androidx.annotation.WorkerThread
import org.thoughtcrime.securesms.crypto.AttachmentSecretProvider
import org.thoughtcrime.securesms.crypto.ModernDecryptingPartInputStream
import org.thoughtcrime.securesms.crypto.ModernEncryptingPartOutputStream
import java.io.File
import java.io.InputStream
import java.io.OutputStream
/**
* Utilities for reading and writing to disk in an encrypted manner.
*/
object EncryptedStreamUtils {
@WorkerThread
fun getOutputStream(context: Context, outputFile: File): OutputStream {
val attachmentSecret = AttachmentSecretProvider.getInstance(context).orCreateAttachmentSecret
return ModernEncryptingPartOutputStream.createFor(attachmentSecret, outputFile, true).second
}
@WorkerThread
fun getInputStream(context: Context, inputFile: File): InputStream {
val attachmentSecret = AttachmentSecretProvider.getInstance(context).orCreateAttachmentSecret
return ModernDecryptingPartInputStream.createFor(attachmentSecret, inputFile, 0)
}
}

View File

@@ -19,6 +19,7 @@ public class JsonUtils {
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
com.fasterxml.jackson.module.kotlin.ExtensionsKt.registerKotlinModule(objectMapper);
}
public static <T> T fromJson(byte[] serialized, Class<T> clazz) throws IOException {

View File

@@ -54,6 +54,10 @@ public final class LocaleFeatureFlags {
return !blacklist.contains(countryCode);
}
public static boolean shouldShowReleaseNote(@NonNull String releaseNoteUuid, @NonNull String countries) {
return isEnabled(releaseNoteUuid, countries);
}
/**
* Parses a comma-separated list of country codes colon-separated from how many buckets out of 1 million
* should be enabled to see this megaphone in that country code. At the end of the list, an optional

View File

@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.jobs.RemoteConfigRefreshJob;
import org.thoughtcrime.securesms.jobs.RetrieveReleaseChannelJob;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import java.io.IOException;
@@ -29,6 +30,7 @@ public class VersionTracker {
Log.i(TAG, "Upgraded from " + lastVersionCode + " to " + currentVersionCode);
SignalStore.misc().clearClientDeprecated();
ApplicationDependencies.getJobManager().add(new RemoteConfigRefreshJob());
RetrieveReleaseChannelJob.enqueue(true);
LocalMetrics.getInstance().clear();
}