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,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<Unit> {
|
||||
return Try {
|
||||
val realm = Realm.getInstance(realmConfiguration)
|
||||
realm.executeTransaction {
|
||||
it.where(SessionParamsEntity::class.java)
|
||||
.findAll()
|
||||
.deleteAllFromRealm()
|
||||
}
|
||||
realm.close()
|
||||
}
|
||||
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