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:
parent
56dc92f28c
commit
c0fdc36db4
7 changed files with 121 additions and 2 deletions
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue