forked from GitHub-Mirror/riotX-android
Improve signout task
This commit is contained in:
parent
82d89825d3
commit
43659dffd3
@ -25,5 +25,5 @@ internal interface SessionParamsStore {
|
||||
|
||||
fun save(sessionParams: SessionParams): Try<SessionParams>
|
||||
|
||||
fun delete()
|
||||
fun delete(): Try<Unit>
|
||||
}
|
@ -50,7 +50,8 @@ internal class RealmSessionParamsStore(private val mapper: SessionParamsMapper,
|
||||
return sessionParams
|
||||
}
|
||||
|
||||
override fun delete() {
|
||||
override fun delete(): Try<Unit> {
|
||||
return Try {
|
||||
val realm = Realm.getInstance(realmConfiguration)
|
||||
realm.executeTransaction {
|
||||
it.where(SessionParamsEntity::class.java)
|
||||
@ -59,5 +60,6 @@ internal class RealmSessionParamsStore(private val mapper: SessionParamsMapper,
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -30,7 +30,7 @@ internal class DefaultSignOutTask(private val signOutAPI: SignOutAPI,
|
||||
override fun execute(params: Unit): Try<Unit> {
|
||||
return executeRequest<Unit> {
|
||||
apiCall = signOutAPI.signOut()
|
||||
}.map {
|
||||
}.flatMap {
|
||||
// TODO Clear DB, media cache, etc.
|
||||
sessionParamsStore.delete()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user