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

DROID-2897 All content | Update grouping by date (#1650)

This commit is contained in:
Konstantin Ivanov 2024-10-08 12:14:22 +02:00 committed by GitHub
parent a56132a979
commit 8078b7a3e4
Signed by: github
GPG key ID: B5690EEEBB952194
9 changed files with 97 additions and 57 deletions

View file

@ -458,20 +458,19 @@ class DefaultUserSettingsCache(
}
}
override suspend fun getAllContentSort(space: SpaceId): Id {
override suspend fun getAllContentSort(space: SpaceId): Pair<Id, Boolean> {
return context.spacePrefsStore
.data
.map { preferences ->
preferences
.preferences[space.id]
?.allContent
?.sortKey
.orEmpty()
val pref = preferences.preferences[space.id]?.allContent
val sortKey = pref?.sortKey.orEmpty()
val isAsc = pref?.isAscending ?: true
sortKey to isAsc
}
.first()
}
override suspend fun setAllContentSort(space: SpaceId, sort: Id) {
override suspend fun setAllContentSort(space: SpaceId, sort: Id, isAsc: Boolean) {
context.spacePrefsStore.updateData { existingPreferences ->
val givenSpacePreference = existingPreferences
.preferences
@ -481,7 +480,8 @@ class DefaultUserSettingsCache(
)
val updated = givenSpacePreference.copy(
allContent = AllContentSettings(
sortKey = sort
sortKey = sort,
isAscending = isAsc
)
)
val result = buildMap {

View file

@ -33,4 +33,5 @@ message GlobalSearchHistoryProto {
message AllContentSettings {
optional string sortKey = 1;
optional bool isAscending = 2;
}