Minor improvements
This commit is contained in:
@@ -4,7 +4,9 @@ import android.net.Uri
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import eu.kanade.tachiyomi.ui.setting.track.BaseOAuthLoginActivity
|
||||
import exh.md.utils.MdUtil
|
||||
import kotlinx.coroutines.flow.first
|
||||
import tachiyomi.core.common.util.lang.launchIO
|
||||
import tachiyomi.domain.source.service.SourceManager
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
@@ -14,11 +16,13 @@ class MangaDexLoginActivity : BaseOAuthLoginActivity() {
|
||||
val code = data?.getQueryParameter("code")
|
||||
if (code != null) {
|
||||
lifecycleScope.launchIO {
|
||||
Injekt.get<SourceManager>().isInitialized.first { it }
|
||||
MdUtil.getEnabledMangaDex(Injekt.get())?.login(code)
|
||||
returnToSettings()
|
||||
}
|
||||
} else {
|
||||
lifecycleScope.launchIO {
|
||||
Injekt.get<SourceManager>().isInitialized.first { it }
|
||||
MdUtil.getEnabledMangaDex(Injekt.get())?.logout()
|
||||
returnToSettings()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user