diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/SessionParamsStore.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/SessionParamsStore.kt index fa9c73a9b3..df8b71e48d 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/SessionParamsStore.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/SessionParamsStore.kt @@ -25,5 +25,5 @@ internal interface SessionParamsStore { fun save(sessionParams: SessionParams): Try - fun delete() + fun delete(): Try } \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/db/RealmSessionParamsStore.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/db/RealmSessionParamsStore.kt index e621c6d015..084495869c 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/db/RealmSessionParamsStore.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/db/RealmSessionParamsStore.kt @@ -50,14 +50,16 @@ internal class RealmSessionParamsStore(private val mapper: SessionParamsMapper, return sessionParams } - override fun delete() { - val realm = Realm.getInstance(realmConfiguration) - realm.executeTransaction { - it.where(SessionParamsEntity::class.java) - .findAll() - .deleteAllFromRealm() + override fun delete(): Try { + return Try { + val realm = Realm.getInstance(realmConfiguration) + realm.executeTransaction { + it.where(SessionParamsEntity::class.java) + .findAll() + .deleteAllFromRealm() + } + realm.close() } - realm.close() } } \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/signout/SignOutTask.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/signout/SignOutTask.kt index 7ef65e7002..6ca971e3a2 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/signout/SignOutTask.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/signout/SignOutTask.kt @@ -30,7 +30,7 @@ internal class DefaultSignOutTask(private val signOutAPI: SignOutAPI, override fun execute(params: Unit): Try { return executeRequest { apiCall = signOutAPI.signOut() - }.map { + }.flatMap { // TODO Clear DB, media cache, etc. sessionParamsStore.delete() }