Granfra's review

This commit is contained in:
Benoit Marty 2022-08-23 16:25:47 +02:00
parent adcb3c594a
commit 6c2885ff39
2 changed files with 3 additions and 5 deletions

View File

@ -17,13 +17,12 @@
package org.matrix.android.sdk.internal.database
import io.realm.DefaultCompactOnLaunchCallback
import javax.inject.Inject
class RealmCompactOnLaunch @Inject constructor() : DefaultCompactOnLaunchCallback() {
class RealmCompactOnLaunch : DefaultCompactOnLaunchCallback() {
/**
* Forces all RealmCompactOnLaunch instances to be equal.
* Avoids Realm throwing when multiple instances of this class are used.
*/
override fun equals(other: Any?) = other is RealmSessionStoreMigration
override fun equals(other: Any?) = other is RealmCompactOnLaunch
override fun hashCode() = 0x1000
}

View File

@ -41,7 +41,6 @@ private const val REALM_NAME = "disk_store.realm"
internal class SessionRealmConfigurationFactory @Inject constructor(
private val realmKeysUtils: RealmKeysUtils,
private val realmSessionStoreMigration: RealmSessionStoreMigration,
private val realmCompactOnLaunch: RealmCompactOnLaunch,
@SessionFilesDirectory val directory: File,
@SessionId val sessionId: String,
@UserMd5 val userMd5: String,
@ -65,7 +64,7 @@ internal class SessionRealmConfigurationFactory @Inject constructor(
}
val realmConfiguration = RealmConfiguration.Builder()
.compactOnLaunch(realmCompactOnLaunch)
.compactOnLaunch(RealmCompactOnLaunch())
.directory(directory)
.name(REALM_NAME)
.apply {