From b7b641105d1321483ca6274f3b8dc0b422dcb7fe Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Tue, 2 Jul 2024 00:06:25 -0300 Subject: [PATCH] detekt: Supress Warnings --- .../java/eu/kanade/tachiyomi/data/download/DownloadManager.kt | 2 ++ .../main/java/eu/kanade/tachiyomi/data/download/Downloader.kt | 3 +++ .../eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt | 2 ++ .../kanade/tachiyomi/data/notification/NotificationReceiver.kt | 2 ++ .../java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt | 2 +- .../tachiyomi/extension/util/ExtensionInstallActivity.kt | 2 +- app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 3 +++ .../eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt | 2 ++ .../tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt | 1 + 9 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index 01a342859d..fdc844e845 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -4,6 +4,7 @@ import android.content.Context import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.model.Page +import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.drop @@ -32,6 +33,7 @@ import uy.kohesive.injekt.api.get * and retrieved through dependency injection. You can use this class to queue new chapters or query * downloaded chapters. */ +@DelicateCoroutinesApi class DownloadManager( private val context: Context, private val provider: DownloadProvider = Injekt.get(), diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index ebf9df65ef..308d7450dd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -16,6 +16,7 @@ import eu.kanade.tachiyomi.util.storage.DiskUtil.NOMEDIA_FILE import eu.kanade.tachiyomi.util.storage.saveTo import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob @@ -67,6 +68,7 @@ import java.util.Locale * * Its queue contains the list of chapters to download. */ +@DelicateCoroutinesApi class Downloader( private val context: Context, private val provider: DownloadProvider, @@ -111,6 +113,7 @@ class Downloader( var isPaused: Boolean = false init { + @Suppress("OPT_IN_USAGE") launchNow { val chapters = async { store.restore() } addAllToQueue(chapters.await()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt index f7d6c5dbc0..f0be940749 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt @@ -28,6 +28,7 @@ import eu.kanade.tachiyomi.util.system.cancelNotification import eu.kanade.tachiyomi.util.system.getBitmapOrNull import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notify +import kotlinx.coroutines.DelicateCoroutinesApi import tachiyomi.core.common.Constants import tachiyomi.core.common.i18n.pluralStringResource import tachiyomi.core.common.i18n.stringResource @@ -42,6 +43,7 @@ import uy.kohesive.injekt.api.get import java.math.RoundingMode import java.text.NumberFormat +@DelicateCoroutinesApi class LibraryUpdateNotifier( private val context: Context, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt index de9e55803d..894fad1773 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationReceiver.kt @@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.util.system.getParcelableExtraCompat import eu.kanade.tachiyomi.util.system.notificationManager import eu.kanade.tachiyomi.util.system.toShareIntent import eu.kanade.tachiyomi.util.system.toast +import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.runBlocking import tachiyomi.core.common.Constants import tachiyomi.core.common.util.lang.launchIO @@ -39,6 +40,7 @@ import eu.kanade.tachiyomi.BuildConfig.APPLICATION_ID as ID * Pending Broadcasts should be made from here. * NOTE: Use local broadcasts if possible. */ +@DelicateCoroutinesApi class NotificationReceiver : BroadcastReceiver() { private val getManga: GetManga by injectLazy() diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt index b8e7d2acc0..d6f555068e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt @@ -77,7 +77,7 @@ class Bangumi(id: Long) : BaseTracker(id, "Bangumi") { override suspend fun refresh(track: Track): Track { val remoteStatusTrack = api.statusLibManga(track) track.copyPersonalFrom(remoteStatusTrack!!) - api.findLibManga(track)?.let { remoteTrack -> + api.findLibManga(track).let { remoteTrack -> track.total_chapters = remoteTrack.total_chapters } return track diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallActivity.kt index 37ac84e44c..4bc4afb764 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallActivity.kt @@ -25,7 +25,7 @@ class ExtensionInstallActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val installIntent = Intent(Intent.ACTION_INSTALL_PACKAGE) + @Suppress("DEPRECATION") val installIntent = Intent(Intent.ACTION_INSTALL_PACKAGE) .setDataAndType(intent.data, intent.type) .putExtra(Intent.EXTRA_RETURN_RESULT, true) .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index dd0f391c37..97aec6f913 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -77,6 +77,7 @@ import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.isNavigationBarNeedsScrim import eu.kanade.tachiyomi.util.system.openInBrowser import eu.kanade.tachiyomi.util.view.setComposeContent +import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.callbackFlow import kotlinx.coroutines.flow.collectLatest @@ -99,6 +100,7 @@ import tachiyomi.presentation.core.util.collectAsState import uy.kohesive.injekt.injectLazy import androidx.compose.ui.graphics.Color.Companion as ComposeColor +@DelicateCoroutinesApi class MainActivity : BaseActivity() { private val libraryPreferences: LibraryPreferences by injectLazy() @@ -142,6 +144,7 @@ class MainActivity : BaseActivity() { val indexing by downloadCache.isInitializing.collectAsState() // Set status bar color considering the top app state banner + @Suppress("DEPRECATION") val systemUiController = rememberSystemUiController() val isSystemInDarkTheme = isSystemInDarkTheme() val statusBarBackgroundColor = when { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt index 14c27bf957..04118b6243 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt @@ -8,6 +8,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import eu.kanade.tachiyomi.ui.reader.model.ReaderPage import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.cancel @@ -26,6 +27,7 @@ import kotlin.math.min /** * Loader used to load chapters from an online source. */ +@DelicateCoroutinesApi internal class HttpPageLoader( private val chapter: ReaderChapter, private val source: HttpSource, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt index 852cd76e12..336539a602 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonLayoutManager.kt @@ -27,6 +27,7 @@ class WebtoonLayoutManager(context: Context) : LinearLayoutManager(context) { /** * Returns the custom extra layout space. */ + @Deprecated("Deprecated in Java") override fun getExtraLayoutSpace(state: RecyclerView.State): Int { return extraLayoutSpace }