mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-25 10:28:23 +01:00
Minor cleanup
This commit is contained in:
parent
d65f9c2916
commit
0f21d16263
@ -40,7 +40,6 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.ui.category.CategoryScreen
|
||||
import eu.kanade.tachiyomi.util.system.isDevFlavor
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import tachiyomi.domain.category.interactor.GetCategories
|
||||
@ -258,10 +257,10 @@ object SettingsLibraryScreen : SearchableSettings {
|
||||
pluralStringResource(R.plurals.pref_update_release_following_days, followRange, followRange),
|
||||
).joinToString(),
|
||||
onClick = { showFetchRangesDialog = true },
|
||||
).takeIf { MANGA_OUTSIDE_RELEASE_PERIOD in libraryUpdateMangaRestriction && isDevFlavor },
|
||||
).takeIf { MANGA_OUTSIDE_RELEASE_PERIOD in libraryUpdateMangaRestriction },
|
||||
Preference.PreferenceItem.InfoPreference(
|
||||
title = stringResource(R.string.pref_update_release_grace_period_info),
|
||||
).takeIf { MANGA_OUTSIDE_RELEASE_PERIOD in libraryUpdateMangaRestriction && isDevFlavor },
|
||||
).takeIf { MANGA_OUTSIDE_RELEASE_PERIOD in libraryUpdateMangaRestriction },
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
pref = libraryPreferences.newShowUpdatesCount(),
|
||||
title = stringResource(R.string.pref_library_update_show_tab_badge),
|
||||
|
@ -238,10 +238,10 @@ class ExtensionManager(
|
||||
/**
|
||||
* Uninstalls the extension that matches the given package name.
|
||||
*
|
||||
* @param pkgName The package name of the application to uninstall.
|
||||
* @param extension The extension to uninstall.
|
||||
*/
|
||||
fun uninstallExtension(pkgName: String) {
|
||||
installer.uninstallApk(pkgName)
|
||||
fun uninstallExtension(extension: Extension) {
|
||||
installer.uninstallApk(extension.pkgName)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -260,18 +260,13 @@ class ExtensionManager(
|
||||
val nowTrustedExtensions = _untrustedExtensionsFlow.value.filter { it.signatureHash == signature }
|
||||
_untrustedExtensionsFlow.value -= nowTrustedExtensions
|
||||
|
||||
val ctx = context
|
||||
launchNow {
|
||||
nowTrustedExtensions
|
||||
.map { extension ->
|
||||
async { ExtensionLoader.loadExtensionFromPkgName(ctx, extension.pkgName) }
|
||||
}
|
||||
.map { it.await() }
|
||||
.forEach { result ->
|
||||
if (result is LoadResult.Success) {
|
||||
registerNewExtension(result.extension)
|
||||
}
|
||||
async { ExtensionLoader.loadExtensionFromPkgName(context, extension.pkgName) }.await()
|
||||
}
|
||||
.filterIsInstance<LoadResult.Success>()
|
||||
.forEach { registerNewExtension(it.extension) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,8 +171,8 @@ class ExtensionsScreenModel(
|
||||
.onCompletion { removeDownloadState(extension) }
|
||||
.collect()
|
||||
|
||||
fun uninstallExtension(pkgName: String) {
|
||||
extensionManager.uninstallExtension(pkgName)
|
||||
fun uninstallExtension(extension: Extension) {
|
||||
extensionManager.uninstallExtension(extension)
|
||||
}
|
||||
|
||||
fun findAvailableExtensions() {
|
||||
|
@ -41,7 +41,7 @@ fun extensionsTab(
|
||||
onLongClickItem = { extension ->
|
||||
when (extension) {
|
||||
is Extension.Available -> extensionsScreenModel.installExtension(extension)
|
||||
else -> extensionsScreenModel.uninstallExtension(extension.pkgName)
|
||||
else -> extensionsScreenModel.uninstallExtension(extension)
|
||||
}
|
||||
},
|
||||
onClickItemCancel = extensionsScreenModel::cancelInstallUpdateExtension,
|
||||
@ -49,7 +49,7 @@ fun extensionsTab(
|
||||
onInstallExtension = extensionsScreenModel::installExtension,
|
||||
onOpenExtension = { navigator.push(ExtensionDetailsScreen(it.pkgName)) },
|
||||
onTrustExtension = { extensionsScreenModel.trustSignature(it.signatureHash) },
|
||||
onUninstallExtension = { extensionsScreenModel.uninstallExtension(it.pkgName) },
|
||||
onUninstallExtension = { extensionsScreenModel.uninstallExtension(it) },
|
||||
onUpdateExtension = extensionsScreenModel::updateExtension,
|
||||
onRefresh = extensionsScreenModel::findAvailableExtensions,
|
||||
)
|
||||
|
@ -132,7 +132,7 @@ class ExtensionDetailsScreenModel(
|
||||
|
||||
fun uninstallExtension() {
|
||||
val extension = state.value.extension ?: return
|
||||
extensionManager.uninstallExtension(extension.pkgName)
|
||||
extensionManager.uninstallExtension(extension)
|
||||
}
|
||||
|
||||
fun toggleSource(sourceId: Long) {
|
||||
|
Loading…
Reference in New Issue
Block a user