mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Move isLocal extension functions to LocalSource
This commit is contained in:
		| @@ -8,7 +8,7 @@ import tachiyomi.domain.source.model.Pin | ||||
| import tachiyomi.domain.source.model.Pins | ||||
| import tachiyomi.domain.source.model.Source | ||||
| import tachiyomi.domain.source.repository.SourceRepository | ||||
| import tachiyomi.source.local.LocalSource | ||||
| import tachiyomi.source.local.isLocal | ||||
|  | ||||
| class GetEnabledSources( | ||||
|     private val repository: SourceRepository, | ||||
| @@ -24,7 +24,7 @@ class GetEnabledSources( | ||||
|             repository.getSources(), | ||||
|         ) { pinnedSourceIds, enabledLanguages, disabledSources, lastUsedSource, sources -> | ||||
|             sources | ||||
|                 .filter { it.lang in enabledLanguages || it.id == LocalSource.ID } | ||||
|                 .filter { it.lang in enabledLanguages || it.isLocal() } | ||||
|                 .filterNot { it.id.toString() in disabledSources } | ||||
|                 .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name }) | ||||
|                 .flatMap { | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import kotlinx.coroutines.flow.Flow | ||||
| import kotlinx.coroutines.flow.combine | ||||
| import tachiyomi.domain.source.model.Source | ||||
| import tachiyomi.domain.source.repository.SourceRepository | ||||
| import tachiyomi.source.local.LocalSource | ||||
| import tachiyomi.source.local.isLocal | ||||
| import java.text.Collator | ||||
| import java.util.Collections | ||||
| import java.util.Locale | ||||
| @@ -22,7 +22,7 @@ class GetSourcesWithFavoriteCount( | ||||
|             repository.getSourcesWithFavoriteCount(), | ||||
|         ) { direction, mode, list -> | ||||
|             list | ||||
|                 .filterNot { it.first.id == LocalSource.ID } | ||||
|                 .filterNot { it.first.isLocal() } | ||||
|                 .sortedWith(sortFn(direction, mode)) | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -35,7 +35,7 @@ import tachiyomi.presentation.core.screens.EmptyScreen | ||||
| import tachiyomi.presentation.core.screens.LoadingScreen | ||||
| import tachiyomi.presentation.core.theme.header | ||||
| import tachiyomi.presentation.core.util.plus | ||||
| import tachiyomi.source.local.LocalSource | ||||
| import tachiyomi.source.local.isLocal | ||||
|  | ||||
| @Composable | ||||
| fun SourcesScreen( | ||||
| @@ -175,7 +175,7 @@ fun SourceOptionsDialog( | ||||
|                         .fillMaxWidth() | ||||
|                         .padding(vertical = 16.dp), | ||||
|                 ) | ||||
|                 if (source.id != LocalSource.ID) { | ||||
|                 if (source.isLocal()) { | ||||
|                     Text( | ||||
|                         text = stringResource(R.string.action_disable), | ||||
|                         modifier = Modifier | ||||
|   | ||||
| @@ -33,7 +33,7 @@ import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.extension.model.Extension | ||||
| import tachiyomi.core.util.lang.withIOContext | ||||
| import tachiyomi.domain.source.model.Source | ||||
| import tachiyomi.source.local.LocalSource | ||||
| import tachiyomi.source.local.isLocal | ||||
|  | ||||
| private val defaultModifier = Modifier | ||||
|     .height(40.dp) | ||||
| @@ -62,7 +62,7 @@ fun SourceIcon( | ||||
|                 modifier = modifier.then(defaultModifier), | ||||
|             ) | ||||
|         } | ||||
|         source.id == LocalSource.ID -> { | ||||
|         source.isLocal() -> { | ||||
|             Image( | ||||
|                 painter = painterResource(R.mipmap.ic_local_source), | ||||
|                 contentDescription = null, | ||||
|   | ||||
| @@ -28,6 +28,7 @@ class AndroidSourceManager( | ||||
|     private val extensionManager: ExtensionManager, | ||||
|     private val sourceRepository: SourceDataRepository, | ||||
| ) : SourceManager { | ||||
|  | ||||
|     private val downloadManager: DownloadManager by injectLazy() | ||||
|  | ||||
|     private val scope = CoroutineScope(Job() + Dispatchers.IO) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user