mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Small cleanup
This commit is contained in:
parent
f28714c5b2
commit
ccf8e94c5e
1 changed files with 3 additions and 4 deletions
|
@ -119,7 +119,7 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
||||||
val rooms = when (handlingStrategy) {
|
val rooms = when (handlingStrategy) {
|
||||||
is HandlingStrategy.JOINED -> {
|
is HandlingStrategy.JOINED -> {
|
||||||
if (isInitialSync && initialSyncStrategy is InitialSyncStrategy.Optimized) {
|
if (isInitialSync && initialSyncStrategy is InitialSyncStrategy.Optimized) {
|
||||||
insertJoinRoomsFromInitSync(realm, handlingStrategy, insertType, syncLocalTimeStampMillis, reporter)
|
insertJoinRoomsFromInitSync(realm, handlingStrategy, syncLocalTimeStampMillis, reporter)
|
||||||
// Rooms are already inserted, return an empty list
|
// Rooms are already inserted, return an empty list
|
||||||
emptyList()
|
emptyList()
|
||||||
} else {
|
} else {
|
||||||
|
@ -144,7 +144,6 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
||||||
|
|
||||||
private fun insertJoinRoomsFromInitSync(realm: Realm,
|
private fun insertJoinRoomsFromInitSync(realm: Realm,
|
||||||
handlingStrategy: HandlingStrategy.JOINED,
|
handlingStrategy: HandlingStrategy.JOINED,
|
||||||
insertType: EventInsertType,
|
|
||||||
syncLocalTimeStampMillis: Long,
|
syncLocalTimeStampMillis: Long,
|
||||||
reporter: ProgressReporter?) {
|
reporter: ProgressReporter?) {
|
||||||
val maxSize = (initialSyncStrategy as? InitialSyncStrategy.Optimized)?.maxRoomsToInsert ?: Int.MAX_VALUE
|
val maxSize = (initialSyncStrategy as? InitialSyncStrategy.Optimized)?.maxRoomsToInsert ?: Int.MAX_VALUE
|
||||||
|
@ -167,7 +166,7 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
||||||
roomId = it,
|
roomId = it,
|
||||||
roomSync = handlingStrategy.data[it] ?: error("Should not happen"),
|
roomSync = handlingStrategy.data[it] ?: error("Should not happen"),
|
||||||
handleEphemeralEvents = false,
|
handleEphemeralEvents = false,
|
||||||
insertType = insertType,
|
insertType = EventInsertType.INITIAL_SYNC,
|
||||||
syncLocalTimestampMillis = syncLocalTimeStampMillis
|
syncLocalTimestampMillis = syncLocalTimeStampMillis
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -178,7 +177,7 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
||||||
} else {
|
} else {
|
||||||
// No need to split
|
// No need to split
|
||||||
val rooms = handlingStrategy.data.mapWithProgress(reporter, InitSyncStep.ImportingAccountJoinedRooms, 0.6f) {
|
val rooms = handlingStrategy.data.mapWithProgress(reporter, InitSyncStep.ImportingAccountJoinedRooms, 0.6f) {
|
||||||
handleJoinedRoom(realm, it.key, it.value, false, insertType, syncLocalTimeStampMillis)
|
handleJoinedRoom(realm, it.key, it.value, false, EventInsertType.INITIAL_SYNC, syncLocalTimeStampMillis)
|
||||||
}
|
}
|
||||||
realm.insertOrUpdate(rooms)
|
realm.insertOrUpdate(rooms)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue