mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Merge hotfix 1.4.25 to develop
This commit is contained in:
commit
2f8aeb991e
16
CHANGES.md
16
CHANGES.md
@ -1,4 +1,18 @@
|
||||
Changes in Element v1.4.24 (2022-06-21)
|
||||
Changes in Element v1.4.25 (2022-06-27)
|
||||
=======================================
|
||||
|
||||
Bugfixes 🐛
|
||||
----------
|
||||
- Second attempt to fix session database migration to version 30.
|
||||
|
||||
Changes in Element v1.4.24 (2022-06-22)
|
||||
=======================================
|
||||
|
||||
Bugfixes 🐛
|
||||
----------
|
||||
- First attempt to fix session database migration to version 30.
|
||||
|
||||
Changes in Element v1.4.23 (2022-06-21)
|
||||
=======================================
|
||||
|
||||
Bugfixes 🐛
|
||||
|
2
fastlane/metadata/android/en-US/changelogs/40104250.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/40104250.txt
Normal file
@ -0,0 +1,2 @@
|
||||
Main changes in this version: Various bug fixes and stability improvements.
|
||||
Full changelog: https://github.com/vector-im/element-android/releases
|
@ -20,8 +20,8 @@ import io.realm.DynamicRealm
|
||||
import org.matrix.android.sdk.internal.database.model.ChunkEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.EventEntityFields
|
||||
import org.matrix.android.sdk.internal.database.model.TimelineEventEntityFields
|
||||
import org.matrix.android.sdk.internal.extensions.clearWith
|
||||
import org.matrix.android.sdk.internal.util.database.RealmMigrator
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Migrating to:
|
||||
@ -35,16 +35,23 @@ internal class MigrateSessionTo030(realm: DynamicRealm) : RealmMigrator(realm, 3
|
||||
.equalTo(ChunkEntityFields.IS_LAST_FORWARD, false)
|
||||
.findAll()
|
||||
|
||||
val nbOfDeletedChunks = chunks.size
|
||||
var nbOfDeletedTimelineEvents = 0
|
||||
var nbOfDeletedEvents = 0
|
||||
chunks.forEach { chunk ->
|
||||
chunk.getList(ChunkEntityFields.TIMELINE_EVENTS.`$`).clearWith { timelineEvent ->
|
||||
val timelineEvents = chunk.getList(ChunkEntityFields.TIMELINE_EVENTS.`$`)
|
||||
timelineEvents.forEach { timelineEvent ->
|
||||
// Don't delete state events
|
||||
val event = timelineEvent.getObject(TimelineEventEntityFields.ROOT.`$`)
|
||||
if (event?.isNull(EventEntityFields.STATE_KEY) == true) {
|
||||
nbOfDeletedEvents++
|
||||
event.deleteFromRealm()
|
||||
timelineEvent.deleteFromRealm()
|
||||
}
|
||||
}
|
||||
chunk.deleteFromRealm()
|
||||
nbOfDeletedTimelineEvents += timelineEvents.size
|
||||
timelineEvents.deleteAllFromRealm()
|
||||
}
|
||||
chunks.deleteAllFromRealm()
|
||||
Timber.d("MigrateSessionTo030: $nbOfDeletedChunks deleted chunk(s), $nbOfDeletedTimelineEvents deleted TimelineEvent(s) and $nbOfDeletedEvents deleted Event(s).")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user