Address various redundant constructs
This commit is contained in:
-1
@@ -1,6 +1,5 @@
|
||||
package eu.kanade.tachiyomi.data.backup.restore.restorers
|
||||
|
||||
import app.cash.sqldelight.async.coroutines.awaitAsOne
|
||||
import eu.kanade.tachiyomi.data.backup.models.BackupCategory
|
||||
import tachiyomi.data.Database
|
||||
import tachiyomi.domain.category.interactor.GetCategories
|
||||
|
||||
@@ -26,7 +26,6 @@ import kotlinx.coroutines.flow.onStart
|
||||
import kotlinx.coroutines.flow.receiveAsFlow
|
||||
import kotlinx.coroutines.flow.shareIn
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
@@ -54,7 +53,6 @@ import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.io.File
|
||||
import kotlin.time.Duration.Companion.hours
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.download
|
||||
import android.content.Context
|
||||
import androidx.core.content.edit
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
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 kotlinx.coroutines.runBlocking
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import tachiyomi.domain.chapter.interactor.GetChapter
|
||||
import tachiyomi.domain.manga.interactor.GetManga
|
||||
|
||||
@@ -18,7 +18,6 @@ import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@@ -33,7 +33,6 @@ import kotlinx.coroutines.launch
|
||||
import tachiyomi.core.common.Constants
|
||||
import tachiyomi.core.common.i18n.pluralStringResource
|
||||
import tachiyomi.core.common.i18n.stringResource
|
||||
import tachiyomi.core.common.util.lang.launchUI
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
import tachiyomi.domain.library.model.LibraryManga
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
|
||||
@@ -6,8 +6,6 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
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.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||
@@ -25,7 +23,6 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import tachiyomi.core.common.Constants
|
||||
import tachiyomi.core.common.util.lang.launchIO
|
||||
import tachiyomi.domain.chapter.interactor.GetChapter
|
||||
import tachiyomi.domain.chapter.interactor.UpdateChapter
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
|
||||
@@ -20,6 +20,6 @@ object KitsuDateHelper {
|
||||
|
||||
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.awaitSuccess
|
||||
import eu.kanade.tachiyomi.network.parseAs
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import logcat.LogPriority
|
||||
import okhttp3.Headers
|
||||
|
||||
@@ -106,7 +106,7 @@ class MangaUpdates(id: Long) : BaseTracker(id, "MangaUpdates"), DeletableTracker
|
||||
}
|
||||
|
||||
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)
|
||||
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 {
|
||||
put("username", username)
|
||||
put("password", password)
|
||||
|
||||
@@ -20,10 +20,7 @@ import okhttp3.OkHttpClient
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import tachiyomi.core.common.util.lang.withIOContext
|
||||
import tachiyomi.domain.source.service.SourceManager
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.nio.charset.Charset
|
||||
import java.security.MessageDigest
|
||||
|
||||
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 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 {
|
||||
val query = $$"""
|
||||
|
||||
@@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.data.track.suwayomi
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
public enum class MangaStatus(
|
||||
public val rawValue: String,
|
||||
enum class MangaStatus(
|
||||
val rawValue: String,
|
||||
) {
|
||||
UNKNOWN("UNKNOWN"),
|
||||
ONGOING("ONGOING"),
|
||||
@@ -16,75 +16,73 @@ public enum class MangaStatus(
|
||||
}
|
||||
|
||||
@Serializable
|
||||
public data class MangaFragment(
|
||||
public val artist: String?,
|
||||
public val author: String?,
|
||||
public val description: String?,
|
||||
public val id: Int,
|
||||
public val status: MangaStatus,
|
||||
public val thumbnailUrl: String?,
|
||||
public val title: String,
|
||||
public val url: String,
|
||||
public val genre: List<String>,
|
||||
public val inLibraryAt: Long,
|
||||
public val chapters: Chapters,
|
||||
public val latestUploadedChapter: LatestUploadedChapter?,
|
||||
public val latestFetchedChapter: LatestFetchedChapter?,
|
||||
public val latestReadChapter: LatestReadChapter?,
|
||||
public val unreadCount: Int,
|
||||
public val downloadCount: Int,
|
||||
data class MangaFragment(
|
||||
val artist: String?,
|
||||
val author: String?,
|
||||
val description: String?,
|
||||
val id: Int,
|
||||
val status: MangaStatus,
|
||||
val thumbnailUrl: String?,
|
||||
val title: String,
|
||||
val url: String,
|
||||
val genre: List<String>,
|
||||
val inLibraryAt: Long,
|
||||
val chapters: Chapters,
|
||||
val latestUploadedChapter: LatestUploadedChapter?,
|
||||
val latestFetchedChapter: LatestFetchedChapter?,
|
||||
val latestReadChapter: LatestReadChapter?,
|
||||
val unreadCount: Int,
|
||||
val downloadCount: Int,
|
||||
) {
|
||||
@Serializable
|
||||
public data class Chapters(
|
||||
public val totalCount: Int,
|
||||
data class Chapters(
|
||||
val totalCount: Int,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class LatestUploadedChapter(
|
||||
public val uploadDate: Long,
|
||||
data class LatestUploadedChapter(
|
||||
val uploadDate: Long,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class LatestFetchedChapter(
|
||||
public val fetchedAt: Long,
|
||||
data class LatestFetchedChapter(
|
||||
val fetchedAt: Long,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class LatestReadChapter(
|
||||
public val lastReadAt: Long,
|
||||
public val chapterNumber: Double,
|
||||
data class LatestReadChapter(
|
||||
val lastReadAt: Long,
|
||||
val chapterNumber: Double,
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
public data class GetMangaResult(
|
||||
public val data: GetMangaData,
|
||||
data class GetMangaResult(
|
||||
val data: GetMangaData,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class GetMangaData(
|
||||
@SerialName("manga")
|
||||
public val entry: MangaFragment,
|
||||
data class GetMangaData(
|
||||
@SerialName("manga") val entry: MangaFragment,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class GetMangaUnreadChaptersEntry(
|
||||
public val nodes: List<GetMangaUnreadChaptersNode>,
|
||||
data class GetMangaUnreadChaptersEntry(
|
||||
val nodes: List<GetMangaUnreadChaptersNode>,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class GetMangaUnreadChaptersNode(
|
||||
public val id: Int,
|
||||
public val chapterNumber: Double,
|
||||
data class GetMangaUnreadChaptersNode(
|
||||
val id: Int,
|
||||
val chapterNumber: Double,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class GetMangaUnreadChaptersResult(
|
||||
public val data: GetMangaUnreadChaptersData,
|
||||
data class GetMangaUnreadChaptersResult(
|
||||
val data: GetMangaUnreadChaptersData,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
public data class GetMangaUnreadChaptersData(
|
||||
@SerialName("chapters")
|
||||
public val entry: GetMangaUnreadChaptersEntry,
|
||||
data class GetMangaUnreadChaptersData(
|
||||
@SerialName("chapters") val entry: GetMangaUnreadChaptersEntry,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user