mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Implement Stories feature behind flag.
Co-Authored-By: Greyson Parrelli <37311915+greyson-signal@users.noreply.github.com> Co-Authored-By: Rashad Sookram <95182499+rashad-signal@users.noreply.github.com>
This commit is contained in:
@@ -42,6 +42,7 @@ public final class SignalStore {
|
||||
private final ImageEditorValues imageEditorValues;
|
||||
private final NotificationProfileValues notificationProfileValues;
|
||||
private final ReleaseChannelValues releaseChannelValues;
|
||||
private final StoryValues storyValues;
|
||||
|
||||
private static volatile SignalStore instance;
|
||||
|
||||
@@ -83,6 +84,7 @@ public final class SignalStore {
|
||||
this.imageEditorValues = new ImageEditorValues(store);
|
||||
this.notificationProfileValues = new NotificationProfileValues(store);
|
||||
this.releaseChannelValues = new ReleaseChannelValues(store);
|
||||
this.storyValues = new StoryValues(store);
|
||||
}
|
||||
|
||||
public static void onFirstEverAppLaunch() {
|
||||
@@ -110,6 +112,7 @@ public final class SignalStore {
|
||||
imageEditorValues().onFirstEverAppLaunch();
|
||||
notificationProfileValues().onFirstEverAppLaunch();
|
||||
releaseChannelValues().onFirstEverAppLaunch();
|
||||
storyValues().onFirstEverAppLaunch();
|
||||
}
|
||||
|
||||
public static List<String> getKeysToIncludeInBackup() {
|
||||
@@ -138,6 +141,7 @@ public final class SignalStore {
|
||||
keys.addAll(imageEditorValues().getKeysToIncludeInBackup());
|
||||
keys.addAll(notificationProfileValues().getKeysToIncludeInBackup());
|
||||
keys.addAll(releaseChannelValues().getKeysToIncludeInBackup());
|
||||
keys.addAll(storyValues().getKeysToIncludeInBackup());
|
||||
return keys;
|
||||
}
|
||||
|
||||
@@ -253,6 +257,10 @@ public final class SignalStore {
|
||||
return getInstance().releaseChannelValues;
|
||||
}
|
||||
|
||||
public static @NonNull StoryValues storyValues() {
|
||||
return getInstance().storyValues;
|
||||
}
|
||||
|
||||
public static @NonNull GroupsV2AuthorizationSignalStoreCache groupsV2AuthorizationCache() {
|
||||
return new GroupsV2AuthorizationSignalStoreCache(getStore());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.thoughtcrime.securesms.keyvalue
|
||||
|
||||
internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
|
||||
companion object {
|
||||
/*
|
||||
* User option to completely disable stories
|
||||
*/
|
||||
private const val MANUAL_FEATURE_DISABLE = "stories.disable"
|
||||
|
||||
private const val LAST_FONT_VERSION_CHECK = "stories.last.font.version.check"
|
||||
|
||||
/**
|
||||
* Used to check whether we should display certain dialogs.
|
||||
*/
|
||||
private const val USER_HAS_ADDED_TO_A_STORY = "user.has.added.to.a.story"
|
||||
}
|
||||
|
||||
override fun onFirstEverAppLaunch() = Unit
|
||||
|
||||
override fun getKeysToIncludeInBackup(): MutableList<String> = mutableListOf(MANUAL_FEATURE_DISABLE, USER_HAS_ADDED_TO_A_STORY)
|
||||
|
||||
var isFeatureDisabled: Boolean by booleanValue(MANUAL_FEATURE_DISABLE, false)
|
||||
|
||||
var lastFontVersionCheck: Long by longValue(LAST_FONT_VERSION_CHECK, 0)
|
||||
|
||||
var userHasAddedToAStory: Boolean by booleanValue(USER_HAS_ADDED_TO_A_STORY, false)
|
||||
}
|
||||
Reference in New Issue
Block a user