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

DROID-2734 Global search | Save search query, related to state (#1541)

This commit is contained in:
Konstantin Ivanov 2024-09-16 16:51:22 +02:00 committed by GitHub
parent 0544fb7cf9
commit 6f6c08b0bb
Signed by: github
GPG key ID: B5690EEEBB952194
37 changed files with 591 additions and 419 deletions

View file

@ -1,5 +1,6 @@
package com.anytypeio.anytype.data.auth.repo
import com.anytypeio.anytype.core_models.GlobalSearchHistory
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ThemeMode
import com.anytypeio.anytype.core_models.Wallpaper
@ -22,9 +23,9 @@ interface UserSettingsCache {
suspend fun getLastOpenedObject(space: SpaceId) : Id?
suspend fun clearLastOpenedObject(space: SpaceId)
suspend fun setLastSearchQuery(query: String, space: SpaceId)
suspend fun getLastSearchQuery(space: SpaceId): String
suspend fun clearLastSearchQuery(space: SpaceId)
suspend fun setGlobalSearchHistory(globalSearchHistory: GlobalSearchHistory, space: SpaceId)
suspend fun getGlobalSearchHistory(space: SpaceId): GlobalSearchHistory?
suspend fun clearGlobalSearchHistory(space: SpaceId)
suspend fun setWallpaper(space: Id, wallpaper: Wallpaper)
suspend fun getWallpaper(space: Id) : Wallpaper

View file

@ -1,5 +1,6 @@
package com.anytypeio.anytype.data.auth.repo
import com.anytypeio.anytype.core_models.GlobalSearchHistory
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.ThemeMode
import com.anytypeio.anytype.core_models.Wallpaper
@ -76,15 +77,15 @@ class UserSettingsDataRepository(private val cache: UserSettingsCache) : UserSet
cache.clearLastOpenedObject(space)
}
override suspend fun setLastSearchQuery(query: String, space: SpaceId) {
cache.setLastSearchQuery(query, space)
override suspend fun setGlobalSearchHistory(globalSearchHistory: GlobalSearchHistory, space: SpaceId) {
cache.setGlobalSearchHistory(globalSearchHistory, space)
}
override suspend fun getLastSearchQuery(space: SpaceId): String {
return cache.getLastSearchQuery(space)
override suspend fun setGlobalSearchHistory(space: SpaceId): GlobalSearchHistory? {
return cache.getGlobalSearchHistory(space)
}
override suspend fun clearLastSearchQuery(space: SpaceId) {
cache.clearLastSearchQuery(space)
override suspend fun clearGlobalSearchHistory(space: SpaceId) {
cache.clearGlobalSearchHistory(space)
}
}