Add support for stories "seen" state.

This commit is contained in:
Alex Hart
2022-10-19 14:53:31 -03:00
committed by Cody Henthorne
parent 995a4ad6ec
commit 94bd3101c9
17 changed files with 168 additions and 17 deletions

View File

@@ -36,9 +36,14 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
private const val HAS_DOWNLOADED_ONBOARDING_STORY = "stories.has.downloaded.onboarding"
/**
* Marks whether the user has seen the onboarding story
* Marks whether the user has opened and viewed the onboarding story
*/
private const val USER_HAS_SEEN_ONBOARDING_STORY = "stories.user.has.seen.onboarding"
private const val USER_HAS_VIEWED_ONBOARDING_STORY = "stories.user.has.seen.onboarding"
/**
* Marks whether the user has seen the onboarding story in the stories landing page
*/
private const val USER_HAS_READ_ONBOARDING_STORY = "stories.user.has.read.onboarding"
/**
* Marks whether the user has seen the beta dialog
@@ -61,7 +66,8 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
USER_HAS_SEEN_FIRST_NAV_VIEW,
HAS_DOWNLOADED_ONBOARDING_STORY,
USER_HAS_SEEN_BETA_DIALOG,
STORY_VIEWED_RECEIPTS
STORY_VIEWED_RECEIPTS,
USER_HAS_READ_ONBOARDING_STORY
)
var isFeatureDisabled: Boolean by booleanValue(MANUAL_FEATURE_DISABLE, false)
@@ -74,7 +80,9 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
var hasDownloadedOnboardingStory: Boolean by booleanValue(HAS_DOWNLOADED_ONBOARDING_STORY, false)
var userHasSeenOnboardingStory: Boolean by booleanValue(USER_HAS_SEEN_ONBOARDING_STORY, false)
var userHasViewedOnboardingStory: Boolean by booleanValue(USER_HAS_VIEWED_ONBOARDING_STORY, false)
var userHasReadOnboardingStory: Boolean by booleanValue(USER_HAS_READ_ONBOARDING_STORY, false)
var userHasSeenBetaDialog: Boolean by booleanValue(USER_HAS_SEEN_BETA_DIALOG, false)
@@ -84,6 +92,10 @@ internal class StoryValues(store: KeyValueStore) : SignalStoreValues(store) {
return store.containsKey(STORY_VIEWED_RECEIPTS)
}
fun hasUserOnboardingStoryReadBeenSet(): Boolean {
return store.containsKey(USER_HAS_READ_ONBOARDING_STORY)
}
fun setLatestStorySend(storySend: StorySend) {
synchronized(this) {
val storySends: List<StorySend> = getList(LATEST_STORY_SENDS, StorySendSerializer)