forked from GitHub-Mirror/riotX-android
Merge pull request #258 from vector-im/feature/fix_signout
Fix / signout sign-in not working
This commit is contained in:
commit
8e653979fd
@ -81,13 +81,11 @@ interface Session :
|
||||
/**
|
||||
* This method start the sync thread.
|
||||
*/
|
||||
@MainThread
|
||||
fun startSync()
|
||||
|
||||
/**
|
||||
* This method stop the sync thread.
|
||||
*/
|
||||
@MainThread
|
||||
fun stopSync()
|
||||
|
||||
/**
|
||||
@ -99,7 +97,6 @@ interface Session :
|
||||
/**
|
||||
* This method allow to close a session. It does stop some services.
|
||||
*/
|
||||
@MainThread
|
||||
fun close()
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,7 @@ import android.content.Context
|
||||
import android.os.Looper
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.work.WorkManager
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.auth.data.SessionParams
|
||||
@ -102,7 +103,6 @@ internal class DefaultSession @Inject constructor(override val sessionParams: Se
|
||||
SyncWorker.stopAnyBackgroundSync(context)
|
||||
}
|
||||
|
||||
@MainThread
|
||||
override fun startSync() {
|
||||
assert(isOpen)
|
||||
if (!syncThread.isAlive) {
|
||||
@ -113,16 +113,14 @@ internal class DefaultSession @Inject constructor(override val sessionParams: Se
|
||||
}
|
||||
}
|
||||
|
||||
@MainThread
|
||||
override fun stopSync() {
|
||||
assert(isOpen)
|
||||
syncThread.kill()
|
||||
}
|
||||
|
||||
@MainThread
|
||||
override fun close() {
|
||||
assertMainThread()
|
||||
assert(isOpen)
|
||||
stopSync()
|
||||
liveEntityObservers.forEach { it.dispose() }
|
||||
cryptoService.close()
|
||||
if (monarchy.isMonarchyThreadOpen) {
|
||||
@ -153,6 +151,11 @@ internal class DefaultSession @Inject constructor(override val sessionParams: Se
|
||||
override fun onSuccess(data: Unit) {
|
||||
Timber.w("SIGN_OUT: clear cache -> SUCCESS: clear crypto cache")
|
||||
cryptoService.clearCryptoCache(MatrixCallbackDelegate(callback))
|
||||
|
||||
WorkManager.getInstance(context).also {
|
||||
it.cancelAllWork()
|
||||
it.pruneWork()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(failure: Throwable) {
|
||||
|
Loading…
Reference in New Issue
Block a user