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:
parent
a56132a979
commit
8078b7a3e4
9 changed files with 97 additions and 57 deletions
|
@ -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 {
|
||||
|
|
|
@ -33,4 +33,5 @@ message GlobalSearchHistoryProto {
|
|||
|
||||
message AllContentSettings {
|
||||
optional string sortKey = 1;
|
||||
optional bool isAscending = 2;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue