Minor improvements

(cherry picked from commit 2b890c20577100e64004e4983cbda2467ba695df)
This commit is contained in:
Jobobby04 2025-01-22 12:58:26 -05:00 committed by Cuong-Tran
parent 24f7d133f7
commit aba9faff57
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
2 changed files with 6 additions and 0 deletions

View file

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

View file

@ -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()
}