Minor refactors
This commit is contained in:
@@ -16,14 +16,16 @@ 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)
|
||||
val sourceManager = Injekt.get<SourceManager>()
|
||||
sourceManager.isInitialized.first { it }
|
||||
MdUtil.getEnabledMangaDex(sourceManager = sourceManager)?.login(code)
|
||||
returnToSettings()
|
||||
}
|
||||
} else {
|
||||
lifecycleScope.launchIO {
|
||||
Injekt.get<SourceManager>().isInitialized.first { it }
|
||||
MdUtil.getEnabledMangaDex(Injekt.get())?.logout()
|
||||
val sourceManager = Injekt.get<SourceManager>()
|
||||
sourceManager.isInitialized.first { it }
|
||||
MdUtil.getEnabledMangaDex(sourceManager = sourceManager)?.logout()
|
||||
returnToSettings()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import cafe.adriel.voyager.core.model.rememberScreenModel
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.presentation.browse.BrowseSourceContent
|
||||
import eu.kanade.presentation.browse.components.BrowseSourceSimpleToolbar
|
||||
import eu.kanade.presentation.browse.components.RemoveMangaDialog
|
||||
@@ -26,7 +27,6 @@ import eu.kanade.tachiyomi.ui.manga.MangaScreen
|
||||
import exh.ui.ifSourcesLoaded
|
||||
import mihon.presentation.core.util.collectAsLazyPagingItems
|
||||
import tachiyomi.core.common.util.lang.launchIO
|
||||
import tachiyomi.domain.UnsortedPreferences
|
||||
import tachiyomi.i18n.sy.SYMR
|
||||
import tachiyomi.presentation.core.components.material.Scaffold
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
@@ -109,7 +109,7 @@ class MangaDexFollowsScreen(private val sourceId: Long) : Screen() {
|
||||
onOpenManga = { navigator.push(MangaScreen(it.id)) },
|
||||
onMigrate = {
|
||||
PreMigrationScreen.navigateToMigration(
|
||||
Injekt.get<UnsortedPreferences>().skipPreMigration().get(),
|
||||
Injekt.get<SourcePreferences>().skipPreMigration().get(),
|
||||
navigator,
|
||||
it.id,
|
||||
dialog.manga.id,
|
||||
|
||||
@@ -17,7 +17,6 @@ import exh.source.getMainSource
|
||||
import exh.util.dropBlank
|
||||
import exh.util.floor
|
||||
import exh.util.nullIfZero
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.FormBody
|
||||
import okhttp3.Headers
|
||||
@@ -26,7 +25,6 @@ import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import org.jsoup.parser.Parser
|
||||
import tachiyomi.domain.UnsortedPreferences
|
||||
import tachiyomi.domain.source.service.SourceManager
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
@@ -232,9 +230,9 @@ class MdUtil {
|
||||
return codeVerifier ?: PkceUtil.generateCodeVerifier().also { codeVerifier = it }
|
||||
}
|
||||
|
||||
fun getEnabledMangaDex(preferences: UnsortedPreferences, sourcePreferences: SourcePreferences = Injekt.get(), sourceManager: SourceManager = Injekt.get()): MangaDex? {
|
||||
fun getEnabledMangaDex(sourcePreferences: SourcePreferences = Injekt.get(), sourceManager: SourceManager = Injekt.get()): MangaDex? {
|
||||
return getEnabledMangaDexs(sourcePreferences, sourceManager).let { mangadexs ->
|
||||
preferences.preferredMangaDexId().get().toLongOrNull()?.nullIfZero()
|
||||
sourcePreferences.preferredMangaDexId().get().toLongOrNull()?.nullIfZero()
|
||||
?.let { preferredMangaDexId ->
|
||||
mangadexs.firstOrNull { it.id == preferredMangaDexId }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user