Address various redundant constructs

This commit is contained in:
AntsyLich
2026-06-13 23:36:28 +06:00
parent 4b9974e20a
commit 6ae79d255d
30 changed files with 56 additions and 92 deletions
@@ -87,7 +87,6 @@ object SettingsTrackingScreen : SearchableSettings {
val trackPreferences = remember { Injekt.get<TrackPreferences>() } val trackPreferences = remember { Injekt.get<TrackPreferences>() }
val trackerManager = remember { Injekt.get<TrackerManager>() } val trackerManager = remember { Injekt.get<TrackerManager>() }
val sourceManager = remember { Injekt.get<SourceManager>() } val sourceManager = remember { Injekt.get<SourceManager>() }
val autoTrackStatePref = trackPreferences.autoUpdateTrackOnMarkRead
var dialog by remember { mutableStateOf<Any?>(null) } var dialog by remember { mutableStateOf<Any?>(null) }
dialog?.run { dialog?.run {
@@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.data.backup.restore.restorers package eu.kanade.tachiyomi.data.backup.restore.restorers
import app.cash.sqldelight.async.coroutines.awaitAsOne
import eu.kanade.tachiyomi.data.backup.models.BackupCategory import eu.kanade.tachiyomi.data.backup.models.BackupCategory
import tachiyomi.data.Database import tachiyomi.data.Database
import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.GetCategories
@@ -26,7 +26,6 @@ import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.flow.shareIn import kotlinx.coroutines.flow.shareIn
import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withTimeoutOrNull import kotlinx.coroutines.withTimeoutOrNull
@@ -54,7 +53,6 @@ import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.io.File import java.io.File
import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds import kotlin.time.Duration.Companion.seconds
/** /**
@@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.download
import android.content.Context import android.content.Context
import androidx.core.content.edit import androidx.core.content.edit
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
@@ -6,7 +6,6 @@ import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import tachiyomi.domain.chapter.interactor.GetChapter import tachiyomi.domain.chapter.interactor.GetChapter
import tachiyomi.domain.manga.interactor.GetManga import tachiyomi.domain.manga.interactor.GetManga
@@ -18,7 +18,6 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
@@ -33,7 +33,6 @@ import kotlinx.coroutines.launch
import tachiyomi.core.common.Constants import tachiyomi.core.common.Constants
import tachiyomi.core.common.i18n.pluralStringResource import tachiyomi.core.common.i18n.pluralStringResource
import tachiyomi.core.common.i18n.stringResource import tachiyomi.core.common.i18n.stringResource
import tachiyomi.core.common.util.lang.launchUI
import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.library.model.LibraryManga import tachiyomi.domain.library.model.LibraryManga
import tachiyomi.domain.manga.model.Manga import tachiyomi.domain.manga.model.Manga
@@ -6,8 +6,6 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.lifecycle.lifecycleScope
import eu.kanade.tachiyomi.data.backup.restore.BackupRestoreJob import eu.kanade.tachiyomi.data.backup.restore.BackupRestoreJob
import eu.kanade.tachiyomi.data.download.DownloadManager import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
@@ -25,7 +23,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import tachiyomi.core.common.Constants import tachiyomi.core.common.Constants
import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.domain.chapter.interactor.GetChapter import tachiyomi.domain.chapter.interactor.GetChapter
import tachiyomi.domain.chapter.interactor.UpdateChapter import tachiyomi.domain.chapter.interactor.UpdateChapter
import tachiyomi.domain.chapter.model.Chapter import tachiyomi.domain.chapter.model.Chapter
@@ -20,6 +20,6 @@ object KitsuDateHelper {
val dateValue = formatter.parse(dateString) val dateValue = formatter.parse(dateString)
return dateValue?.time ?: return 0 return dateValue?.time ?: 0
} }
} }
@@ -6,7 +6,6 @@ import eu.kanade.tachiyomi.data.track.model.TrackSearch
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.awaitSuccess import eu.kanade.tachiyomi.network.awaitSuccess
import eu.kanade.tachiyomi.network.parseAs import eu.kanade.tachiyomi.network.parseAs
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import logcat.LogPriority import logcat.LogPriority
import okhttp3.Headers import okhttp3.Headers
@@ -106,7 +106,7 @@ class MangaUpdates(id: Long) : BaseTracker(id, "MangaUpdates"), DeletableTracker
} }
override suspend fun login(username: String, password: String) { override suspend fun login(username: String, password: String) {
val authenticated = api.authenticate(username, password) ?: throw Throwable("Unable to login") val authenticated = api.authenticate(username, password)
saveCredentials(authenticated.uid.toString(), authenticated.sessionToken) saveCredentials(authenticated.uid.toString(), authenticated.sessionToken)
interceptor.newAuth(authenticated.sessionToken) interceptor.newAuth(authenticated.sessionToken)
} }
@@ -172,7 +172,7 @@ class MangaUpdatesApi(
} }
} }
suspend fun authenticate(username: String, password: String): MUContext? { suspend fun authenticate(username: String, password: String): MUContext {
val body = buildJsonObject { val body = buildJsonObject {
put("username", username) put("username", username)
put("password", password) put("password", password)
@@ -20,10 +20,7 @@ import okhttp3.OkHttpClient
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
import tachiyomi.core.common.util.lang.withIOContext import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.domain.source.service.SourceManager import tachiyomi.domain.source.service.SourceManager
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
import java.nio.charset.Charset
import java.security.MessageDigest import java.security.MessageDigest
class SuwayomiApi(private val trackId: Long) { class SuwayomiApi(private val trackId: Long) {
@@ -37,7 +34,7 @@ class SuwayomiApi(private val trackId: Long) {
private val baseUrl: String by lazy { source.baseUrl.trimEnd('/') } private val baseUrl: String by lazy { source.baseUrl.trimEnd('/') }
private val apiUrl: String by lazy { "$baseUrl/api/graphql" } private val apiUrl: String by lazy { "$baseUrl/api/graphql" }
public fun sourcePreferences(): SharedPreferences = configurableSource.sourcePreferences() fun sourcePreferences(): SharedPreferences = configurableSource.sourcePreferences()
suspend fun getTrackSearch(mangaId: Long): TrackSearch = withIOContext { suspend fun getTrackSearch(mangaId: Long): TrackSearch = withIOContext {
val query = $$""" val query = $$"""
@@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.data.track.suwayomi
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
public enum class MangaStatus( enum class MangaStatus(
public val rawValue: String, val rawValue: String,
) { ) {
UNKNOWN("UNKNOWN"), UNKNOWN("UNKNOWN"),
ONGOING("ONGOING"), ONGOING("ONGOING"),
@@ -16,75 +16,73 @@ public enum class MangaStatus(
} }
@Serializable @Serializable
public data class MangaFragment( data class MangaFragment(
public val artist: String?, val artist: String?,
public val author: String?, val author: String?,
public val description: String?, val description: String?,
public val id: Int, val id: Int,
public val status: MangaStatus, val status: MangaStatus,
public val thumbnailUrl: String?, val thumbnailUrl: String?,
public val title: String, val title: String,
public val url: String, val url: String,
public val genre: List<String>, val genre: List<String>,
public val inLibraryAt: Long, val inLibraryAt: Long,
public val chapters: Chapters, val chapters: Chapters,
public val latestUploadedChapter: LatestUploadedChapter?, val latestUploadedChapter: LatestUploadedChapter?,
public val latestFetchedChapter: LatestFetchedChapter?, val latestFetchedChapter: LatestFetchedChapter?,
public val latestReadChapter: LatestReadChapter?, val latestReadChapter: LatestReadChapter?,
public val unreadCount: Int, val unreadCount: Int,
public val downloadCount: Int, val downloadCount: Int,
) { ) {
@Serializable @Serializable
public data class Chapters( data class Chapters(
public val totalCount: Int, val totalCount: Int,
) )
@Serializable @Serializable
public data class LatestUploadedChapter( data class LatestUploadedChapter(
public val uploadDate: Long, val uploadDate: Long,
) )
@Serializable @Serializable
public data class LatestFetchedChapter( data class LatestFetchedChapter(
public val fetchedAt: Long, val fetchedAt: Long,
) )
@Serializable @Serializable
public data class LatestReadChapter( data class LatestReadChapter(
public val lastReadAt: Long, val lastReadAt: Long,
public val chapterNumber: Double, val chapterNumber: Double,
) )
} }
@Serializable @Serializable
public data class GetMangaResult( data class GetMangaResult(
public val data: GetMangaData, val data: GetMangaData,
) )
@Serializable @Serializable
public data class GetMangaData( data class GetMangaData(
@SerialName("manga") @SerialName("manga") val entry: MangaFragment,
public val entry: MangaFragment,
) )
@Serializable @Serializable
public data class GetMangaUnreadChaptersEntry( data class GetMangaUnreadChaptersEntry(
public val nodes: List<GetMangaUnreadChaptersNode>, val nodes: List<GetMangaUnreadChaptersNode>,
) )
@Serializable @Serializable
public data class GetMangaUnreadChaptersNode( data class GetMangaUnreadChaptersNode(
public val id: Int, val id: Int,
public val chapterNumber: Double, val chapterNumber: Double,
) )
@Serializable @Serializable
public data class GetMangaUnreadChaptersResult( data class GetMangaUnreadChaptersResult(
public val data: GetMangaUnreadChaptersData, val data: GetMangaUnreadChaptersData,
) )
@Serializable @Serializable
public data class GetMangaUnreadChaptersData( data class GetMangaUnreadChaptersData(
@SerialName("chapters") @SerialName("chapters") val entry: GetMangaUnreadChaptersEntry,
public val entry: GetMangaUnreadChaptersEntry,
) )
@@ -14,7 +14,6 @@ import eu.kanade.tachiyomi.extension.util.ExtensionInstaller
import eu.kanade.tachiyomi.extension.util.ExtensionLoader import eu.kanade.tachiyomi.extension.util.ExtensionLoader
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.SharingStarted
@@ -106,7 +106,7 @@ internal class ExtensionInstallReceiver(private val listener: Listener) : Broadc
* Returns the package name of the installed, updated or removed application. * Returns the package name of the installed, updated or removed application.
*/ */
private fun getPackageNameFromIntent(intent: Intent?): String? { private fun getPackageNameFromIntent(intent: Intent?): String? {
return intent?.data?.encodedSchemeSpecificPart ?: return null return intent?.data?.encodedSchemeSpecificPart
} }
/** /**
@@ -12,13 +12,11 @@ import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.isPackageInstalled import eu.kanade.tachiyomi.util.system.isPackageInstalled
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.onCompletion import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.launch
import logcat.LogPriority import logcat.LogPriority
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
@@ -5,15 +5,12 @@ import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.extension.ExtensionManager import eu.kanade.tachiyomi.extension.ExtensionManager
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import tachiyomi.core.common.util.lang.launchIO import tachiyomi.core.common.util.lang.launchIO
import tachiyomi.domain.source.model.StubSource import tachiyomi.domain.source.model.StubSource
@@ -66,7 +66,7 @@ class BrowseSourceScreenModel(
private val getManga: GetManga = Injekt.get(), private val getManga: GetManga = Injekt.get(),
private val updateManga: UpdateManga = Injekt.get(), private val updateManga: UpdateManga = Injekt.get(),
private val addTracks: AddTracks = Injekt.get(), private val addTracks: AddTracks = Injekt.get(),
private val getIncognitoState: GetIncognitoState = Injekt.get(), getIncognitoState: GetIncognitoState = Injekt.get(),
) : StateScreenModel<BrowseSourceScreenModel.State>(State(Listing.valueOf(listingQuery))) { ) : StateScreenModel<BrowseSourceScreenModel.State>(State(Listing.valueOf(listingQuery))) {
var displayMode by sourcePreferences.sourceDisplayMode.asState(screenModelScope) var displayMode by sourcePreferences.sourceDisplayMode.asState(screenModelScope)
@@ -353,7 +353,6 @@ class MainActivity : BaseActivity() {
val uriHandler = LocalUriHandler.current val uriHandler = LocalUriHandler.current
val dismissSupportMessage = { val dismissSupportMessage = {
preferences.donationCampaignShown.set(true) preferences.donationCampaignShown.set(true)
@Suppress("AssignedValueIsNeverRead")
showCampaign = false showCampaign = false
} }
AdaptiveSheet( AdaptiveSheet(
@@ -459,7 +458,6 @@ class MainActivity : BaseActivity() {
try { try {
val firstInstallTime = packageManager.getPackageInfo(packageName, 0).firstInstallTime val firstInstallTime = packageManager.getPackageInfo(packageName, 0).firstInstallTime
val eligibleTime = Instant.fromEpochMilliseconds(firstInstallTime).plus(6 * 30.days) val eligibleTime = Instant.fromEpochMilliseconds(firstInstallTime).plus(6 * 30.days)
@Suppress("AssignedValueIsNeverRead")
showCampaign = (Clock.System.now() >= eligibleTime && !preferences.donationCampaignShown.get()) showCampaign = (Clock.System.now() >= eligibleTime && !preferences.donationCampaignShown.get())
} catch (_: PackageManager.NameNotFoundException) { } catch (_: PackageManager.NameNotFoundException) {
} }
@@ -95,7 +95,7 @@ class MangaScreenModel(
private val mangaId: Long, private val mangaId: Long,
private val isFromSource: Boolean, private val isFromSource: Boolean,
private val libraryPreferences: LibraryPreferences = Injekt.get(), private val libraryPreferences: LibraryPreferences = Injekt.get(),
private val trackPreferences: TrackPreferences = Injekt.get(), trackPreferences: TrackPreferences = Injekt.get(),
readerPreferences: ReaderPreferences = Injekt.get(), readerPreferences: ReaderPreferences = Injekt.get(),
private val trackerManager: TrackerManager = Injekt.get(), private val trackerManager: TrackerManager = Injekt.get(),
private val trackChapter: TrackChapter = Injekt.get(), private val trackChapter: TrackChapter = Injekt.get(),
@@ -1,6 +1,5 @@
package eu.kanade.tachiyomi.ui.reader.loader package eu.kanade.tachiyomi.ui.reader.loader
import android.provider.Settings
import eu.kanade.tachiyomi.data.cache.ChapterCache import eu.kanade.tachiyomi.data.cache.ChapterCache
import eu.kanade.tachiyomi.data.database.models.toDomainChapter import eu.kanade.tachiyomi.data.database.models.toDomainChapter
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
@@ -10,10 +9,7 @@ import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.runInterruptible import kotlinx.coroutines.runInterruptible
@@ -6,7 +6,6 @@ import android.view.Gravity
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.annotation.IntRange import androidx.annotation.IntRange
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.mutableFloatStateOf
@@ -39,7 +39,7 @@ class WebViewActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overrideActivityTransition( overrideActivityTransition(
Activity.OVERRIDE_TRANSITION_OPEN, OVERRIDE_TRANSITION_OPEN,
R.anim.shared_axis_x_push_enter, R.anim.shared_axis_x_push_enter,
R.anim.shared_axis_x_push_exit, R.anim.shared_axis_x_push_exit,
) )
@@ -90,7 +90,7 @@ class WebViewActivity : BaseActivity() {
super.finish() super.finish()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overrideActivityTransition( overrideActivityTransition(
Activity.OVERRIDE_TRANSITION_CLOSE, OVERRIDE_TRANSITION_CLOSE,
R.anim.shared_axis_x_pop_enter, R.anim.shared_axis_x_pop_enter,
R.anim.shared_axis_x_pop_exit, R.anim.shared_axis_x_pop_exit,
) )
@@ -43,7 +43,7 @@ fun Manga.prepUpdateCover(coverCache: CoverCache, remoteManga: SManga, refreshSa
fun Manga.removeCovers(coverCache: CoverCache = Injekt.get()): Manga { fun Manga.removeCovers(coverCache: CoverCache = Injekt.get()): Manga {
if (isLocal()) return this if (isLocal()) return this
return if (coverCache.deleteFromCache(this, true) > 0) { return if (coverCache.deleteFromCache(this, true) > 0) {
return copy(coverLastModified = Instant.now().toEpochMilli()) copy(coverLastModified = Instant.now().toEpochMilli())
} else { } else {
this this
} }
@@ -15,7 +15,6 @@ import okhttp3.Headers
import okhttp3.Interceptor import okhttp3.Interceptor
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import tachiyomi.core.common.util.lang.launchUI
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import java.util.Locale import java.util.Locale
import java.util.concurrent.CountDownLatch import java.util.concurrent.CountDownLatch
@@ -1,10 +1,7 @@
package tachiyomi.core.common.util.lang package tachiyomi.core.common.util.lang
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -316,7 +316,7 @@ private fun ScaffoldLayout(
*/ */
@ExperimentalMaterial3Api @ExperimentalMaterial3Api
@JvmInline @JvmInline
value class FabPosition internal constructor(@Suppress("unused") private val value: Int) { value class FabPosition internal constructor(private val value: Int) {
companion object { companion object {
/** /**
* Position FAB at the bottom of the screen in the center, above the [NavigationBar] (if it * Position FAB at the bottom of the screen in the center, above the [NavigationBar] (if it
@@ -10,7 +10,7 @@ import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@Suppress("UnusedReceiverParameter", "BooleanLiteralArgument") @Suppress("UnusedReceiverParameter")
val CustomIcons.Reddit: ImageVector val CustomIcons.Reddit: ImageVector
get() { get() {
if (_reddit != null) { if (_reddit != null) {
@@ -207,12 +207,10 @@ actual class LocalSource(
} }
private fun <T> getComicInfoForChapter(chapter: UniFile, block: (InputStream) -> T): T? { private fun <T> getComicInfoForChapter(chapter: UniFile, block: (InputStream) -> T): T? {
if (chapter.isDirectory) { return if (chapter.isDirectory) {
return chapter.findFile(COMIC_INFO_FILE)?.let { file -> chapter.findFile(COMIC_INFO_FILE)?.openInputStream()?.use(block)
file.openInputStream().use(block)
}
} else { } else {
return chapter.archiveReader(context).use { reader -> chapter.archiveReader(context).use { reader ->
reader.getInputStream(COMIC_INFO_FILE)?.use(block) reader.getInputStream(COMIC_INFO_FILE)?.use(block)
} }
} }