mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 18:05:59 +03:00
Merge pull request #258 from vector-im/feature/fix_signout
Fix / signout sign-in not working
This commit is contained in:
commit
8e653979fd
2 changed files with 7 additions and 7 deletions
|
@ -81,13 +81,11 @@ interface Session :
|
||||||
/**
|
/**
|
||||||
* This method start the sync thread.
|
* This method start the sync thread.
|
||||||
*/
|
*/
|
||||||
@MainThread
|
|
||||||
fun startSync()
|
fun startSync()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method stop the sync thread.
|
* This method stop the sync thread.
|
||||||
*/
|
*/
|
||||||
@MainThread
|
|
||||||
fun stopSync()
|
fun stopSync()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,7 +97,6 @@ interface Session :
|
||||||
/**
|
/**
|
||||||
* This method allow to close a session. It does stop some services.
|
* This method allow to close a session. It does stop some services.
|
||||||
*/
|
*/
|
||||||
@MainThread
|
|
||||||
fun close()
|
fun close()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.content.Context
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import androidx.annotation.MainThread
|
import androidx.annotation.MainThread
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.work.WorkManager
|
||||||
import com.zhuinden.monarchy.Monarchy
|
import com.zhuinden.monarchy.Monarchy
|
||||||
import im.vector.matrix.android.api.MatrixCallback
|
import im.vector.matrix.android.api.MatrixCallback
|
||||||
import im.vector.matrix.android.api.auth.data.SessionParams
|
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)
|
SyncWorker.stopAnyBackgroundSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainThread
|
|
||||||
override fun startSync() {
|
override fun startSync() {
|
||||||
assert(isOpen)
|
assert(isOpen)
|
||||||
if (!syncThread.isAlive) {
|
if (!syncThread.isAlive) {
|
||||||
|
@ -113,16 +113,14 @@ internal class DefaultSession @Inject constructor(override val sessionParams: Se
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainThread
|
|
||||||
override fun stopSync() {
|
override fun stopSync() {
|
||||||
assert(isOpen)
|
assert(isOpen)
|
||||||
syncThread.kill()
|
syncThread.kill()
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainThread
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
assertMainThread()
|
|
||||||
assert(isOpen)
|
assert(isOpen)
|
||||||
|
stopSync()
|
||||||
liveEntityObservers.forEach { it.dispose() }
|
liveEntityObservers.forEach { it.dispose() }
|
||||||
cryptoService.close()
|
cryptoService.close()
|
||||||
if (monarchy.isMonarchyThreadOpen) {
|
if (monarchy.isMonarchyThreadOpen) {
|
||||||
|
@ -153,6 +151,11 @@ internal class DefaultSession @Inject constructor(override val sessionParams: Se
|
||||||
override fun onSuccess(data: Unit) {
|
override fun onSuccess(data: Unit) {
|
||||||
Timber.w("SIGN_OUT: clear cache -> SUCCESS: clear crypto cache")
|
Timber.w("SIGN_OUT: clear cache -> SUCCESS: clear crypto cache")
|
||||||
cryptoService.clearCryptoCache(MatrixCallbackDelegate(callback))
|
cryptoService.clearCryptoCache(MatrixCallbackDelegate(callback))
|
||||||
|
|
||||||
|
WorkManager.getInstance(context).also {
|
||||||
|
it.cancelAllWork()
|
||||||
|
it.pruneWork()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(failure: Throwable) {
|
override fun onFailure(failure: Throwable) {
|
||||||
|
|
Loading…
Reference in a new issue