mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Avoid useless transaction
This commit is contained in:
parent
a386a4762c
commit
f26178fc21
2 changed files with 10 additions and 2 deletions
|
@ -19,4 +19,9 @@ package org.matrix.android.sdk.internal.crypto.store.db
|
|||
data class CryptoStoreAggregator(
|
||||
val setShouldShareHistoryData: MutableMap<String, Boolean> = mutableMapOf(),
|
||||
val setShouldEncryptForInvitedMembersData: MutableMap<String, Boolean> = mutableMapOf(),
|
||||
)
|
||||
) {
|
||||
fun isEmpty(): Boolean {
|
||||
return setShouldShareHistoryData.isEmpty() &&
|
||||
setShouldEncryptForInvitedMembersData.isEmpty()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1824,7 +1824,11 @@ internal class RealmCryptoStore @Inject constructor(
|
|||
val aggregator = cryptoStoreAggregator ?: return Unit.also {
|
||||
Timber.e("cryptoStoreAggregator is null...")
|
||||
}
|
||||
cryptoStoreAggregator = null
|
||||
|
||||
if (aggregator.isEmpty()) {
|
||||
return
|
||||
}
|
||||
doRealmTransaction("onSyncCompleted", realmConfiguration) { realm ->
|
||||
// setShouldShareHistory
|
||||
aggregator.setShouldShareHistoryData.map {
|
||||
|
@ -1835,6 +1839,5 @@ internal class RealmCryptoStore @Inject constructor(
|
|||
CryptoRoomEntity.getOrCreate(realm, it.key).shouldEncryptForInvitedMembers = it.value
|
||||
}
|
||||
}
|
||||
cryptoStoreAggregator = null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue