Skip to content

Commit

Permalink
Batch insertion of shouldEncryptForInvitedMembers
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Jan 3, 2023
1 parent 6f384c7 commit c1a8bf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
package org.matrix.android.sdk.internal.crypto.store.db

data class CryptoStoreAggregator(
val setShouldShareHistoryData: MutableMap<String, Boolean> = mutableMapOf()
val setShouldShareHistoryData: MutableMap<String, Boolean> = mutableMapOf(),
val setShouldEncryptForInvitedMembersData: MutableMap<String, Boolean> = mutableMapOf(),
)
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,7 @@ internal class RealmCryptoStore @Inject constructor(
}

override fun setShouldEncryptForInvitedMembers(roomId: String, shouldEncryptForInvitedMembers: Boolean) {
doRealmTransaction(realmConfiguration) {
CryptoRoomEntity.getOrCreate(it, roomId).shouldEncryptForInvitedMembers = shouldEncryptForInvitedMembers
}
cryptoStoreAggregator?.setShouldEncryptForInvitedMembersData?.put(roomId, shouldEncryptForInvitedMembers)
}

override fun setShouldShareHistory(roomId: String, shouldShareHistory: Boolean) {
Expand Down Expand Up @@ -1832,6 +1830,10 @@ internal class RealmCryptoStore @Inject constructor(
aggregator.setShouldShareHistoryData.map {
CryptoRoomEntity.getOrCreate(realm, it.key).shouldShareHistory = it.value
}
// setShouldEncryptForInvitedMembers
aggregator.setShouldEncryptForInvitedMembersData.map {
CryptoRoomEntity.getOrCreate(realm, it.key).shouldEncryptForInvitedMembers = it.value
}
}
cryptoStoreAggregator = null
}
Expand Down

0 comments on commit c1a8bf8

Please sign in to comment.