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 package org.matrix.android.sdk.internal.database
import io.realm.DefaultCompactOnLaunchCallback import io.realm.DefaultCompactOnLaunchCallback
import javax.inject.Inject
class RealmCompactOnLaunch @Inject constructor() : DefaultCompactOnLaunchCallback() { class RealmCompactOnLaunch : DefaultCompactOnLaunchCallback() {
/** /**
* Forces all RealmCompactOnLaunch instances to be equal. * Forces all RealmCompactOnLaunch instances to be equal.
* Avoids Realm throwing when multiple instances of this class are used. * 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 override fun hashCode() = 0x1000
} }

View File

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