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

DROID-3210 Space-level chats | Enhancement | Save recently used chat reactions and display it in the dedicated section of the reaction picker (#1967)

This commit is contained in:
Evgenii Kozlov 2025-01-04 07:12:08 +01:00 committed by GitHub
parent f38f3fd8d6
commit 5edb38a440
Signed by: github
GPG key ID: B5690EEEBB952194
12 changed files with 183 additions and 16 deletions

View file

@ -50,7 +50,8 @@ class DefaultUserSettingsCache(
return VaultPreference(
showIntroduceVault = DEFAULT_SHOW_INTRODUCE_VAULT,
isRelativeDates = DEFAULT_RELATIVE_DATES,
dateFormat = appDefaultDateFormatProvider.provide()
dateFormat = appDefaultDateFormatProvider.provide(),
orderOfSpaces = emptyList()
)
}
//endregion
@ -486,6 +487,39 @@ class DefaultUserSettingsCache(
}
}
override suspend fun setRecentlyUsedChatReactions(
account: Account,
emojis: Set<String>
) {
context.vaultPrefsStore.updateData { existingPreferences ->
val curr = existingPreferences.preferences.getOrDefault(
key = account.id,
defaultValue = initialVaultSettings()
)
existingPreferences.copy(
preferences = existingPreferences.preferences + mapOf(
account.id to curr.copy(
recentlyUsedChatReactions = emojis.toList()
)
)
)
}
}
override fun observeRecentlyUsedChatReactions(account: Account): Flow<List<String>> {
return context
.vaultPrefsStore
.data
.map { existing ->
val settings = existing.preferences[account.id]
if (settings != null) {
settings.recentlyUsedChatReactions
} else {
emptyList()
}
}
}
override suspend fun setDateFormat(
account: Account,
format: String

View file

@ -18,6 +18,7 @@ message VaultPreference {
bool showIntroduceVault = 2;
bool isRelativeDates = 3;
optional string dateFormat = 4;
repeated string recentlyUsedChatReactions = 5;
}
message SpacePreference {