Reduce build warnings

This commit is contained in:
Jobobby04 2024-03-28 17:18:38 -04:00
parent 5455daf96b
commit a657c65261
16 changed files with 33 additions and 20 deletions

View File

@ -70,7 +70,7 @@ fun FeedScreen(
onClickDelete: (FeedSavedSearch) -> Unit, onClickDelete: (FeedSavedSearch) -> Unit,
onClickManga: (Manga) -> Unit, onClickManga: (Manga) -> Unit,
onRefresh: () -> Unit, onRefresh: () -> Unit,
getMangaState: @Composable (Manga, CatalogueSource?) -> State<Manga>, getMangaState: @Composable (Manga) -> State<Manga>,
) { ) {
when { when {
state.isLoading -> LoadingScreen() state.isLoading -> LoadingScreen()
@ -119,7 +119,7 @@ fun FeedScreen(
) { ) {
FeedItem( FeedItem(
item = item, item = item,
getMangaState = { getMangaState(it, item.source) }, getMangaState = { getMangaState(it) },
onClickManga = onClickManga, onClickManga = onClickManga,
) )
} }

View File

@ -109,8 +109,6 @@ class MergedSource : HttpSource() {
suspend fun fetchChaptersForMergedManga( suspend fun fetchChaptersForMergedManga(
manga: Manga, manga: Manga,
downloadChapters: Boolean = true, downloadChapters: Boolean = true,
editScanlators: Boolean = false,
dedupe: Boolean = true,
) { ) {
fetchChaptersAndSync(manga, downloadChapters) fetchChaptersAndSync(manga, downloadChapters)
} }

View File

@ -280,7 +280,7 @@ open class FeedScreenModel(
} }
@Composable @Composable
fun getManga(initialManga: DomainManga, source: CatalogueSource?): State<DomainManga> { fun getManga(initialManga: DomainManga): State<DomainManga> {
return produceState(initialValue = initialManga) { return produceState(initialValue = initialManga) {
getManga.subscribe(initialManga.url, initialManga.source) getManga.subscribe(initialManga.url, initialManga.source)
.collectLatest { manga -> .collectLatest { manga ->

View File

@ -87,7 +87,7 @@ fun Screen.feedTab(): TabContent {
navigator.push(MangaScreen(manga.id, true)) navigator.push(MangaScreen(manga.id, true))
}, },
onRefresh = screenModel::init, onRefresh = screenModel::init,
getMangaState = { manga, source -> screenModel.getManga(initialManga = manga, source = source) }, getMangaState = { manga -> screenModel.getManga(initialManga = manga) },
) )
state.dialog?.let { dialog -> state.dialog?.let { dialog ->

View File

@ -121,7 +121,7 @@ class MigrationListScreen(private val config: MigrationProcedureConfig) : Screen
) )
val onDismissRequest = { screenModel.dialog.value = null } val onDismissRequest = { screenModel.dialog.value = null }
when (val dialog = dialog) { when (@Suppress("NAME_SHADOWING") val dialog = dialog) {
is MigrationListScreenModel.Dialog.MigrateMangaDialog -> { is MigrationListScreenModel.Dialog.MigrateMangaDialog -> {
MigrationMangaDialog( MigrationMangaDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,

View File

@ -109,7 +109,7 @@ data class SourceSearchScreen(
} }
val onDismissRequest = { screenModel.setDialog(null) } val onDismissRequest = { screenModel.setDialog(null) }
when (val dialog = state.dialog) { when (state.dialog) {
is BrowseSourceScreenModel.Dialog.Filter -> { is BrowseSourceScreenModel.Dialog.Filter -> {
SourceFilterDialog( SourceFilterDialog(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,

View File

@ -16,6 +16,7 @@ import eu.kanade.presentation.components.TabContent
import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationScreen import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationScreen
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaScreen import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaScreen
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.DelicateCoroutinesApi
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.core.common.util.lang.withUIContext import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.domain.UnsortedPreferences import tachiyomi.domain.UnsortedPreferences
@ -55,6 +56,7 @@ fun Screen.migrateSourceTab(): TabContent {
// SY --> // SY -->
onClickAll = { source -> onClickAll = { source ->
// TODO: Jay wtf, need to clean this up sometime // TODO: Jay wtf, need to clean this up sometime
@OptIn(DelicateCoroutinesApi::class)
launchIO { launchIO {
val manga = Injekt.get<GetFavorites>().await() val manga = Injekt.get<GetFavorites>().await()
val sourceMangas = val sourceMangas =

View File

@ -59,6 +59,7 @@ import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.mutate import kotlinx.collections.immutable.mutate
import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
@ -740,6 +741,7 @@ class LibraryScreenModel(
clearSelection() clearSelection()
} }
@OptIn(DelicateCoroutinesApi::class)
fun syncMangaToDex() { fun syncMangaToDex() {
launchIO { launchIO {
MdUtil.getEnabledMangaDex(unsortedPreferences, sourcePreferences, sourceManager)?.let { mdex -> MdUtil.getEnabledMangaDex(unsortedPreferences, sourcePreferences, sourceManager)?.let { mdex ->

View File

@ -66,6 +66,7 @@ fun EditMangaDialog(
confirmButton = { confirmButton = {
TextButton( TextButton(
onClick = { onClick = {
@Suppress("NAME_SHADOWING")
val binding = binding ?: return@TextButton val binding = binding ?: return@TextButton
onPositiveClick( onPositiveClick(
binding.title.text.toString(), binding.title.text.toString(),
@ -120,7 +121,7 @@ fun EditMangaDialog(
} }
private fun onViewCreated(manga: Manga, context: Context, binding: EditMangaDialogBinding, scope: CoroutineScope) { private fun onViewCreated(manga: Manga, context: Context, binding: EditMangaDialogBinding, scope: CoroutineScope) {
loadCover(manga, context, binding) loadCover(manga, binding)
val statusAdapter: ArrayAdapter<String> = ArrayAdapter( val statusAdapter: ArrayAdapter<String> = ArrayAdapter(
context, context,
@ -188,7 +189,7 @@ private fun onViewCreated(manga: Manga, context: Context, binding: EditMangaDial
binding.mangaDescription.hint = binding.mangaDescription.hint =
context.stringResource( context.stringResource(
SYMR.strings.description_hint, SYMR.strings.description_hint,
manga.ogDescription?.takeIf { it.isNotBlank() }?.let { it.replace("\n", " ").chop(20) } ?: "" manga.ogDescription?.takeIf { it.isNotBlank() }?.replace("\n", " ")?.chop(20) ?: ""
) )
binding.thumbnailUrl.hint = binding.thumbnailUrl.hint =
context.stringResource( context.stringResource(
@ -212,7 +213,7 @@ private fun resetTags(manga: Manga, binding: EditMangaDialogBinding, scope: Coro
} }
} }
private fun loadCover(manga: Manga, context: Context, binding: EditMangaDialogBinding) { private fun loadCover(manga: Manga, binding: EditMangaDialogBinding) {
binding.mangaCover.load(manga) { binding.mangaCover.load(manga) {
transformations(RoundedCornersTransformation(4.dpToPx.toFloat())) transformations(RoundedCornersTransformation(4.dpToPx.toFloat()))
} }

View File

@ -67,6 +67,7 @@ import exh.source.isMdBasedSource
import exh.ui.ifSourcesLoaded import exh.ui.ifSourcesLoaded
import exh.ui.metadata.MetadataViewScreen import exh.ui.metadata.MetadataViewScreen
import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.take
@ -514,6 +515,7 @@ class MangaScreen(
navigator.push(SourcesScreen(smartSearchConfig)) navigator.push(SourcesScreen(smartSearchConfig))
} }
@OptIn(DelicateCoroutinesApi::class)
private fun mergeWithAnother( private fun mergeWithAnother(
navigator: Navigator, navigator: Navigator,
context: Context, context: Context,

View File

@ -976,6 +976,7 @@ class MangaScreenModel(
downloadManager.getQueuedDownloadOrNull(chapter.id) downloadManager.getQueuedDownloadOrNull(chapter.id)
} }
// SY --> // SY -->
@Suppress("NAME_SHADOWING")
val manga = mergedData?.manga?.get(chapter.mangaId) ?: manga val manga = mergedData?.manga?.get(chapter.mangaId) ?: manga
val source = mergedData?.sources?.find { manga.source == it.id }?.takeIf { mergedData.sources.size > 2 } val source = mergedData?.sources?.find { manga.source == it.id }?.takeIf { mergedData.sources.size > 2 }
// SY <-- // SY <--
@ -1049,7 +1050,7 @@ class MangaScreenModel(
downloadNewChapters(newChapters) downloadNewChapters(newChapters)
} }
} else { } else {
state.source.fetchChaptersForMergedManga(state.manga, manualFetch, true, dedupe) state.source.fetchChaptersForMergedManga(state.manga, manualFetch)
} }
} }
} catch (e: Throwable) { } catch (e: Throwable) {

View File

@ -164,7 +164,7 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
return when (item) { return when (item) {
is ReaderPage -> PagerPageHolder(readerThemedContext, viewer, item, item2 as? ReaderPage) is ReaderPage -> PagerPageHolder(readerThemedContext, viewer, item, item2 as? ReaderPage)
is ChapterTransition -> PagerTransitionHolder(readerThemedContext, viewer, item) is ChapterTransition -> PagerTransitionHolder(readerThemedContext, viewer, item)
else -> throw NotImplementedError("Holder for ${item.javaClass} not implemented") // SY --> else -> throw NotImplementedError("Holder for ${item.javaClass} not implemented") SY <--
} }
} }

View File

@ -2,6 +2,7 @@ package exh.favorites
import android.content.Context import android.content.Context
import android.net.wifi.WifiManager import android.net.wifi.WifiManager
import android.os.Build
import android.os.PowerManager import android.os.PowerManager
import eu.kanade.domain.manga.interactor.UpdateManga import eu.kanade.domain.manga.interactor.UpdateManga
import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.POST
@ -136,10 +137,18 @@ class FavoritesSyncHelper(val context: Context) {
} }
ignore { wifiLock?.release() } ignore { wifiLock?.release() }
wifiLock = ignore { wifiLock = ignore {
context.wifiManager.createWifiLock( if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
WifiManager.WIFI_MODE_FULL_HIGH_PERF, context.wifiManager.createWifiLock(
"teh:ExhFavoritesSyncWifi", WifiManager.WIFI_MODE_FULL_LOW_LATENCY,
) "teh:ExhFavoritesSyncWifi",
)
} else {
@Suppress("DEPRECATION")
context.wifiManager.createWifiLock(
WifiManager.WIFI_MODE_FULL_HIGH_PERF,
"teh:ExhFavoritesSyncWifi",
)
}
} }
// Do not update galleries while syncing favorites // Do not update galleries while syncing favorites

View File

@ -32,7 +32,6 @@ class MangaDexSimilarScreen(val mangaId: Long, val sourceId: Long) : Screen() {
} }
val screenModel = rememberScreenModel { MangaDexSimilarScreenModel(mangaId, sourceId) } val screenModel = rememberScreenModel { MangaDexSimilarScreenModel(mangaId, sourceId) }
val state by screenModel.state.collectAsState()
val navigator = LocalNavigator.currentOrThrow val navigator = LocalNavigator.currentOrThrow
val onMangaClick: (Manga) -> Unit = { val onMangaClick: (Manga) -> Unit = {

View File

@ -31,7 +31,6 @@ class RecommendsScreen(val mangaId: Long, val sourceId: Long) : Screen() {
} }
val screenModel = rememberScreenModel { RecommendsScreenModel(mangaId, sourceId) } val screenModel = rememberScreenModel { RecommendsScreenModel(mangaId, sourceId) }
val state by screenModel.state.collectAsState()
val navigator = LocalNavigator.currentOrThrow val navigator = LocalNavigator.currentOrThrow
val onMangaClick: (Manga) -> Unit = { manga -> val onMangaClick: (Manga) -> Unit = { manga ->

View File

@ -50,7 +50,7 @@ class MetadataViewScreen(private val mangaId: Long, private val sourceId: Long)
) )
}, },
) { paddingValues -> ) { paddingValues ->
when (val state = state) { when (@Suppress("NAME_SHADOWING") val state = state) {
MetadataViewState.Loading -> LoadingScreen() MetadataViewState.Loading -> LoadingScreen()
MetadataViewState.MetadataNotFound -> EmptyScreen(MR.strings.no_results_found) MetadataViewState.MetadataNotFound -> EmptyScreen(MR.strings.no_results_found)
MetadataViewState.SourceNotFound -> EmptyScreen(MR.strings.source_empty_screen) MetadataViewState.SourceNotFound -> EmptyScreen(MR.strings.source_empty_screen)