Minor cleanup
This commit is contained in:
parent
87d7a47b8e
commit
7c2bbb7c00
@ -34,6 +34,11 @@ class GalleryAdder(
|
|||||||
enabledLanguages().get() to disabledSources().get().map { it.toLong() }.toSet()
|
enabledLanguages().get() to disabledSources().get().map { it.toLong() }.toSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val Pair<Set<String>, Set<Long>>.enabledLangs
|
||||||
|
get() = first
|
||||||
|
private val Pair<Set<String>, Set<Long>>.disabledSources
|
||||||
|
get() = second
|
||||||
|
|
||||||
private val logger = xLogStack()
|
private val logger = xLogStack()
|
||||||
|
|
||||||
fun pickSource(url: String): List<UrlImportableSource> {
|
fun pickSource(url: String): List<UrlImportableSource> {
|
||||||
@ -41,7 +46,7 @@ class GalleryAdder(
|
|||||||
return sourceManager.getVisibleCatalogueSources()
|
return sourceManager.getVisibleCatalogueSources()
|
||||||
.mapNotNull { it.getMainSource<UrlImportableSource>() }
|
.mapNotNull { it.getMainSource<UrlImportableSource>() }
|
||||||
.filter {
|
.filter {
|
||||||
it.lang in filters.first && it.id !in filters.second && try {
|
it.lang in filters.enabledLangs && it.id !in filters.disabledSources && try {
|
||||||
it.matchesUri(uri)
|
it.matchesUri(uri)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
false
|
false
|
||||||
@ -73,7 +78,7 @@ class GalleryAdder(
|
|||||||
sourceManager.getVisibleCatalogueSources()
|
sourceManager.getVisibleCatalogueSources()
|
||||||
.mapNotNull { it.getMainSource<UrlImportableSource>() }
|
.mapNotNull { it.getMainSource<UrlImportableSource>() }
|
||||||
.find {
|
.find {
|
||||||
it.lang in filters.first && it.id !in filters.second && try {
|
it.lang in filters.enabledLangs && it.id !in filters.disabledSources && try {
|
||||||
it.matchesUri(uri)
|
it.matchesUri(uri)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
false
|
false
|
||||||
|
@ -42,6 +42,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import eu.kanade.core.prefs.PreferenceMutableState
|
import eu.kanade.core.prefs.PreferenceMutableState
|
||||||
import eu.kanade.presentation.components.Divider
|
import eu.kanade.presentation.components.Divider
|
||||||
import eu.kanade.presentation.components.LazyColumn
|
import eu.kanade.presentation.components.LazyColumn
|
||||||
|
import eu.kanade.presentation.components.LoadingScreen
|
||||||
import eu.kanade.presentation.components.PreferenceRow
|
import eu.kanade.presentation.components.PreferenceRow
|
||||||
import eu.kanade.presentation.components.SwitchPreference
|
import eu.kanade.presentation.components.SwitchPreference
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.BasicComposeController
|
import eu.kanade.tachiyomi.ui.base.controller.BasicComposeController
|
||||||
@ -80,7 +81,11 @@ class SettingsDebugController : BasicComposeController() {
|
|||||||
DebugToggles.values().map { DebugToggle(it.name, it.asPref(viewScope), it.default) }
|
DebugToggles.values().map { DebugToggle(it.name, it.asPref(viewScope), it.default) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (functions != null) {
|
if (functions == null) {
|
||||||
|
LoadingScreen()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
Box(
|
Box(
|
||||||
Modifier
|
Modifier
|
||||||
@ -167,14 +172,9 @@ class SettingsDebugController : BasicComposeController() {
|
|||||||
|
|
||||||
ResultTextDialog(
|
ResultTextDialog(
|
||||||
result = result,
|
result = result,
|
||||||
onDismissRequest = { result = null }
|
onDismissRequest = { result = null },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
|
||||||
CircularProgressIndicator()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -3,11 +3,11 @@ package exh.ui.batchadd
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
|
||||||
import eu.kanade.tachiyomi.util.lang.withIOContext
|
import eu.kanade.tachiyomi.util.lang.withIOContext
|
||||||
import exh.GalleryAddEvent
|
import exh.GalleryAddEvent
|
||||||
import exh.GalleryAdder
|
import exh.GalleryAdder
|
||||||
import exh.log.xLogE
|
import exh.log.xLogE
|
||||||
|
import exh.ui.base.CoroutinePresenter
|
||||||
import exh.util.trimOrNull
|
import exh.util.trimOrNull
|
||||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -17,7 +17,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
class BatchAddPresenter : BasePresenter<BatchAddController>() {
|
class BatchAddPresenter : CoroutinePresenter<BatchAddController>() {
|
||||||
private val preferences: PreferencesHelper by injectLazy()
|
private val preferences: PreferencesHelper by injectLazy()
|
||||||
|
|
||||||
private val galleryAdder by lazy { GalleryAdder() }
|
private val galleryAdder by lazy { GalleryAdder() }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user