1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-2731 Vault | Tech | Persist vault settings (#1609)

This commit is contained in:
Evgenii Kozlov 2024-10-01 16:34:37 +02:00 committed by GitHub
parent 56dc92f28c
commit c0fdc36db4
Signed by: github
GPG key ID: B5690EEEBB952194
7 changed files with 121 additions and 2 deletions

View file

@ -1,5 +1,6 @@
package com.anytypeio.anytype.data.auth.repo
import com.anytypeio.anytype.core_models.Account
import com.anytypeio.anytype.core_models.GlobalSearchHistory
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ThemeMode
@ -7,9 +8,15 @@ import com.anytypeio.anytype.core_models.Wallpaper
import com.anytypeio.anytype.core_models.WidgetSession
import com.anytypeio.anytype.core_models.primitives.SpaceId
import com.anytypeio.anytype.core_models.primitives.TypeId
import com.anytypeio.anytype.core_models.settings.VaultSettings
import kotlinx.coroutines.flow.Flow
interface UserSettingsCache {
suspend fun getVaultSettings(account: Account): VaultSettings
suspend fun observeVaultSettings(account: Account): Flow<VaultSettings>
suspend fun setVaultSpaceOrder(account: Account, order: List<Id>)
suspend fun setCurrentSpace(space: SpaceId)
suspend fun getCurrentSpace(): SpaceId?
suspend fun clearCurrentSpace()

View file

@ -1,5 +1,6 @@
package com.anytypeio.anytype.data.auth.repo
import com.anytypeio.anytype.core_models.Account
import com.anytypeio.anytype.core_models.GlobalSearchHistory
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ThemeMode
@ -7,6 +8,7 @@ import com.anytypeio.anytype.core_models.Wallpaper
import com.anytypeio.anytype.core_models.WidgetSession
import com.anytypeio.anytype.core_models.primitives.SpaceId
import com.anytypeio.anytype.core_models.primitives.TypeId
import com.anytypeio.anytype.core_models.settings.VaultSettings
import com.anytypeio.anytype.domain.config.UserSettingsRepository
import kotlinx.coroutines.flow.Flow
@ -88,4 +90,19 @@ class UserSettingsDataRepository(private val cache: UserSettingsCache) : UserSet
override suspend fun clearGlobalSearchHistory(space: SpaceId) {
cache.clearGlobalSearchHistory(space)
}
override suspend fun getVaultSettings(account: Account): VaultSettings {
return cache.getVaultSettings(account)
}
override suspend fun observeVaultSettings(account: Account): Flow<VaultSettings> {
return cache.observeVaultSettings(account)
}
override suspend fun setVaultSpaceOrder(account: Account, order: List<Id>) {
cache.setVaultSpaceOrder(
account = account,
order = order
)
}
}