Realm: fix small identity mistakes
This commit is contained in:
parent
ed135bc4fc
commit
7e2f821287
@ -79,7 +79,7 @@ internal abstract class IdentityModule {
|
||||
.apply {
|
||||
realmKeysUtils.configureEncryption(this, SessionModule.getKeyAlias(userMd5))
|
||||
}
|
||||
.name("matrix-sdk-global.realm")
|
||||
.name("matrix-sdk-identity.realm")
|
||||
.schemaVersion(identityStoreMigration.schemaVersion)
|
||||
.migration(identityStoreMigration)
|
||||
.build()
|
||||
|
@ -43,9 +43,19 @@ internal class RealmIdentityStore @Inject constructor(
|
||||
}
|
||||
|
||||
override suspend fun setUrl(url: String?) {
|
||||
val identityData = getIdentityDataEntity() ?: return
|
||||
realmInstance.write {
|
||||
findLatest(identityData)?.identityServerUrl = url
|
||||
delete(
|
||||
query(IdentityDataEntity::class).find()
|
||||
)
|
||||
// Delete all pending binding if any
|
||||
delete(
|
||||
query(IdentityPendingBindingEntity::class).find()
|
||||
)
|
||||
if (url == null) return@write
|
||||
val newIdentityData = IdentityDataEntity().apply {
|
||||
identityServerUrl = url
|
||||
}
|
||||
copyToRealm(newIdentityData)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ import javax.inject.Inject
|
||||
|
||||
internal class RealmIdentityStoreMigration @Inject constructor() : MatrixAutomaticSchemaMigration(
|
||||
dbName = "Identity",
|
||||
schemaVersion = 1L,
|
||||
schemaVersion = 2L,
|
||||
) {
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user