Better way to logout

This commit is contained in:
Jobobby04 2021-08-02 00:02:45 -04:00
parent d5423caf91
commit ae99b733e7

View File

@ -74,13 +74,14 @@ class MangaDexLoginHelper(val authServiceLazy: Lazy<MangaDexAuthService>, val pr
return withIOContext { return withIOContext {
try { try {
coroutineScope { coroutineScope {
launch { var delayJob: Job? = null
val loginJob = launch {
authService.logout() authService.logout()
cancel() delayJob?.cancel()
} }
launch { delayJob = launch {
delay(30.seconds) delay(30.seconds)
cancel() loginJob.cancel()
} }
} }
} catch (e: Exception) { } catch (e: Exception) {