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

View File

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

View File

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

View File

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

View File

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

View File

@ -109,7 +109,7 @@ data class SourceSearchScreen(
}
val onDismissRequest = { screenModel.setDialog(null) }
when (val dialog = state.dialog) {
when (state.dialog) {
is BrowseSourceScreenModel.Dialog.Filter -> {
SourceFilterDialog(
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.manga.MigrateMangaScreen
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.DelicateCoroutinesApi
import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.core.common.util.lang.withUIContext
import tachiyomi.domain.UnsortedPreferences
@ -55,6 +56,7 @@ fun Screen.migrateSourceTab(): TabContent {
// SY -->
onClickAll = { source ->
// TODO: Jay wtf, need to clean this up sometime
@OptIn(DelicateCoroutinesApi::class)
launchIO {
val manga = Injekt.get<GetFavorites>().await()
val sourceMangas =

View File

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

View File

@ -66,6 +66,7 @@ fun EditMangaDialog(
confirmButton = {
TextButton(
onClick = {
@Suppress("NAME_SHADOWING")
val binding = binding ?: return@TextButton
onPositiveClick(
binding.title.text.toString(),
@ -120,7 +121,7 @@ fun EditMangaDialog(
}
private fun onViewCreated(manga: Manga, context: Context, binding: EditMangaDialogBinding, scope: CoroutineScope) {
loadCover(manga, context, binding)
loadCover(manga, binding)
val statusAdapter: ArrayAdapter<String> = ArrayAdapter(
context,
@ -188,7 +189,7 @@ private fun onViewCreated(manga: Manga, context: Context, binding: EditMangaDial
binding.mangaDescription.hint =
context.stringResource(
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 =
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) {
transformations(RoundedCornersTransformation(4.dpToPx.toFloat()))
}

View File

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

View File

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

View File

@ -164,7 +164,7 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
return when (item) {
is ReaderPage -> PagerPageHolder(readerThemedContext, viewer, item, item2 as? ReaderPage)
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.net.wifi.WifiManager
import android.os.Build
import android.os.PowerManager
import eu.kanade.domain.manga.interactor.UpdateManga
import eu.kanade.tachiyomi.network.POST
@ -136,10 +137,18 @@ class FavoritesSyncHelper(val context: Context) {
}
ignore { wifiLock?.release() }
wifiLock = ignore {
context.wifiManager.createWifiLock(
WifiManager.WIFI_MODE_FULL_HIGH_PERF,
"teh:ExhFavoritesSyncWifi",
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
context.wifiManager.createWifiLock(
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

View File

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

View File

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