reusing refresh extension

This commit is contained in:
Adam Brown 2022-02-14 12:05:53 +00:00
parent 4519dec7eb
commit fed549f647
2 changed files with 4 additions and 9 deletions

View File

@ -17,7 +17,7 @@
package org.matrix.android.sdk.internal.database.migration
import io.realm.DynamicRealm
import org.matrix.android.sdk.internal.database.model.HomeServerCapabilitiesEntityFields
import org.matrix.android.sdk.internal.extensions.forceRefreshOfHomeServerCapabilities
import org.matrix.android.sdk.internal.util.database.RealmMigrator
class MigrateSessionTo003(realm: DynamicRealm) : RealmMigrator(realm, 3) {
@ -25,9 +25,6 @@ class MigrateSessionTo003(realm: DynamicRealm) : RealmMigrator(realm, 3) {
override fun doMigrate(realm: DynamicRealm) {
realm.schema.get("HomeServerCapabilitiesEntity")
?.addField("preferredJitsiDomain", String::class.java)
?.transform { obj ->
// Schedule a refresh of the capabilities
obj.setLong(HomeServerCapabilitiesEntityFields.LAST_UPDATED_TIMESTAMP, 0)
}
?.forceRefreshOfHomeServerCapabilities()
}
}

View File

@ -18,6 +18,7 @@ package org.matrix.android.sdk.internal.database.migration
import io.realm.DynamicRealm
import org.matrix.android.sdk.internal.database.model.HomeServerCapabilitiesEntityFields
import org.matrix.android.sdk.internal.extensions.forceRefreshOfHomeServerCapabilities
import org.matrix.android.sdk.internal.util.database.RealmMigrator
class MigrateSessionTo016(realm: DynamicRealm) : RealmMigrator(realm, 16) {
@ -25,9 +26,6 @@ class MigrateSessionTo016(realm: DynamicRealm) : RealmMigrator(realm, 16) {
override fun doMigrate(realm: DynamicRealm) {
realm.schema.get("HomeServerCapabilitiesEntity")
?.addField(HomeServerCapabilitiesEntityFields.ROOM_VERSIONS_JSON, String::class.java)
?.transform { obj ->
// Schedule a refresh of the capabilities
obj.setLong(HomeServerCapabilitiesEntityFields.LAST_UPDATED_TIMESTAMP, 0)
}
?.forceRefreshOfHomeServerCapabilities()
}
}