mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2861 Vault | Enhancement | Show introduce-vault screen to new users or after the first login (#1618)
This commit is contained in:
parent
9ab3237716
commit
9d28c5d61b
15 changed files with 188 additions and 33 deletions
|
@ -396,11 +396,15 @@ class DefaultUserSettingsCache(
|
|||
return context.vaultPrefsStore
|
||||
.data
|
||||
.map { prefs ->
|
||||
val curr = prefs.preferences.getOrDefault(
|
||||
key = account.id,
|
||||
defaultValue = VaultPreference(
|
||||
showIntroduceVault = true
|
||||
)
|
||||
)
|
||||
VaultSettings(
|
||||
orderOfSpaces = prefs.preferences.getOrDefault(
|
||||
key = account.id,
|
||||
defaultValue = VaultPreference()
|
||||
).orderOfSpaces
|
||||
orderOfSpaces = curr.orderOfSpaces,
|
||||
showIntroduceVault = curr.showIntroduceVault
|
||||
)
|
||||
}
|
||||
.first()
|
||||
|
@ -410,11 +414,15 @@ class DefaultUserSettingsCache(
|
|||
return context.vaultPrefsStore
|
||||
.data
|
||||
.map { prefs ->
|
||||
val curr = prefs.preferences.getOrDefault(
|
||||
key = account.id,
|
||||
defaultValue = VaultPreference(
|
||||
showIntroduceVault = true
|
||||
)
|
||||
)
|
||||
VaultSettings(
|
||||
orderOfSpaces = prefs.preferences.getOrDefault(
|
||||
key = account.id,
|
||||
defaultValue = VaultPreference()
|
||||
).orderOfSpaces
|
||||
orderOfSpaces = curr.orderOfSpaces,
|
||||
showIntroduceVault = curr.showIntroduceVault
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +431,9 @@ class DefaultUserSettingsCache(
|
|||
context.vaultPrefsStore.updateData { existingPreferences ->
|
||||
val curr = existingPreferences.preferences.getOrDefault(
|
||||
key = account.id,
|
||||
defaultValue = VaultPreference()
|
||||
defaultValue = VaultPreference(
|
||||
showIntroduceVault = true
|
||||
)
|
||||
)
|
||||
existingPreferences.copy(
|
||||
preferences = existingPreferences.preferences + mapOf(
|
||||
|
@ -435,6 +445,19 @@ class DefaultUserSettingsCache(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun setVaultSettings(account: Account, settings: VaultSettings) {
|
||||
context.vaultPrefsStore.updateData { existingPreferences ->
|
||||
existingPreferences.copy(
|
||||
preferences = existingPreferences.preferences + mapOf(
|
||||
account.id to VaultPreference(
|
||||
orderOfSpaces = settings.orderOfSpaces,
|
||||
showIntroduceVault = settings.showIntroduceVault
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getAllContentSort(space: SpaceId): Id {
|
||||
return context.spacePrefsStore
|
||||
.data
|
||||
|
|
|
@ -15,6 +15,7 @@ message VaultPreferences {
|
|||
|
||||
message VaultPreference {
|
||||
repeated string orderOfSpaces = 1;
|
||||
bool showIntroduceVault = 2;
|
||||
}
|
||||
|
||||
message SpacePreference {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue