Merge hotfix 1.3.18 to develop
This commit is contained in:
commit
105118f831
|
@ -1,3 +1,11 @@
|
||||||
|
Changes in Element v1.3.18 (2022-02-03)
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
Bugfixes 🐛
|
||||||
|
----------
|
||||||
|
- Avoid deleting root event of CurrentState on gappy sync. In order to restore lost Events an initial sync may be triggered. ([#5137](https://github.com/vector-im/element-android/issues/5137))
|
||||||
|
|
||||||
|
|
||||||
Changes in Element v1.3.17 (2022-01-31)
|
Changes in Element v1.3.17 (2022-01-31)
|
||||||
=======================================
|
=======================================
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Main changes in this version: send your location to any room. Edit poll.
|
||||||
|
Full changelog: https://github.com/vector-im/element-android/releases/tag/v1.3.18
|
|
@ -57,7 +57,7 @@ internal class RealmSessionStoreMigration @Inject constructor(
|
||||||
) : RealmMigration {
|
) : RealmMigration {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val SESSION_STORE_SCHEMA_VERSION = 22L
|
const val SESSION_STORE_SCHEMA_VERSION = 23L
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,6 +92,7 @@ internal class RealmSessionStoreMigration @Inject constructor(
|
||||||
if (oldVersion <= 19) migrateTo20(realm)
|
if (oldVersion <= 19) migrateTo20(realm)
|
||||||
if (oldVersion <= 20) migrateTo21(realm)
|
if (oldVersion <= 20) migrateTo21(realm)
|
||||||
if (oldVersion <= 21) migrateTo22(realm)
|
if (oldVersion <= 21) migrateTo22(realm)
|
||||||
|
if (oldVersion <= 22) migrateTo23(realm)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun migrateTo1(realm: DynamicRealm) {
|
private fun migrateTo1(realm: DynamicRealm) {
|
||||||
|
@ -450,6 +451,22 @@ internal class RealmSessionStoreMigration @Inject constructor(
|
||||||
|
|
||||||
private fun migrateTo22(realm: DynamicRealm) {
|
private fun migrateTo22(realm: DynamicRealm) {
|
||||||
Timber.d("Step 21 -> 22")
|
Timber.d("Step 21 -> 22")
|
||||||
|
val listJoinedRoomIds = realm.where("RoomEntity")
|
||||||
|
.equalTo(RoomEntityFields.MEMBERSHIP_STR, Membership.JOIN.name).findAll()
|
||||||
|
.map { it.getString(RoomEntityFields.ROOM_ID) }
|
||||||
|
|
||||||
|
val hasMissingStateEvent = realm.where("CurrentStateEventEntity")
|
||||||
|
.`in`(CurrentStateEventEntityFields.ROOM_ID, listJoinedRoomIds.toTypedArray())
|
||||||
|
.isNull(CurrentStateEventEntityFields.ROOT.`$`).findFirst() != null
|
||||||
|
|
||||||
|
if (hasMissingStateEvent) {
|
||||||
|
Timber.v("Has some missing state event, clear session cache")
|
||||||
|
realm.deleteAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun migrateTo23(realm: DynamicRealm) {
|
||||||
|
Timber.d("Step 22 -> 23")
|
||||||
val eventEntity = realm.schema.get("TimelineEventEntity") ?: return
|
val eventEntity = realm.schema.get("TimelineEventEntity") ?: return
|
||||||
|
|
||||||
realm.schema.get("EventEntity")
|
realm.schema.get("EventEntity")
|
||||||
|
|
|
@ -52,6 +52,9 @@ internal fun ChunkEntity.deleteOnCascade(deleteStateEvents: Boolean, canDeleteRo
|
||||||
if (deleteStateEvents) {
|
if (deleteStateEvents) {
|
||||||
stateEvents.deleteAllFromRealm()
|
stateEvents.deleteAllFromRealm()
|
||||||
}
|
}
|
||||||
timelineEvents.clearWith { it.deleteOnCascade(canDeleteRoot) }
|
timelineEvents.clearWith {
|
||||||
|
val deleteRoot = canDeleteRoot && (it.root?.stateKey == null || deleteStateEvents)
|
||||||
|
it.deleteOnCascade(deleteRoot)
|
||||||
|
}
|
||||||
deleteFromRealm()
|
deleteFromRealm()
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,7 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
||||||
aggregator: SyncResponsePostTreatmentAggregator): ChunkEntity {
|
aggregator: SyncResponsePostTreatmentAggregator): ChunkEntity {
|
||||||
val lastChunk = ChunkEntity.findLastForwardChunkOfRoom(realm, roomEntity.roomId)
|
val lastChunk = ChunkEntity.findLastForwardChunkOfRoom(realm, roomEntity.roomId)
|
||||||
if (isLimited && lastChunk != null) {
|
if (isLimited && lastChunk != null) {
|
||||||
lastChunk.deleteOnCascade(deleteStateEvents = true, canDeleteRoot = true)
|
lastChunk.deleteOnCascade(deleteStateEvents = false, canDeleteRoot = true)
|
||||||
}
|
}
|
||||||
val chunkEntity = if (!isLimited && lastChunk != null) {
|
val chunkEntity = if (!isLimited && lastChunk != null) {
|
||||||
lastChunk
|
lastChunk
|
||||||
|
|
Loading…
Reference in New Issue