mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Fix bugs for chat folders in storage sync.
This commit is contained in:
committed by
Jeffrey Starke
parent
d636ef8ec9
commit
958dde0f6e
@@ -326,6 +326,7 @@ class ChatFolderTables(context: Context?, databaseHelper: SignalDatabase?) : Dat
|
||||
ChatFolderTable.SHOW_MUTED to chatFolder.showMutedChats,
|
||||
ChatFolderTable.SHOW_INDIVIDUAL to chatFolder.showIndividualChats,
|
||||
ChatFolderTable.SHOW_GROUPS to chatFolder.showGroupChats,
|
||||
ChatFolderTable.STORAGE_SERVICE_ID to chatFolder.storageServiceId.let { Base64.encodeWithPadding(chatFolder.storageServiceId!!.raw) },
|
||||
ChatFolderTable.STORAGE_SERVICE_PROTO to storageServiceProto,
|
||||
ChatFolderTable.DELETED_TIMESTAMP_MS to chatFolder.deletedTimestampMs
|
||||
)
|
||||
|
||||
@@ -75,7 +75,7 @@ class ChatFolderRecordProcessor : DefaultStorageRecordProcessor<SignalChatFolder
|
||||
*/
|
||||
override fun merge(remote: SignalChatFolderRecord, local: SignalChatFolderRecord, keyGenerator: StorageKeyGenerator): SignalChatFolderRecord {
|
||||
return if (remote.proto.deletedAtTimestampMs > 0 && local.proto.deletedAtTimestampMs > 0) {
|
||||
if (remote.proto.deletedAtTimestampMs < local.proto.deletedAtTimestampMs) {
|
||||
if (remote.proto.deletedAtTimestampMs <= local.proto.deletedAtTimestampMs) {
|
||||
remote
|
||||
} else {
|
||||
local
|
||||
|
||||
@@ -72,7 +72,7 @@ class NotificationProfileRecordProcessor : DefaultStorageRecordProcessor<SignalN
|
||||
val isLocalDeleted = local.proto.deletedAtTimestampMs > 0
|
||||
|
||||
return when {
|
||||
isRemoteDeleted && isLocalDeleted -> if (remote.proto.deletedAtTimestampMs < local.proto.deletedAtTimestampMs) remote else local
|
||||
isRemoteDeleted && isLocalDeleted -> if (remote.proto.deletedAtTimestampMs <= local.proto.deletedAtTimestampMs) remote else local
|
||||
isRemoteDeleted -> remote
|
||||
isLocalDeleted -> local
|
||||
else -> remote
|
||||
|
||||
Reference in New Issue
Block a user