Minor improvements

This commit is contained in:
Jobobby04 2025-01-22 12:58:26 -05:00
parent 456db52653
commit 2b890c2057
2 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.receiveAsFlow
@ -77,6 +78,7 @@ open class FeedScreenModel(
getFeedSavedSearchGlobal.subscribe() getFeedSavedSearchGlobal.subscribe()
.distinctUntilChanged() .distinctUntilChanged()
.onEach { .onEach {
sourceManager.isInitialized.first { it }
val items = getSourcesToGetFeed(it).map { (feed, savedSearch) -> val items = getSourcesToGetFeed(it).map { (feed, savedSearch) ->
createCatalogueSearchItem( createCatalogueSearchItem(
feed = feed, feed = feed,

View File

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