Update linter
(cherry picked from commit f0eb42e72d1e267049777a303bd97d96517a9a1f) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupRestore.kt # app/src/main/java/eu/kanade/tachiyomi/data/backup/full/models/Backup.kt # app/src/main/java/eu/kanade/tachiyomi/data/backup/full/models/BackupManga.kt # app/src/main/java/eu/kanade/tachiyomi/data/backup/legacy/models/Backup.kt # app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt # app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt # app/src/main/java/eu/kanade/tachiyomi/ui/base/changehandler/OneWayFadeChangeHandler.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceItem.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcePresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterSheet.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt # app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt # app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt # app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderPage.kt # app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt # app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt
This commit is contained in:
parent
e0c1e56588
commit
e98567a86b
5
.editorconfig
Normal file
5
.editorconfig
Normal file
@ -0,0 +1,5 @@
|
||||
[*.{kt,kts}]
|
||||
indent_size=4
|
||||
insert_final_newline=true
|
||||
ij_kotlin_allow_trailing_comma=true
|
||||
ij_kotlin_allow_trailing_comma_on_call_site=true
|
@ -122,7 +122,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
this@App,
|
||||
0,
|
||||
Intent(ACTION_DISABLE_INCOGNITO_MODE),
|
||||
PendingIntent.FLAG_ONE_SHOT
|
||||
PendingIntent.FLAG_ONE_SHOT,
|
||||
)
|
||||
setContentIntent(pendingIntent)
|
||||
}
|
||||
@ -141,7 +141,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
PreferenceValues.ThemeMode.light -> AppCompatDelegate.MODE_NIGHT_NO
|
||||
PreferenceValues.ThemeMode.dark -> AppCompatDelegate.MODE_NIGHT_YES
|
||||
PreferenceValues.ThemeMode.system -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
}
|
||||
},
|
||||
)
|
||||
}.launchIn(ProcessLifecycleOwner.get().lifecycleScope)
|
||||
|
||||
@ -230,7 +230,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
val logFolder = File(
|
||||
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
||||
getString(R.string.app_name),
|
||||
"logs"
|
||||
"logs",
|
||||
)
|
||||
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault())
|
||||
@ -241,7 +241,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
override fun generateFileName(logLevel: Int, timestamp: Long): String {
|
||||
return super.generateFileName(
|
||||
logLevel,
|
||||
timestamp
|
||||
timestamp,
|
||||
) + "-${BuildConfig.BUILD_TYPE}.log"
|
||||
}
|
||||
}
|
||||
@ -259,7 +259,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
|
||||
XLog.init(
|
||||
logConfig,
|
||||
*printers.toTypedArray()
|
||||
*printers.toTypedArray(),
|
||||
)
|
||||
|
||||
xLogD("Application booting...")
|
||||
@ -274,7 +274,7 @@ open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
Device name: ${Build.DEVICE}
|
||||
Device model: ${Build.MODEL}
|
||||
Device product name: ${Build.PRODUCT}
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ abstract class AbstractBackupRestore<T : AbstractBackupManager>(protected val co
|
||||
internal fun showRestoreProgress(
|
||||
progress: Int,
|
||||
amount: Int,
|
||||
title: String
|
||||
title: String,
|
||||
) {
|
||||
notifier.showRestoreProgress(title, progress, amount)
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
|
||||
interval.toLong(),
|
||||
TimeUnit.HOURS,
|
||||
10,
|
||||
TimeUnit.MINUTES
|
||||
TimeUnit.MINUTES,
|
||||
)
|
||||
.addTag(TAG_AUTO)
|
||||
.setInputData(workDataOf(IS_AUTO_BACKUP_KEY to true))
|
||||
@ -79,7 +79,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
|
||||
val inputData = workDataOf(
|
||||
IS_AUTO_BACKUP_KEY to false,
|
||||
LOCATION_URI_KEY to uri.toString(),
|
||||
BACKUP_FLAGS_KEY to flags
|
||||
BACKUP_FLAGS_KEY to flags,
|
||||
)
|
||||
val request = OneTimeWorkRequestBuilder<BackupCreatorJob>()
|
||||
.addTag(TAG_MANUAL)
|
||||
|
@ -73,7 +73,7 @@ class BackupNotifier(private val context: Context) {
|
||||
addAction(
|
||||
R.drawable.ic_share_24dp,
|
||||
context.getString(R.string.action_share),
|
||||
NotificationReceiver.shareBackupPendingBroadcast(context, unifile.uri, Notifications.ID_BACKUP_COMPLETE)
|
||||
NotificationReceiver.shareBackupPendingBroadcast(context, unifile.uri, Notifications.ID_BACKUP_COMPLETE),
|
||||
)
|
||||
|
||||
show(Notifications.ID_BACKUP_COMPLETE)
|
||||
@ -97,7 +97,7 @@ class BackupNotifier(private val context: Context) {
|
||||
addAction(
|
||||
R.drawable.ic_close_24dp,
|
||||
context.getString(R.string.action_stop),
|
||||
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS)
|
||||
NotificationReceiver.cancelRestorePendingBroadcast(context, Notifications.ID_RESTORE_PROGRESS),
|
||||
)
|
||||
}
|
||||
|
||||
@ -124,8 +124,8 @@ class BackupNotifier(private val context: Context) {
|
||||
R.string.restore_duration,
|
||||
TimeUnit.MILLISECONDS.toMinutes(time),
|
||||
TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(
|
||||
TimeUnit.MILLISECONDS.toMinutes(time)
|
||||
)
|
||||
TimeUnit.MILLISECONDS.toMinutes(time),
|
||||
),
|
||||
)
|
||||
|
||||
with(completeNotificationBuilder) {
|
||||
|
@ -70,14 +70,14 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
getReadManga()
|
||||
} else {
|
||||
emptyList()
|
||||
} + getMergedManga() /* SY <-- */
|
||||
} + getMergedManga() // SY <--
|
||||
|
||||
backup = Backup(
|
||||
backupManga(databaseManga, flags),
|
||||
backupCategories(),
|
||||
emptyList(),
|
||||
backupExtensionInfo(databaseManga),
|
||||
backupSavedSearches()
|
||||
backupSavedSearches(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
it.name,
|
||||
it.query.orEmpty(),
|
||||
it.filtersJson ?: "[]",
|
||||
it.source
|
||||
it.source,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -439,7 +439,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
it.name,
|
||||
it.query.nullIfBlank(),
|
||||
filtersJson = it.filterList.nullIfBlank()
|
||||
?.takeUnless { it == "[]" }
|
||||
?.takeUnless { it == "[]" },
|
||||
)
|
||||
}.ifEmpty { null }
|
||||
|
||||
|
@ -11,5 +11,5 @@ data class Backup(
|
||||
@ProtoNumber(100) var backupBrokenSources: List<BrokenBackupSource> = emptyList(),
|
||||
@ProtoNumber(101) var backupSources: List<BackupSource> = emptyList(),
|
||||
// SY specific values
|
||||
@ProtoNumber(600) var backupSavedSearches: List<BackupSavedSearch> = emptyList()
|
||||
@ProtoNumber(600) var backupSavedSearches: List<BackupSavedSearch> = emptyList(),
|
||||
)
|
||||
|
@ -13,7 +13,7 @@ class BackupCategory(
|
||||
// Bump by 100 to specify this is a 0.x value
|
||||
@ProtoNumber(100) var flags: Int = 0,
|
||||
// SY specific values
|
||||
@ProtoNumber(600) var mangaOrder: List<Long> = emptyList()
|
||||
@ProtoNumber(600) var mangaOrder: List<Long> = emptyList(),
|
||||
) {
|
||||
fun getCategoryImpl(): CategoryImpl {
|
||||
return CategoryImpl().apply {
|
||||
@ -30,7 +30,7 @@ class BackupCategory(
|
||||
name = category.name,
|
||||
order = category.order,
|
||||
flags = category.flags,
|
||||
mangaOrder = category.mangaOrder
|
||||
mangaOrder = category.mangaOrder,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ data class BackupChapter(
|
||||
lastPageRead = chapter.last_page_read,
|
||||
dateFetch = chapter.date_fetch,
|
||||
dateUpload = chapter.date_upload,
|
||||
sourceOrder = chapter.source_order
|
||||
sourceOrder = chapter.source_order,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ import kotlinx.serialization.protobuf.ProtoNumber
|
||||
data class BackupFlatMetadata(
|
||||
@ProtoNumber(1) var searchMetadata: BackupSearchMetadata,
|
||||
@ProtoNumber(2) var searchTags: List<BackupSearchTag> = emptyList(),
|
||||
@ProtoNumber(3) var searchTitles: List<BackupSearchTitle> = emptyList()
|
||||
@ProtoNumber(3) var searchTitles: List<BackupSearchTitle> = emptyList(),
|
||||
) {
|
||||
fun getFlatMetadata(mangaId: Long): FlatMetadata {
|
||||
return FlatMetadata(
|
||||
metadata = searchMetadata.getSearchMetadata(mangaId),
|
||||
tags = searchTags.map { it.getSearchTag(mangaId) },
|
||||
titles = searchTitles.map { it.getSearchTitle(mangaId) }
|
||||
titles = searchTitles.map { it.getSearchTitle(mangaId) },
|
||||
)
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ data class BackupFlatMetadata(
|
||||
return BackupFlatMetadata(
|
||||
searchMetadata = BackupSearchMetadata.copyFrom(flatMetadata.metadata),
|
||||
searchTags = flatMetadata.tags.map { BackupSearchTag.copyFrom(it) },
|
||||
searchTitles = flatMetadata.titles.map { BackupSearchTitle.copyFrom(it) }
|
||||
searchTitles = flatMetadata.titles.map { BackupSearchTitle.copyFrom(it) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,11 @@ import kotlinx.serialization.protobuf.ProtoNumber
|
||||
@Serializable
|
||||
data class BrokenBackupHistory(
|
||||
@ProtoNumber(0) var url: String,
|
||||
@ProtoNumber(1) var lastRead: Long
|
||||
@ProtoNumber(1) var lastRead: Long,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class BackupHistory(
|
||||
@ProtoNumber(1) var url: String,
|
||||
@ProtoNumber(2) var lastRead: Long
|
||||
@ProtoNumber(2) var lastRead: Long,
|
||||
)
|
||||
|
@ -95,7 +95,7 @@ data class BackupManga(
|
||||
artist = customArtist,
|
||||
description = customDescription,
|
||||
genre = customGenre,
|
||||
status = customStatus.takeUnless { it == 0 }
|
||||
status = customStatus.takeUnless { it == 0 },
|
||||
)
|
||||
}
|
||||
return null
|
||||
@ -127,7 +127,7 @@ data class BackupManga(
|
||||
viewer = manga.readingModeType,
|
||||
viewer_flags = manga.viewer_flags,
|
||||
chapterFlags = manga.chapter_flags,
|
||||
filtered_scanlators = manga.filtered_scanlators
|
||||
filtered_scanlators = manga.filtered_scanlators,
|
||||
// SY -->
|
||||
).also { backupManga ->
|
||||
customMangaManager?.getManga(manga)?.let {
|
||||
|
@ -16,7 +16,7 @@ data class BackupMergedMangaReference(
|
||||
@ProtoNumber(5) var downloadChapters: Boolean,
|
||||
@ProtoNumber(6) var mergeUrl: String,
|
||||
@ProtoNumber(7) var mangaUrl: String,
|
||||
@ProtoNumber(8) var mangaSourceId: Long
|
||||
@ProtoNumber(8) var mangaSourceId: Long,
|
||||
) {
|
||||
fun getMergedMangaReference(): MergedMangaReference {
|
||||
return MergedMangaReference(
|
||||
@ -30,7 +30,7 @@ data class BackupMergedMangaReference(
|
||||
mangaSourceId = mangaSourceId,
|
||||
mergeId = null,
|
||||
mangaId = null,
|
||||
id = null
|
||||
id = null,
|
||||
)
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ data class BackupMergedMangaReference(
|
||||
downloadChapters = mergedMangaReference.downloadChapters,
|
||||
mergeUrl = mergedMangaReference.mergeUrl,
|
||||
mangaUrl = mergedMangaReference.mangaUrl,
|
||||
mangaSourceId = mergedMangaReference.mangaSourceId
|
||||
mangaSourceId = mergedMangaReference.mangaSourceId,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,5 @@ data class BackupSavedSearch(
|
||||
@ProtoNumber(1) val name: String,
|
||||
@ProtoNumber(2) val query: String = "",
|
||||
@ProtoNumber(3) val filterList: String = "",
|
||||
@ProtoNumber(4) val source: Long = 0
|
||||
@ProtoNumber(4) val source: Long = 0,
|
||||
)
|
||||
|
@ -7,19 +7,19 @@ import kotlinx.serialization.protobuf.ProtoNumber
|
||||
@Serializable
|
||||
data class BrokenBackupSource(
|
||||
@ProtoNumber(0) var name: String = "",
|
||||
@ProtoNumber(1) var sourceId: Long
|
||||
@ProtoNumber(1) var sourceId: Long,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class BackupSource(
|
||||
@ProtoNumber(1) var name: String = "",
|
||||
@ProtoNumber(2) var sourceId: Long
|
||||
@ProtoNumber(2) var sourceId: Long,
|
||||
) {
|
||||
companion object {
|
||||
fun copyFrom(source: Source): BackupSource {
|
||||
return BackupSource(
|
||||
name = source.name,
|
||||
sourceId = source.id
|
||||
sourceId = source.id,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ data class BackupTracking(
|
||||
status = track.status,
|
||||
startedReadingDate = track.started_reading_date,
|
||||
finishedReadingDate = track.finished_reading_date,
|
||||
trackingUrl = track.tracking_url
|
||||
trackingUrl = track.tracking_url,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ data class BackupSearchMetadata(
|
||||
@ProtoNumber(1) var uploader: String? = null,
|
||||
@ProtoNumber(2) var extra: String,
|
||||
@ProtoNumber(3) var indexedExtra: String? = null,
|
||||
@ProtoNumber(4) var extraVersion: Int
|
||||
@ProtoNumber(4) var extraVersion: Int,
|
||||
) {
|
||||
fun getSearchMetadata(mangaId: Long): SearchMetadata {
|
||||
return SearchMetadata(
|
||||
@ -17,7 +17,7 @@ data class BackupSearchMetadata(
|
||||
uploader = uploader,
|
||||
extra = extra,
|
||||
indexedExtra = indexedExtra,
|
||||
extraVersion = extraVersion
|
||||
extraVersion = extraVersion,
|
||||
)
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ data class BackupSearchMetadata(
|
||||
uploader = searchMetadata.uploader,
|
||||
extra = searchMetadata.extra,
|
||||
indexedExtra = searchMetadata.indexedExtra,
|
||||
extraVersion = searchMetadata.extraVersion
|
||||
extraVersion = searchMetadata.extraVersion,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import kotlinx.serialization.protobuf.ProtoNumber
|
||||
data class BackupSearchTag(
|
||||
@ProtoNumber(1) var namespace: String? = null,
|
||||
@ProtoNumber(2) var name: String,
|
||||
@ProtoNumber(3) var type: Int
|
||||
@ProtoNumber(3) var type: Int,
|
||||
) {
|
||||
fun getSearchTag(mangaId: Long): SearchTag {
|
||||
return SearchTag(
|
||||
@ -16,7 +16,7 @@ data class BackupSearchTag(
|
||||
mangaId = mangaId,
|
||||
namespace = namespace,
|
||||
name = name,
|
||||
type = type
|
||||
type = type,
|
||||
)
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ data class BackupSearchTag(
|
||||
return BackupSearchTag(
|
||||
namespace = searchTag.namespace,
|
||||
name = searchTag.name,
|
||||
type = searchTag.type
|
||||
type = searchTag.type,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ import kotlinx.serialization.protobuf.ProtoNumber
|
||||
@Serializable
|
||||
data class BackupSearchTitle(
|
||||
@ProtoNumber(1) var title: String,
|
||||
@ProtoNumber(2) var type: Int
|
||||
@ProtoNumber(2) var type: Int,
|
||||
) {
|
||||
fun getSearchTitle(mangaId: Long): SearchTitle {
|
||||
return SearchTitle(
|
||||
id = null,
|
||||
mangaId = mangaId,
|
||||
title = title,
|
||||
type = type
|
||||
type = type,
|
||||
)
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ data class BackupSearchTitle(
|
||||
fun copyFrom(searchTitle: SearchTitle): BackupSearchTitle {
|
||||
return BackupSearchTitle(
|
||||
title = searchTitle.title,
|
||||
type = searchTitle.type
|
||||
type = searchTitle.type,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ class LegacyBackupManager(context: Context, version: Int = CURRENT_VERSION) : Ab
|
||||
source = it.substringBefore(':').toLongOrNull() ?: return@mapNotNull null,
|
||||
content["name"]!!.jsonPrimitive.content,
|
||||
content["query"]!!.jsonPrimitive.contentOrNull?.nullIfBlank(),
|
||||
Json.encodeToString(content["filters"]!!.jsonArray)
|
||||
Json.encodeToString(content["filters"]!!.jsonArray),
|
||||
)
|
||||
}.getOrNull()
|
||||
}.filter { backupSavedSearch ->
|
||||
|
@ -34,7 +34,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
|
||||
// Read the json and create a Json Object,
|
||||
// cannot use the backupManager json deserializer one because its not initialized yet
|
||||
val backupObject = Json.decodeFromStream<JsonObject>(
|
||||
context.contentResolver.openInputStream(uri)!!
|
||||
context.contentResolver.openInputStream(uri)!!,
|
||||
)
|
||||
|
||||
// Get parser version
|
||||
@ -143,7 +143,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
|
||||
chapters: List<Chapter>,
|
||||
categories: List<String>,
|
||||
history: List<DHistory>,
|
||||
tracks: List<Track>
|
||||
tracks: List<Track>,
|
||||
) {
|
||||
val dbManga = backupManager.getMangaFromDatabase(manga)
|
||||
|
||||
@ -173,7 +173,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
|
||||
chapters: List<Chapter>,
|
||||
categories: List<String>,
|
||||
history: List<DHistory>,
|
||||
tracks: List<Track>
|
||||
tracks: List<Track>,
|
||||
) {
|
||||
try {
|
||||
val fetchedManga = backupManager.fetchManga(source, manga)
|
||||
@ -195,7 +195,7 @@ class LegacyBackupRestore(context: Context, notifier: BackupNotifier) : Abstract
|
||||
chapters: List<Chapter>,
|
||||
categories: List<String>,
|
||||
history: List<DHistory>,
|
||||
tracks: List<Track>
|
||||
tracks: List<Track>,
|
||||
) {
|
||||
if (!backupManager.restoreChaptersForManga(backupManga, chapters)) {
|
||||
updateChapters(source, backupManga, chapters)
|
||||
|
@ -21,7 +21,7 @@ class LegacyBackupRestoreValidator : AbstractBackupRestoreValidator() {
|
||||
|
||||
val backup = try {
|
||||
backupManager.parser.decodeFromStream<Backup>(
|
||||
context.contentResolver.openInputStream(uri)!!
|
||||
context.contentResolver.openInputStream(uri)!!,
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
throw ValidatorParseException(e)
|
||||
|
@ -21,7 +21,7 @@ data class Backup(
|
||||
// SY Specific values
|
||||
@SerialName("mergedmangareferences")
|
||||
var mergedMangaReferences: List<@Contextual MergedMangaReference>? = null,
|
||||
var savedSearches: String? = null
|
||||
var savedSearches: String? = null,
|
||||
) {
|
||||
companion object {
|
||||
const val CURRENT_VERSION = 2
|
||||
@ -39,5 +39,5 @@ data class MangaObject(
|
||||
var chapters: List<@Contextual Chapter>? = null,
|
||||
var categories: List<String>? = null,
|
||||
var track: List<@Contextual Track>? = null,
|
||||
var history: List<@Contextual DHistory>? = null
|
||||
var history: List<@Contextual DHistory>? = null,
|
||||
)
|
||||
|
@ -27,7 +27,7 @@ open class CategoryBaseSerializer<T : Category> : KSerializer<T> {
|
||||
buildJsonArray {
|
||||
add(value.name)
|
||||
add(value.order)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ open class ChapterBaseSerializer<T : Chapter> : KSerializer<T> {
|
||||
if (value.last_page_read != 0) {
|
||||
put(LAST_READ, value.last_page_read)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ object HistoryTypeSerializer : KSerializer<DHistory> {
|
||||
buildJsonArray {
|
||||
add(value.url)
|
||||
add(value.lastRead)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ object HistoryTypeSerializer : KSerializer<DHistory> {
|
||||
val array = decoder.decodeJsonElement().jsonArray
|
||||
return DHistory(
|
||||
url = array[0].jsonPrimitive.content,
|
||||
lastRead = array[1].jsonPrimitive.long
|
||||
lastRead = array[1].jsonPrimitive.long,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ open class MangaBaseSerializer<T : Manga> : KSerializer<T> {
|
||||
add(value.source)
|
||||
add(value.viewer_flags)
|
||||
add(value.chapter_flags)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ object MergedMangaTypeSerializer : KSerializer<MergedMangaReference> {
|
||||
add(value.getChapterUpdates)
|
||||
add(value.isInfoManga)
|
||||
add(value.downloadChapters)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ object MergedMangaTypeSerializer : KSerializer<MergedMangaReference> {
|
||||
isInfoManga = array[6].jsonPrimitive.boolean,
|
||||
downloadChapters = array[7].jsonPrimitive.boolean,
|
||||
mangaId = null,
|
||||
mergeId = null
|
||||
mergeId = null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ open class TrackBaseSerializer<T : Track> : KSerializer<T> {
|
||||
put(LIBRARY, value.library_id)
|
||||
put(LAST_READ, value.last_chapter_read)
|
||||
put(TRACKING_URL, value.tracking_url)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class ChapterCache(private val context: Context) {
|
||||
File(context.cacheDir, PARAMETER_CACHE_DIRECTORY),
|
||||
PARAMETER_APP_VERSION,
|
||||
PARAMETER_VALUE_COUNT,
|
||||
cacheSize * 1024 * 1024
|
||||
cacheSize * 1024 * 1024,
|
||||
)
|
||||
}
|
||||
// <-- EH
|
||||
|
@ -47,7 +47,7 @@ class MangaCoverFetcher(
|
||||
private val options: Options,
|
||||
private val coverCache: CoverCache,
|
||||
private val callFactoryLazy: Lazy<Call.Factory>,
|
||||
private val diskCacheLazy: Lazy<DiskCache>
|
||||
private val diskCacheLazy: Lazy<DiskCache>,
|
||||
) : Fetcher {
|
||||
|
||||
// For non-custom cover
|
||||
@ -75,7 +75,7 @@ class MangaCoverFetcher(
|
||||
return SourceResult(
|
||||
source = ImageSource(file = file.toOkioPath(), diskCacheKey = diskCacheKey),
|
||||
mimeType = "image/*",
|
||||
dataSource = DataSource.DISK
|
||||
dataSource = DataSource.DISK,
|
||||
)
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ class MangaCoverFetcher(
|
||||
return SourceResult(
|
||||
source = snapshot.toImageSource(),
|
||||
mimeType = "image/*",
|
||||
dataSource = DataSource.DISK
|
||||
dataSource = DataSource.DISK,
|
||||
)
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ class MangaCoverFetcher(
|
||||
return SourceResult(
|
||||
source = snapshot.toImageSource(),
|
||||
mimeType = "image/*",
|
||||
dataSource = DataSource.NETWORK
|
||||
dataSource = DataSource.NETWORK,
|
||||
)
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ class MangaCoverFetcher(
|
||||
return SourceResult(
|
||||
source = ImageSource(source = responseBody.source(), context = options.context),
|
||||
mimeType = "image/*",
|
||||
dataSource = if (response.cacheResponse != null) DataSource.DISK else DataSource.NETWORK
|
||||
dataSource = if (response.cacheResponse != null) DataSource.DISK else DataSource.NETWORK,
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
responseBody.closeQuietly()
|
||||
@ -273,7 +273,7 @@ class MangaCoverFetcher(
|
||||
|
||||
class Factory(
|
||||
private val callFactoryLazy: Lazy<Call.Factory>,
|
||||
private val diskCacheLazy: Lazy<DiskCache>
|
||||
private val diskCacheLazy: Lazy<DiskCache>,
|
||||
) : Fetcher.Factory<Manga> {
|
||||
|
||||
private val coverCache: CoverCache by injectLazy()
|
||||
|
@ -32,7 +32,7 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti
|
||||
|
||||
return DecodeResult(
|
||||
drawable = bitmap.toDrawable(options.context.resources),
|
||||
isSampled = false
|
||||
isSampled = false,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,8 @@ open class DatabaseHelper(context: Context) :
|
||||
CategoryQueries,
|
||||
MangaCategoryQueries,
|
||||
HistoryQueries
|
||||
/* SY --> */,
|
||||
/* SY --> */
|
||||
,
|
||||
SearchMetadataQueries,
|
||||
SearchTagQueries,
|
||||
SearchTitleQueries,
|
||||
@ -62,7 +63,8 @@ open class DatabaseHelper(context: Context) :
|
||||
FavoriteEntryQueries,
|
||||
SavedSearchQueries,
|
||||
FeedSavedSearchQueries
|
||||
/* SY <-- */ {
|
||||
/* SY <-- */
|
||||
{
|
||||
|
||||
private val configuration = SupportSQLiteOpenHelper.Configuration.builder(context)
|
||||
.name(DbOpenCallback.DATABASE_NAME)
|
||||
|
@ -27,7 +27,7 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) {
|
||||
/**
|
||||
* Version of the database.
|
||||
*/
|
||||
const val DATABASE_VERSION = /* SY --> */ 13 /* SY <-- */
|
||||
const val DATABASE_VERSION = /* SY --> */ 13 // SY <--
|
||||
}
|
||||
|
||||
override fun onCreate(db: SupportSQLiteDatabase) = with(db) {
|
||||
|
@ -21,7 +21,7 @@ import eu.kanade.tachiyomi.data.database.tables.CategoryTable.TABLE
|
||||
class CategoryTypeMapping : SQLiteTypeMapping<Category>(
|
||||
CategoryPutResolver(),
|
||||
CategoryGetResolver(),
|
||||
CategoryDeleteResolver()
|
||||
CategoryDeleteResolver(),
|
||||
)
|
||||
|
||||
class CategoryPutResolver : DefaultPutResolver<Category>() {
|
||||
@ -42,7 +42,7 @@ class CategoryPutResolver : DefaultPutResolver<Category>() {
|
||||
COL_NAME to obj.name,
|
||||
COL_ORDER to obj.order,
|
||||
COL_FLAGS to obj.flags,
|
||||
COL_MANGA_ORDER to obj.mangaOrder.joinToString("/")
|
||||
COL_MANGA_ORDER to obj.mangaOrder.joinToString("/"),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import eu.kanade.tachiyomi.data.database.tables.ChapterTable.TABLE
|
||||
class ChapterTypeMapping : SQLiteTypeMapping<Chapter>(
|
||||
ChapterPutResolver(),
|
||||
ChapterGetResolver(),
|
||||
ChapterDeleteResolver()
|
||||
ChapterDeleteResolver(),
|
||||
)
|
||||
|
||||
class ChapterPutResolver : DefaultPutResolver<Chapter>() {
|
||||
@ -56,7 +56,7 @@ class ChapterPutResolver : DefaultPutResolver<Chapter>() {
|
||||
COL_DATE_UPLOAD to obj.date_upload,
|
||||
COL_LAST_PAGE_READ to obj.last_page_read,
|
||||
COL_CHAPTER_NUMBER to obj.chapter_number,
|
||||
COL_SOURCE_ORDER to obj.source_order
|
||||
COL_SOURCE_ORDER to obj.source_order,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.database.tables.HistoryTable.TABLE
|
||||
class HistoryTypeMapping : SQLiteTypeMapping<History>(
|
||||
HistoryPutResolver(),
|
||||
HistoryGetResolver(),
|
||||
HistoryDeleteResolver()
|
||||
HistoryDeleteResolver(),
|
||||
)
|
||||
|
||||
open class HistoryPutResolver : DefaultPutResolver<History>() {
|
||||
@ -40,7 +40,7 @@ open class HistoryPutResolver : DefaultPutResolver<History>() {
|
||||
COL_ID to obj.id,
|
||||
COL_CHAPTER_ID to obj.chapter_id,
|
||||
COL_LAST_READ to obj.last_read,
|
||||
COL_TIME_READ to obj.time_read
|
||||
COL_TIME_READ to obj.time_read,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaCategoryTable.TABLE
|
||||
class MangaCategoryTypeMapping : SQLiteTypeMapping<MangaCategory>(
|
||||
MangaCategoryPutResolver(),
|
||||
MangaCategoryGetResolver(),
|
||||
MangaCategoryDeleteResolver()
|
||||
MangaCategoryDeleteResolver(),
|
||||
)
|
||||
|
||||
class MangaCategoryPutResolver : DefaultPutResolver<MangaCategory>() {
|
||||
@ -37,7 +37,7 @@ class MangaCategoryPutResolver : DefaultPutResolver<MangaCategory>() {
|
||||
contentValuesOf(
|
||||
COL_ID to obj.id,
|
||||
COL_MANGA_ID to obj.manga_id,
|
||||
COL_CATEGORY_ID to obj.category_id
|
||||
COL_CATEGORY_ID to obj.category_id,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable.TABLE
|
||||
class MangaTypeMapping : SQLiteTypeMapping<Manga>(
|
||||
MangaPutResolver(),
|
||||
MangaGetResolver(),
|
||||
MangaDeleteResolver()
|
||||
MangaDeleteResolver(),
|
||||
)
|
||||
|
||||
class MangaPutResolver : DefaultPutResolver<Manga>() {
|
||||
@ -70,7 +70,7 @@ class MangaPutResolver : DefaultPutResolver<Manga>() {
|
||||
COL_CHAPTER_FLAGS to obj.chapter_flags,
|
||||
COL_COVER_LAST_MODIFIED to obj.cover_last_modified,
|
||||
COL_DATE_ADDED to obj.date_added,
|
||||
COL_FILTERED_SCANLATORS to obj.filtered_scanlators
|
||||
COL_FILTERED_SCANLATORS to obj.filtered_scanlators,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.data.database.tables.TrackTable.TABLE
|
||||
class TrackTypeMapping : SQLiteTypeMapping<Track>(
|
||||
TrackPutResolver(),
|
||||
TrackGetResolver(),
|
||||
TrackDeleteResolver()
|
||||
TrackDeleteResolver(),
|
||||
)
|
||||
|
||||
class TrackPutResolver : DefaultPutResolver<Track>() {
|
||||
@ -58,7 +58,7 @@ class TrackPutResolver : DefaultPutResolver<Track>() {
|
||||
COL_TRACKING_URL to obj.tracking_url,
|
||||
COL_SCORE to obj.score,
|
||||
COL_START_DATE to obj.started_reading_date,
|
||||
COL_FINISH_DATE to obj.finished_reading_date
|
||||
COL_FINISH_DATE to obj.finished_reading_date,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -133,6 +133,6 @@ fun Manga.toMangaInfo(): MangaInfo {
|
||||
genres = this.getGenres() ?: emptyList(),
|
||||
key = this.url,
|
||||
status = this.status,
|
||||
title = this.title
|
||||
title = this.title,
|
||||
)
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ interface CategoryQueries : DbProvider {
|
||||
Query.builder()
|
||||
.table(CategoryTable.TABLE)
|
||||
.orderBy(CategoryTable.COL_ORDER)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -25,7 +25,7 @@ interface CategoryQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getCategoriesForMangaQuery())
|
||||
.args(manga.id)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
|
@ -25,7 +25,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_MANGA_ID} = ?")
|
||||
.whereArgs(mangaId)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
// SY <--
|
||||
@ -37,7 +37,7 @@ interface ChapterQueries : DbProvider {
|
||||
.query(getRecentsQuery())
|
||||
.args(date.time)
|
||||
.observesTables(ChapterTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.withGetResolver(MangaChapterGetResolver.INSTANCE)
|
||||
.prepare()
|
||||
@ -49,7 +49,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_ID} = ?")
|
||||
.whereArgs(id)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -60,7 +60,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_URL} = ?")
|
||||
.whereArgs(url)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -71,7 +71,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_URL} = ? AND ${ChapterTable.COL_MANGA_ID} = ?")
|
||||
.whereArgs(url, mangaId)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -83,7 +83,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_URL} = ?")
|
||||
.whereArgs(url)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -94,7 +94,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_URL} IN (?) AND (${ChapterTable.COL_READ} = 1 OR ${ChapterTable.COL_LAST_PAGE_READ} != 0)")
|
||||
.whereArgs(urls.joinToString { "\"$it\"" })
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
// SY <--
|
||||
|
@ -33,7 +33,7 @@ interface HistoryQueries : DbProvider {
|
||||
.query(getRecentMangasQuery(search))
|
||||
.args(date.time, limit, offset)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.withGetResolver(MangaChapterHistoryGetResolver.INSTANCE)
|
||||
.prepare()
|
||||
@ -45,7 +45,7 @@ interface HistoryQueries : DbProvider {
|
||||
.query(getHistoryByMangaId())
|
||||
.args(mangaId)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -56,7 +56,7 @@ interface HistoryQueries : DbProvider {
|
||||
.query(getHistoryByChapterUrl())
|
||||
.args(chapterUrl)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -84,7 +84,7 @@ interface HistoryQueries : DbProvider {
|
||||
.byQuery(
|
||||
DeleteQuery.builder()
|
||||
.table(HistoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -94,7 +94,7 @@ interface HistoryQueries : DbProvider {
|
||||
.table(HistoryTable.TABLE)
|
||||
.where("${HistoryTable.COL_LAST_READ} = ?")
|
||||
.whereArgs(0)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -110,7 +110,7 @@ interface HistoryQueries : DbProvider {
|
||||
.table(HistoryTable.TABLE)
|
||||
.where("${HistoryTable.COL_ID} IN (?)")
|
||||
.whereArgs(ids.joinToString())
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
// SY <--
|
||||
|
@ -20,7 +20,7 @@ interface MangaCategoryQueries : DbProvider {
|
||||
.table(MangaCategoryTable.TABLE)
|
||||
.where("${MangaCategoryTable.COL_MANGA_ID} IN (${Queries.placeholders(mangas.size)})")
|
||||
.whereArgs(*mangas.map { it.id }.toTypedArray())
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
|
@ -35,7 +35,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(libraryQuery)
|
||||
.observesTables(MangaTable.TABLE, ChapterTable.TABLE, MangaCategoryTable.TABLE, CategoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.withGetResolver(LibraryMangaGetResolver.INSTANCE)
|
||||
.prepare()
|
||||
@ -51,7 +51,7 @@ interface MangaQueries : DbProvider {
|
||||
manga.source,
|
||||
)
|
||||
.limit(1)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -78,7 +78,7 @@ interface MangaQueries : DbProvider {
|
||||
.table(MangaTable.TABLE)
|
||||
.where("${MangaTable.COL_URL} = ? AND ${MangaTable.COL_SOURCE} = ?")
|
||||
.whereArgs(url, sourceId)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -89,7 +89,7 @@ interface MangaQueries : DbProvider {
|
||||
.table(MangaTable.TABLE)
|
||||
.where("${MangaTable.COL_ID} = ?")
|
||||
.whereArgs(id)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -99,7 +99,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getSourceIdsWithNonLibraryMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.withGetResolver(SourceIdMangaCountGetResolver.INSTANCE)
|
||||
.prepare()
|
||||
@ -110,7 +110,7 @@ interface MangaQueries : DbProvider {
|
||||
.withQuery(
|
||||
Query.builder()
|
||||
.table(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -119,7 +119,7 @@ interface MangaQueries : DbProvider {
|
||||
.withQuery(
|
||||
RawQuery.builder()
|
||||
.query(getReadMangaNotInLibraryQuery())
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -209,11 +209,11 @@ interface MangaQueries : DbProvider {
|
||||
${MangaTable.COL_FAVORITE} = ? AND ${MangaTable.COL_SOURCE} IN (${Queries.placeholders(sourceIds.size)}) AND ${MangaTable.COL_ID} NOT IN (
|
||||
SELECT ${MergedTable.COL_MANGA_ID} FROM ${MergedTable.TABLE} WHERE ${MergedTable.COL_MANGA_ID} != ${MergedTable.COL_MERGE_ID}
|
||||
)
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
)
|
||||
// SY <--
|
||||
.whereArgs(0, *sourceIds.toTypedArray())
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -229,10 +229,10 @@ interface MangaQueries : DbProvider {
|
||||
) AND ${MangaTable.COL_ID} NOT IN (
|
||||
SELECT ${ChapterTable.COL_MANGA_ID} FROM ${ChapterTable.TABLE} WHERE ${ChapterTable.COL_READ} = 1 OR ${ChapterTable.COL_LAST_PAGE_READ} != 0
|
||||
)
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
)
|
||||
.whereArgs(0, *sourceIds.toTypedArray())
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
// SY <--
|
||||
@ -241,7 +241,7 @@ interface MangaQueries : DbProvider {
|
||||
.byQuery(
|
||||
DeleteQuery.builder()
|
||||
.table(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -251,7 +251,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getLastReadMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -261,7 +261,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getTotalChapterMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -271,7 +271,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getLatestChapterMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -281,7 +281,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getChapterFetchDateMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -296,9 +296,9 @@ interface MangaQueries : DbProvider {
|
||||
INNER JOIN ${SearchMetadataTable.TABLE}
|
||||
ON ${MangaTable.TABLE}.${MangaTable.COL_ID} = ${SearchMetadataTable.TABLE}.${SearchMetadataTable.COL_MANGA_ID}
|
||||
ORDER BY ${MangaTable.TABLE}.${MangaTable.COL_ID}
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -313,9 +313,9 @@ interface MangaQueries : DbProvider {
|
||||
ON ${MangaTable.TABLE}.${MangaTable.COL_ID} = ${SearchMetadataTable.TABLE}.${SearchMetadataTable.COL_MANGA_ID}
|
||||
WHERE ${MangaTable.TABLE}.${MangaTable.COL_FAVORITE} = 1
|
||||
ORDER BY ${MangaTable.TABLE}.${MangaTable.COL_ID}
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -330,9 +330,9 @@ interface MangaQueries : DbProvider {
|
||||
ON ${MangaTable.TABLE}.${MangaTable.COL_ID} = ${SearchMetadataTable.TABLE}.${SearchMetadataTable.COL_MANGA_ID}
|
||||
WHERE ${MangaTable.TABLE}.${MangaTable.COL_FAVORITE} = 1
|
||||
ORDER BY ${MangaTable.TABLE}.${MangaTable.COL_ID}
|
||||
""".trimIndent()
|
||||
""".trimIndent(),
|
||||
)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
// SY <--
|
||||
|
@ -15,7 +15,7 @@ interface TrackQueries : DbProvider {
|
||||
.withQuery(
|
||||
Query.builder()
|
||||
.table(TrackTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -26,7 +26,7 @@ interface TrackQueries : DbProvider {
|
||||
.table(TrackTable.TABLE)
|
||||
.where("${TrackTable.COL_MANGA_ID} = ?")
|
||||
.whereArgs(manga.id)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@ -40,7 +40,7 @@ interface TrackQueries : DbProvider {
|
||||
.table(TrackTable.TABLE)
|
||||
.where("${TrackTable.COL_MANGA_ID} = ? AND ${TrackTable.COL_SYNC_ID} = ?")
|
||||
.whereArgs(manga.id, sync.id)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ class ChapterBackupPutResolver : PutResolver<Chapter>() {
|
||||
contentValuesOf(
|
||||
ChapterTable.COL_READ to chapter.read,
|
||||
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
|
||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
|
||||
)
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ class ChapterKnownBackupPutResolver : PutResolver<Chapter>() {
|
||||
contentValuesOf(
|
||||
ChapterTable.COL_READ to chapter.read,
|
||||
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
|
||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
|
||||
)
|
||||
}
|
||||
|
@ -29,6 +29,6 @@ class ChapterProgressPutResolver : PutResolver<Chapter>() {
|
||||
contentValuesOf(
|
||||
ChapterTable.COL_READ to chapter.read,
|
||||
ChapterTable.COL_BOOKMARK to chapter.bookmark,
|
||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read
|
||||
ChapterTable.COL_LAST_PAGE_READ to chapter.last_page_read,
|
||||
)
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class ChapterSourceOrderPutResolver : PutResolver<Chapter>() {
|
||||
|
||||
fun mapToContentValues(chapter: Chapter) =
|
||||
contentValuesOf(
|
||||
ChapterTable.COL_SOURCE_ORDER to chapter.source_order
|
||||
ChapterTable.COL_SOURCE_ORDER to chapter.source_order,
|
||||
)
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class HistoryChapterIdPutResolver : PutResolver<History>() {
|
||||
|
||||
fun mapToContentValues(history: History) =
|
||||
contentValuesOf(
|
||||
HistoryTable.COL_CHAPTER_ID to history.chapter_id
|
||||
HistoryTable.COL_CHAPTER_ID to history.chapter_id,
|
||||
)
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class HistoryLastReadPutResolver : HistoryPutResolver() {
|
||||
.table(updateQuery.table())
|
||||
.where(updateQuery.where())
|
||||
.whereArgs(updateQuery.whereArgs())
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
|
||||
cursor.use { putCursor ->
|
||||
@ -47,6 +47,6 @@ class HistoryLastReadPutResolver : HistoryPutResolver() {
|
||||
|
||||
private fun mapToUpdateContentValues(history: History) =
|
||||
contentValuesOf(
|
||||
HistoryTable.COL_LAST_READ to history.last_read
|
||||
HistoryTable.COL_LAST_READ to history.last_read,
|
||||
)
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class MangaCoverLastModifiedPutResolver : PutResolver<Manga>() {
|
||||
|
||||
fun mapToContentValues(manga: Manga) =
|
||||
contentValuesOf(
|
||||
MangaTable.COL_COVER_LAST_MODIFIED to manga.cover_last_modified
|
||||
MangaTable.COL_COVER_LAST_MODIFIED to manga.cover_last_modified,
|
||||
)
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ class MangaFavoritePutResolver : PutResolver<Manga>() {
|
||||
fun mapToContentValues(manga: Manga) =
|
||||
contentValuesOf(
|
||||
MangaTable.COL_FAVORITE to manga.favorite,
|
||||
MangaTable.COL_DATE_ADDED to manga.date_added
|
||||
MangaTable.COL_DATE_ADDED to manga.date_added,
|
||||
)
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class MangaFilteredScanlatorsPutResolver : PutResolver<Manga>() {
|
||||
.build()
|
||||
|
||||
fun mapToContentValues(manga: Manga) = contentValuesOf(
|
||||
MangaTable.COL_FILTERED_SCANLATORS to manga.filtered_scanlators
|
||||
MangaTable.COL_FILTERED_SCANLATORS to manga.filtered_scanlators,
|
||||
)
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ class MangaFlagsPutResolver(private val colName: String, private val fieldGetter
|
||||
|
||||
fun mapToContentValues(manga: Manga) =
|
||||
contentValuesOf(
|
||||
colName to fieldGetter.get(manga)
|
||||
colName to fieldGetter.get(manga),
|
||||
)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class MangaInfoPutResolver(val reset: Boolean = false) : PutResolver<Manga>() {
|
||||
MangaTable.COL_AUTHOR to manga.originalAuthor,
|
||||
MangaTable.COL_ARTIST to manga.originalArtist,
|
||||
MangaTable.COL_DESCRIPTION to manga.originalDescription,
|
||||
MangaTable.COL_STATUS to manga.originalStatus
|
||||
MangaTable.COL_STATUS to manga.originalStatus,
|
||||
)
|
||||
|
||||
private fun resetToContentValues(manga: Manga) = contentValuesOf(
|
||||
@ -41,7 +41,7 @@ class MangaInfoPutResolver(val reset: Boolean = false) : PutResolver<Manga>() {
|
||||
MangaTable.COL_AUTHOR to manga.author?.split(splitter)?.lastOrNull(),
|
||||
MangaTable.COL_ARTIST to manga.artist?.split(splitter)?.lastOrNull(),
|
||||
MangaTable.COL_DESCRIPTION to manga.description?.split(splitter)?.lastOrNull(),
|
||||
MangaTable.COL_STATUS to manga.status.nullIfZero()?.toString()?.split(splitter)?.lastOrNull()
|
||||
MangaTable.COL_STATUS to manga.status.nullIfZero()?.toString()?.split(splitter)?.lastOrNull(),
|
||||
)
|
||||
|
||||
companion object {
|
||||
|
@ -27,6 +27,6 @@ class MangaLastUpdatedPutResolver : PutResolver<Manga>() {
|
||||
|
||||
fun mapToContentValues(manga: Manga) =
|
||||
contentValuesOf(
|
||||
MangaTable.COL_LAST_UPDATE to manga.last_update
|
||||
MangaTable.COL_LAST_UPDATE to manga.last_update,
|
||||
)
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ class MangaMigrationPutResolver : PutResolver<Manga>() {
|
||||
MangaTable.COL_DATE_ADDED to manga.date_added,
|
||||
MangaTable.COL_TITLE to manga.title,
|
||||
MangaTable.COL_CHAPTER_FLAGS to manga.chapter_flags,
|
||||
MangaTable.COL_VIEWER to manga.viewer_flags
|
||||
MangaTable.COL_VIEWER to manga.viewer_flags,
|
||||
)
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class MangaThumbnailPutResolver : PutResolver<Manga>() {
|
||||
.build()
|
||||
|
||||
fun mapToContentValues(manga: Manga) = contentValuesOf(
|
||||
MangaTable.COL_THUMBNAIL_URL to manga.thumbnail_url
|
||||
MangaTable.COL_THUMBNAIL_URL to manga.thumbnail_url,
|
||||
)
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class MangaTitlePutResolver : PutResolver<Manga>() {
|
||||
|
||||
fun mapToContentValues(manga: Manga) =
|
||||
contentValuesOf(
|
||||
MangaTable.COL_TITLE to manga.title
|
||||
MangaTable.COL_TITLE to manga.title,
|
||||
)
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ class MangaUrlPutResolver : PutResolver<Manga>() {
|
||||
.build()
|
||||
|
||||
fun mapToContentValues(manga: Manga) = contentValuesOf(
|
||||
MangaTable.COL_URL to manga.url
|
||||
MangaTable.COL_URL to manga.url,
|
||||
)
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class DownloadCache(
|
||||
private val context: Context,
|
||||
private val provider: DownloadProvider,
|
||||
private val sourceManager: SourceManager,
|
||||
private val preferences: PreferencesHelper = Injekt.get()
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
) {
|
||||
|
||||
/**
|
||||
@ -251,7 +251,7 @@ class DownloadCache(
|
||||
*/
|
||||
private class RootDirectory(
|
||||
val dir: UniFile,
|
||||
var files: Map<Long, SourceDirectory> = hashMapOf()
|
||||
var files: Map<Long, SourceDirectory> = hashMapOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
@ -259,7 +259,7 @@ class DownloadCache(
|
||||
*/
|
||||
private class SourceDirectory(
|
||||
val dir: UniFile,
|
||||
var files: Map<String, MangaDirectory> = hashMapOf()
|
||||
var files: Map<String, MangaDirectory> = hashMapOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
@ -267,7 +267,7 @@ class DownloadCache(
|
||||
*/
|
||||
private class MangaDirectory(
|
||||
val dir: UniFile,
|
||||
var files: Set<String> = hashSetOf()
|
||||
var files: Set<String> = hashSetOf(),
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ import uy.kohesive.injekt.injectLazy
|
||||
*/
|
||||
class DownloadManager(
|
||||
private val context: Context,
|
||||
private val db: DatabaseHelper = Injekt.get()
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
) {
|
||||
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
|
@ -93,14 +93,14 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
addAction(
|
||||
R.drawable.ic_pause_24dp,
|
||||
context.getString(R.string.action_pause),
|
||||
NotificationReceiver.pauseDownloadsPendingBroadcast(context)
|
||||
NotificationReceiver.pauseDownloadsPendingBroadcast(context),
|
||||
)
|
||||
}
|
||||
|
||||
val downloadingProgressText = context.getString(
|
||||
R.string.chapter_downloading_progress,
|
||||
download.downloadedImages,
|
||||
download.pages!!.size
|
||||
download.pages!!.size,
|
||||
)
|
||||
|
||||
if (preferences.hideNotificationContent()) {
|
||||
@ -138,13 +138,13 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
addAction(
|
||||
R.drawable.ic_play_arrow_24dp,
|
||||
context.getString(R.string.action_resume),
|
||||
NotificationReceiver.resumeDownloadsPendingBroadcast(context)
|
||||
NotificationReceiver.resumeDownloadsPendingBroadcast(context),
|
||||
)
|
||||
// Clear action
|
||||
addAction(
|
||||
R.drawable.ic_close_24dp,
|
||||
context.getString(R.string.action_cancel_all),
|
||||
NotificationReceiver.clearDownloadsPendingBroadcast(context)
|
||||
NotificationReceiver.clearDownloadsPendingBroadcast(context),
|
||||
)
|
||||
|
||||
show(Notifications.ID_DOWNLOAD_CHAPTER_PROGRESS)
|
||||
@ -213,7 +213,7 @@ internal class DownloadNotifier(private val context: Context) {
|
||||
// Create notification
|
||||
with(errorNotificationBuilder) {
|
||||
setContentTitle(
|
||||
mangaTitle?.plus(": $chapter") ?: context.getString(R.string.download_notifier_downloader_title)
|
||||
mangaTitle?.plus(": $chapter") ?: context.getString(R.string.download_notifier_downloader_title),
|
||||
)
|
||||
setContentText(error ?: context.getString(R.string.download_notifier_unknown_error))
|
||||
setSmallIcon(R.drawable.ic_warning_white_24dp)
|
||||
|
@ -126,7 +126,7 @@ class DownloadPendingDeleter(context: Context) {
|
||||
@Serializable
|
||||
private data class Entry(
|
||||
val chapters: List<ChapterEntry>,
|
||||
val manga: MangaEntry
|
||||
val manga: MangaEntry,
|
||||
)
|
||||
|
||||
/**
|
||||
@ -137,7 +137,7 @@ class DownloadPendingDeleter(context: Context) {
|
||||
val id: Long,
|
||||
val url: String,
|
||||
val name: String,
|
||||
val scanlator: String? = null
|
||||
val scanlator: String? = null,
|
||||
)
|
||||
|
||||
/**
|
||||
@ -148,7 +148,7 @@ class DownloadPendingDeleter(context: Context) {
|
||||
val id: Long,
|
||||
val url: String,
|
||||
val title: String,
|
||||
val source: Long
|
||||
val source: Long,
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ class DownloadProvider(private val context: Context) {
|
||||
fun findUnmatchedChapterDirs(
|
||||
chapters: List<Chapter>,
|
||||
manga: Manga,
|
||||
source: Source
|
||||
source: Source,
|
||||
): List<UniFile> {
|
||||
val mangaDir = findMangaDir(manga, source) ?: return emptyList()
|
||||
return mangaDir.listFiles().orEmpty().asList().filter {
|
||||
@ -164,7 +164,7 @@ class DownloadProvider(private val context: Context) {
|
||||
when {
|
||||
chapter.scanlator != null -> "${chapter.scanlator}_${chapter.name}"
|
||||
else -> chapter.name
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ class DownloadProvider(private val context: Context) {
|
||||
"$chapterName.cbz",
|
||||
|
||||
// Legacy chapter directory name used in v0.9.2 and before
|
||||
DiskUtil.buildValidFilename(chapter.name)
|
||||
DiskUtil.buildValidFilename(chapter.name),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,9 @@ class DownloadService : Service() {
|
||||
*/
|
||||
private fun listenDownloaderState() {
|
||||
subscriptions += downloadManager.runningRelay
|
||||
.doOnError { /* Swallow wakelock error */ }
|
||||
.doOnError {
|
||||
/* Swallow wakelock error */
|
||||
}
|
||||
.subscribe { running ->
|
||||
if (running) {
|
||||
wakeLock.acquireIfNeeded()
|
||||
|
@ -20,7 +20,7 @@ import uy.kohesive.injekt.injectLazy
|
||||
*/
|
||||
class DownloadStore(
|
||||
context: Context,
|
||||
private val sourceManager: SourceManager
|
||||
private val sourceManager: SourceManager,
|
||||
) {
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ class Downloader(
|
||||
private val context: Context,
|
||||
private val provider: DownloadProvider,
|
||||
private val cache: DownloadCache,
|
||||
private val sourceManager: SourceManager
|
||||
private val sourceManager: SourceManager,
|
||||
) {
|
||||
|
||||
private val chapterCache: ChapterCache by injectLazy()
|
||||
@ -213,7 +213,7 @@ class Downloader(
|
||||
downloadChapter(download).subscribeOn(Schedulers.io())
|
||||
}
|
||||
},
|
||||
5
|
||||
5,
|
||||
)
|
||||
.onBackpressureLatest()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -225,7 +225,7 @@ class Downloader(
|
||||
DownloadService.stop(context)
|
||||
logcat(LogPriority.ERROR, error)
|
||||
notifier.onError(error.message)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@ -484,7 +484,7 @@ class Downloader(
|
||||
download: Download,
|
||||
mangaDir: UniFile,
|
||||
tmpDir: UniFile,
|
||||
dirname: String
|
||||
dirname: String,
|
||||
) {
|
||||
// Ensure that the chapter folder has all the images.
|
||||
val downloadedImages = tmpDir.listFiles().orEmpty().filterNot { it.name!!.endsWith(".tmp") }
|
||||
|
@ -11,7 +11,7 @@ import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
class DownloadQueue(
|
||||
private val store: DownloadStore,
|
||||
private val queue: MutableList<Download> = CopyOnWriteArrayList()
|
||||
private val queue: MutableList<Download> = CopyOnWriteArrayList(),
|
||||
) : List<Download> by queue {
|
||||
|
||||
private val statusSubject = PublishSubject.create<Download>()
|
||||
|
@ -22,7 +22,7 @@ class CustomMangaManager(val context: Context) {
|
||||
|
||||
val json = try {
|
||||
Json.decodeFromString<MangaList>(
|
||||
editJson.bufferedReader().use { it.readText() }
|
||||
editJson.bufferedReader().use { it.readText() },
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
@ -67,13 +67,13 @@ class CustomMangaManager(val context: Context) {
|
||||
artist,
|
||||
description,
|
||||
genre?.split(", "),
|
||||
status
|
||||
status,
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class MangaList(
|
||||
val mangas: List<MangaJson>? = null
|
||||
val mangas: List<MangaJson>? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@ -84,7 +84,7 @@ class CustomMangaManager(val context: Context) {
|
||||
val artist: String? = null,
|
||||
val description: String? = null,
|
||||
val genre: List<String>? = null,
|
||||
val status: Int? = null
|
||||
val status: Int? = null,
|
||||
) {
|
||||
|
||||
fun toManga() = MangaImpl().apply {
|
||||
|
@ -49,7 +49,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
||||
interval.toLong(),
|
||||
TimeUnit.HOURS,
|
||||
10,
|
||||
TimeUnit.MINUTES
|
||||
TimeUnit.MINUTES,
|
||||
)
|
||||
.addTag(TAG)
|
||||
.setConstraints(constraints)
|
||||
|
@ -87,7 +87,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
Notifications.ID_LIBRARY_PROGRESS,
|
||||
progressNotificationBuilder
|
||||
.setProgress(total, current, false)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
|
||||
setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri))
|
||||
}
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
setSmallIcon(R.drawable.ic_tachi)
|
||||
addAction(R.drawable.ic_help_24dp, context.getString(R.string.learn_more), NotificationHandler.openUrl(context, HELP_SKIPPED_URL))
|
||||
}
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
|
||||
@ -162,8 +162,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
NotificationCompat.BigTextStyle().bigText(
|
||||
updates.joinToString("\n") {
|
||||
it.first.title.chop(NOTIF_TITLE_MAX_LEN)
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
|
||||
setContentIntent(getNotificationIntent())
|
||||
setAutoCancel(true)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// Per-manga notification
|
||||
@ -223,8 +223,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
context,
|
||||
manga,
|
||||
chapters,
|
||||
Notifications.ID_NEW_CHAPTERS
|
||||
)
|
||||
Notifications.ID_NEW_CHAPTERS,
|
||||
),
|
||||
)
|
||||
// View chapters action
|
||||
addAction(
|
||||
@ -233,8 +233,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
NotificationReceiver.openChapterPendingActivity(
|
||||
context,
|
||||
manga,
|
||||
Notifications.ID_NEW_CHAPTERS
|
||||
)
|
||||
Notifications.ID_NEW_CHAPTERS,
|
||||
),
|
||||
)
|
||||
// Download chapters action
|
||||
// Only add the action when chapters is within threshold
|
||||
@ -246,8 +246,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
context,
|
||||
manga,
|
||||
chapters,
|
||||
Notifications.ID_NEW_CHAPTERS
|
||||
)
|
||||
Notifications.ID_NEW_CHAPTERS,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -274,7 +274,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
val formatter = DecimalFormat(
|
||||
"#.###",
|
||||
DecimalFormatSymbols()
|
||||
.apply { decimalSeparator = '.' }
|
||||
.apply { decimalSeparator = '.' },
|
||||
)
|
||||
|
||||
val displayableChapterNumbers = chapters
|
||||
|
@ -92,7 +92,7 @@ class LibraryUpdateService(
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
val downloadManager: DownloadManager = Injekt.get(),
|
||||
val trackManager: TrackManager = Injekt.get(),
|
||||
val coverCache: CoverCache = Injekt.get()
|
||||
val coverCache: CoverCache = Injekt.get(),
|
||||
) : Service() {
|
||||
|
||||
private lateinit var wakeLock: PowerManager.WakeLock
|
||||
@ -420,7 +420,7 @@ class LibraryUpdateService(
|
||||
// Convert to the manga that contains new chapters
|
||||
newUpdates.add(
|
||||
manga to newChapters.sortedByDescending { ch -> ch.source_order }
|
||||
.toTypedArray()
|
||||
.toTypedArray(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -646,7 +646,7 @@ class LibraryUpdateService(
|
||||
notifier.showProgressNotification(
|
||||
updatingManga,
|
||||
completed.get(),
|
||||
mangaToUpdate.size
|
||||
mangaToUpdate.size,
|
||||
)
|
||||
|
||||
block(manga)
|
||||
@ -660,7 +660,7 @@ class LibraryUpdateService(
|
||||
notifier.showProgressNotification(
|
||||
updatingManga,
|
||||
completed.get(),
|
||||
mangaToUpdate.size
|
||||
mangaToUpdate.size,
|
||||
)
|
||||
}
|
||||
|
||||
@ -693,7 +693,7 @@ class LibraryUpdateService(
|
||||
dbManga = Manga.create(
|
||||
networkManga.url,
|
||||
networkManga.title,
|
||||
mangaDex.id
|
||||
mangaDex.id,
|
||||
)
|
||||
dbManga.date_added = System.currentTimeMillis()
|
||||
}
|
||||
|
@ -59,14 +59,14 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||
shareImage(
|
||||
context,
|
||||
intent.getStringExtra(EXTRA_FILE_LOCATION)!!,
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||
)
|
||||
// Delete image from path and dismiss notification
|
||||
ACTION_DELETE_IMAGE ->
|
||||
deleteImage(
|
||||
context,
|
||||
intent.getStringExtra(EXTRA_FILE_LOCATION)!!,
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||
)
|
||||
// Share backup file
|
||||
ACTION_SHARE_BACKUP ->
|
||||
@ -74,11 +74,11 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||
context,
|
||||
intent.getParcelableExtra(EXTRA_URI)!!,
|
||||
"application/x-protobuf+gzip",
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||
)
|
||||
ACTION_CANCEL_RESTORE -> cancelRestore(
|
||||
context,
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||
)
|
||||
// Cancel library update and dismiss notification
|
||||
ACTION_CANCEL_LIBRARY_UPDATE -> cancelLibraryUpdate(context, Notifications.ID_LIBRARY_PROGRESS)
|
||||
@ -87,7 +87,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||
openChapter(
|
||||
context,
|
||||
intent.getLongExtra(EXTRA_MANGA_ID, -1),
|
||||
intent.getLongExtra(EXTRA_CHAPTER_ID, -1)
|
||||
intent.getLongExtra(EXTRA_CHAPTER_ID, -1),
|
||||
)
|
||||
}
|
||||
// Mark updated manga chapters as read
|
||||
@ -120,7 +120,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||
context,
|
||||
intent.getParcelableExtra(EXTRA_URI)!!,
|
||||
"text/plain",
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
|
||||
intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -461,7 +461,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||
context: Context,
|
||||
manga: Manga,
|
||||
chapters: Array<Chapter>,
|
||||
groupId: Int
|
||||
groupId: Int,
|
||||
): PendingIntent {
|
||||
val newIntent = Intent(context, NotificationReceiver::class.java).apply {
|
||||
action = ACTION_MARK_AS_READ
|
||||
@ -483,7 +483,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
||||
context: Context,
|
||||
manga: Manga,
|
||||
chapters: Array<Chapter>,
|
||||
groupId: Int
|
||||
groupId: Int,
|
||||
): PendingIntent {
|
||||
val newIntent = Intent(context, NotificationReceiver::class.java).apply {
|
||||
action = ACTION_DOWNLOAD_CHAPTER
|
||||
|
@ -116,7 +116,7 @@ object Notifications {
|
||||
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
|
||||
setName(context.getString(R.string.label_recent_updates))
|
||||
},
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
notificationService.createNotificationChannelsCompat(
|
||||
@ -182,7 +182,7 @@ object Notifications {
|
||||
setGroup(GROUP_APK_UPDATES)
|
||||
setName(context.getString(R.string.channel_ext_updates))
|
||||
},
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,13 @@ class PreferencesHelper(val context: Context) {
|
||||
private val defaultDownloadsDir = File(
|
||||
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
||||
context.getString(R.string.app_name),
|
||||
"downloads"
|
||||
"downloads",
|
||||
).toUri()
|
||||
|
||||
private val defaultBackupDir = File(
|
||||
Environment.getExternalStorageDirectory().absolutePath + File.separator +
|
||||
context.getString(R.string.app_name),
|
||||
"backup"
|
||||
"backup",
|
||||
).toUri()
|
||||
|
||||
fun startScreen() = prefs.getInt(Keys.startScreen, 1)
|
||||
@ -70,12 +70,12 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun themeMode() = flowPrefs.getEnum(
|
||||
"pref_theme_mode_key",
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light }
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light },
|
||||
)
|
||||
|
||||
fun appTheme() = flowPrefs.getEnum(
|
||||
"pref_app_theme",
|
||||
if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT }
|
||||
if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT },
|
||||
)
|
||||
|
||||
fun themeDarkAmoled() = flowPrefs.getBoolean("pref_theme_dark_amoled_key", false)
|
||||
@ -327,7 +327,7 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun extensionInstaller() = flowPrefs.getEnum(
|
||||
"extension_installer",
|
||||
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER
|
||||
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER,
|
||||
)
|
||||
|
||||
fun verboseLogging() = prefs.getBoolean(Keys.verboseLogging, false)
|
||||
@ -431,12 +431,12 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun exhSettingsLanguages() = flowPrefs.getString(
|
||||
"eh_settings_languages",
|
||||
"false*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false"
|
||||
"false*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false\nfalse*false*false",
|
||||
)
|
||||
|
||||
fun exhEnabledCategories() = flowPrefs.getString(
|
||||
"eh_enabled_categories",
|
||||
"false,false,false,false,false,false,false,false,false,false"
|
||||
"false,false,false,false,false,false,false,false,false,false",
|
||||
)
|
||||
|
||||
fun feedTabInFront() = flowPrefs.getBoolean("latest_tab_position", false)
|
||||
|
@ -20,7 +20,7 @@ import java.io.File
|
||||
import java.io.InputStream
|
||||
|
||||
class ImageSaver(
|
||||
val context: Context
|
||||
val context: Context,
|
||||
) {
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
@ -47,13 +47,13 @@ class ImageSaver(
|
||||
put(
|
||||
MediaStore.Images.Media.RELATIVE_PATH,
|
||||
"${Environment.DIRECTORY_PICTURES}/${context.getString(R.string.app_name)}/" +
|
||||
(image.location as Location.Pictures).relativePath
|
||||
(image.location as Location.Pictures).relativePath,
|
||||
)
|
||||
}
|
||||
|
||||
val picture = context.contentResolver.insert(
|
||||
pictureDir,
|
||||
contentValues
|
||||
contentValues,
|
||||
) ?: throw IOException("Couldn't create file")
|
||||
|
||||
data().use { input ->
|
||||
@ -83,18 +83,18 @@ class ImageSaver(
|
||||
|
||||
sealed class Image(
|
||||
open val name: String,
|
||||
open val location: Location
|
||||
open val location: Location,
|
||||
) {
|
||||
data class Cover(
|
||||
val bitmap: Bitmap,
|
||||
override val name: String,
|
||||
override val location: Location
|
||||
override val location: Location,
|
||||
) : Image(name, location)
|
||||
|
||||
data class Page(
|
||||
val inputStream: () -> InputStream,
|
||||
override val name: String,
|
||||
override val location: Location
|
||||
override val location: Location,
|
||||
) : Image(name, location)
|
||||
|
||||
val data: () -> InputStream
|
||||
@ -129,12 +129,12 @@ sealed class Location {
|
||||
is Pictures -> {
|
||||
val file = File(
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
|
||||
context.getString(R.string.app_name)
|
||||
context.getString(R.string.app_name),
|
||||
)
|
||||
if (relativePath.isNotEmpty()) {
|
||||
return File(
|
||||
file,
|
||||
relativePath
|
||||
relativePath,
|
||||
)
|
||||
}
|
||||
file
|
||||
|
@ -63,7 +63,7 @@ class TrackManager(context: Context) {
|
||||
context.getString(R.string.plan_to_read) to PLAN_TO_READ,
|
||||
context.getString(R.string.paused) to PAUSED,
|
||||
context.getString(R.string.completed) to COMPLETED,
|
||||
context.getString(R.string.dropped) to DROPPED
|
||||
context.getString(R.string.dropped) to DROPPED,
|
||||
)
|
||||
}
|
||||
// SY <--
|
||||
|
@ -43,7 +43,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
| status
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
putJsonObject("variables") {
|
||||
@ -55,8 +56,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
authClient.newCall(
|
||||
POST(
|
||||
apiUrl,
|
||||
body = payload.toString().toRequestBody(jsonMime)
|
||||
)
|
||||
body = payload.toString().toRequestBody(jsonMime),
|
||||
),
|
||||
)
|
||||
.await()
|
||||
.parseAs<JsonObject>()
|
||||
@ -84,7 +85,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
|progress
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
putJsonObject("variables") {
|
||||
@ -127,7 +129,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
|}
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
putJsonObject("variables") {
|
||||
@ -137,8 +140,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
authClient.newCall(
|
||||
POST(
|
||||
apiUrl,
|
||||
body = payload.toString().toRequestBody(jsonMime)
|
||||
)
|
||||
body = payload.toString().toRequestBody(jsonMime),
|
||||
),
|
||||
)
|
||||
.await()
|
||||
.parseAs<JsonObject>()
|
||||
@ -193,7 +196,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
|}
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
putJsonObject("variables") {
|
||||
@ -204,8 +208,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
authClient.newCall(
|
||||
POST(
|
||||
apiUrl,
|
||||
body = payload.toString().toRequestBody(jsonMime)
|
||||
)
|
||||
body = payload.toString().toRequestBody(jsonMime),
|
||||
),
|
||||
)
|
||||
.await()
|
||||
.parseAs<JsonObject>()
|
||||
@ -238,15 +242,16 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
|}
|
||||
|}
|
||||
|}
|
||||
|""".trimMargin()
|
||||
|
|
||||
""".trimMargin()
|
||||
val payload = buildJsonObject {
|
||||
put("query", query)
|
||||
}
|
||||
authClient.newCall(
|
||||
POST(
|
||||
apiUrl,
|
||||
body = payload.toString().toRequestBody(jsonMime)
|
||||
)
|
||||
body = payload.toString().toRequestBody(jsonMime),
|
||||
),
|
||||
)
|
||||
.await()
|
||||
.parseAs<JsonObject>()
|
||||
@ -255,7 +260,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
val viewer = data["Viewer"]!!.jsonObject
|
||||
Pair(
|
||||
viewer["id"]!!.jsonPrimitive.int,
|
||||
viewer["mediaListOptions"]!!.jsonObject["scoreFormat"]!!.jsonPrimitive.content
|
||||
viewer["mediaListOptions"]!!.jsonObject["scoreFormat"]!!.jsonPrimitive.content,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -270,7 +275,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
struct["format"]!!.jsonPrimitive.content.replace("_", "-"),
|
||||
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
|
||||
parseDate(struct, "startDate"),
|
||||
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0
|
||||
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0,
|
||||
)
|
||||
}
|
||||
|
||||
@ -282,7 +287,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
struct["progress"]!!.jsonPrimitive.int,
|
||||
parseDate(struct, "startedAt"),
|
||||
parseDate(struct, "completedAt"),
|
||||
jsonToALManga(struct["media"]!!.jsonObject)
|
||||
jsonToALManga(struct["media"]!!.jsonObject),
|
||||
)
|
||||
}
|
||||
|
||||
@ -292,7 +297,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
date.set(
|
||||
struct[dateKey]!!.jsonObject["year"]!!.jsonPrimitive.int,
|
||||
struct[dateKey]!!.jsonObject["month"]!!.jsonPrimitive.int - 1,
|
||||
struct[dateKey]!!.jsonObject["day"]!!.jsonPrimitive.int
|
||||
struct[dateKey]!!.jsonObject["day"]!!.jsonPrimitive.int,
|
||||
)
|
||||
date.timeInMillis
|
||||
} catch (_: Exception) {
|
||||
|
@ -16,7 +16,7 @@ data class ALManga(
|
||||
val format: String,
|
||||
val publishing_status: String,
|
||||
val start_date_fuzzy: Long,
|
||||
val total_chapters: Int
|
||||
val total_chapters: Int,
|
||||
) {
|
||||
|
||||
fun toTrack() = TrackSearch.create(TrackManager.ANILIST).apply {
|
||||
@ -46,7 +46,7 @@ data class ALUserManga(
|
||||
val chapters_read: Int,
|
||||
val start_date_fuzzy: Long,
|
||||
val completed_date_fuzzy: Long,
|
||||
val manga: ALManga
|
||||
val manga: ALManga,
|
||||
) {
|
||||
|
||||
fun toTrack() = Track.create(TrackManager.ANILIST).apply {
|
||||
|
@ -7,7 +7,7 @@ data class OAuth(
|
||||
val access_token: String,
|
||||
val token_type: String,
|
||||
val expires: Long,
|
||||
val expires_in: Long
|
||||
val expires_in: Long,
|
||||
) {
|
||||
|
||||
fun isExpired() = System.currentTimeMillis() > expires
|
||||
|
@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
|
||||
data class Avatar(
|
||||
val large: String? = "",
|
||||
val medium: String? = "",
|
||||
val small: String? = ""
|
||||
val small: String? = "",
|
||||
)
|
||||
|
@ -61,8 +61,8 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
|
||||
authClient.newCall(
|
||||
POST(
|
||||
"$apiUrl/subject/${track.media_id}/update/watched_eps",
|
||||
body = body
|
||||
)
|
||||
body = body,
|
||||
),
|
||||
).await()
|
||||
|
||||
track
|
||||
@ -168,7 +168,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
|
||||
.add("client_secret", clientSecret)
|
||||
.add("code", code)
|
||||
.add("redirect_uri", redirectUrl)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
|
||||
companion object {
|
||||
@ -201,7 +201,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
|
||||
.add("client_secret", clientSecret)
|
||||
.add("refresh_token", token)
|
||||
.add("redirect_uri", redirectUrl)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
|
||||
.header("User-Agent", "Tachiyomi")
|
||||
.url(
|
||||
originalRequest.url.newBuilder()
|
||||
.addQueryParameter("access_token", currAuth.access_token).build()
|
||||
.addQueryParameter("access_token", currAuth.access_token).build(),
|
||||
)
|
||||
.build() else originalRequest.newBuilder()
|
||||
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
|
||||
@ -51,7 +51,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
|
||||
System.currentTimeMillis() / 1000,
|
||||
oauth.expires_in,
|
||||
oauth.refresh_token,
|
||||
this.oauth?.user_id
|
||||
this.oauth?.user_id,
|
||||
)
|
||||
|
||||
bangumi.saveToken(oauth)
|
||||
|
@ -12,5 +12,5 @@ data class Collection(
|
||||
val status: Status? = Status(),
|
||||
val tag: List<String?>? = listOf(),
|
||||
val user: User? = User(),
|
||||
val vol_status: Int? = 0
|
||||
val vol_status: Int? = 0,
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ data class OAuth(
|
||||
val created_at: Long = System.currentTimeMillis() / 1000,
|
||||
val expires_in: Long,
|
||||
val refresh_token: String?,
|
||||
val user_id: Long?
|
||||
val user_id: Long?,
|
||||
) {
|
||||
|
||||
// Access token refresh before expired
|
||||
|
@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
|
||||
data class Status(
|
||||
val id: Int? = 0,
|
||||
val name: String? = "",
|
||||
val type: String? = ""
|
||||
val type: String? = "",
|
||||
)
|
||||
|
@ -10,5 +10,5 @@ data class User(
|
||||
val sign: String? = "",
|
||||
val url: String? = "",
|
||||
val usergroup: Int? = 0,
|
||||
val username: String? = ""
|
||||
val username: String? = "",
|
||||
)
|
||||
|
@ -62,10 +62,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||
"${baseUrl}library-entries",
|
||||
headers = headersOf(
|
||||
"Content-Type",
|
||||
"application/vnd.api+json"
|
||||
"application/vnd.api+json",
|
||||
),
|
||||
body = data.toString().toRequestBody("application/vnd.api+json".toMediaType()),
|
||||
),
|
||||
body = data.toString().toRequestBody("application/vnd.api+json".toMediaType())
|
||||
)
|
||||
)
|
||||
.await()
|
||||
.parseAs<JsonObject>()
|
||||
@ -98,11 +98,11 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||
.headers(
|
||||
headersOf(
|
||||
"Content-Type",
|
||||
"application/vnd.api+json"
|
||||
)
|
||||
"application/vnd.api+json",
|
||||
),
|
||||
)
|
||||
.patch(data.toString().toRequestBody("application/vnd.api+json".toMediaType()))
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.await()
|
||||
.parseAs<JsonObject>()
|
||||
@ -139,8 +139,8 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||
"X-Algolia-API-Key",
|
||||
key,
|
||||
),
|
||||
body = jsonObject.toString().toRequestBody(jsonMime)
|
||||
)
|
||||
body = jsonObject.toString().toRequestBody(jsonMime),
|
||||
),
|
||||
)
|
||||
.await()
|
||||
.parseAs<JsonObject>()
|
||||
@ -252,7 +252,7 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||
.add("refresh_token", token)
|
||||
.add("client_id", clientId)
|
||||
.add("client_secret", clientSecret)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ data class OAuth(
|
||||
val token_type: String,
|
||||
val created_at: Long,
|
||||
val expires_in: Long,
|
||||
val refresh_token: String?
|
||||
val refresh_token: String?,
|
||||
) {
|
||||
|
||||
fun isExpired() = (System.currentTimeMillis() / 1000) > (created_at + expires_in - 3600)
|
||||
|
@ -72,7 +72,7 @@ class KomgaApi(private val client: OkHttpClient) {
|
||||
Request.Builder()
|
||||
.url("${track.tracking_url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi")
|
||||
.put(payload.toRequestBody("application/json".toMediaType()))
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.await()
|
||||
return getTrackSearch(track.tracking_url)
|
||||
|
@ -15,7 +15,7 @@ data class SeriesDto(
|
||||
val booksUnreadCount: Int,
|
||||
val booksInProgressCount: Int,
|
||||
val metadata: SeriesMetadataDto,
|
||||
val booksMetadata: BookMetadataAggregationDto
|
||||
val booksMetadata: BookMetadataAggregationDto,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@ -38,7 +38,7 @@ data class SeriesMetadataDto(
|
||||
val genres: Set<String>,
|
||||
val genresLock: Boolean,
|
||||
val tags: Set<String>,
|
||||
val tagsLock: Boolean
|
||||
val tagsLock: Boolean,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@ -49,13 +49,13 @@ data class BookMetadataAggregationDto(
|
||||
val summaryNumber: String,
|
||||
|
||||
val created: String,
|
||||
val lastModified: String
|
||||
val lastModified: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class AuthorDto(
|
||||
val name: String,
|
||||
val role: String
|
||||
val role: String,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@ -75,7 +75,7 @@ data class ReadListDto(
|
||||
val bookIds: List<String>,
|
||||
val createdDate: String,
|
||||
val lastModifiedDate: String,
|
||||
val filtered: Boolean
|
||||
val filtered: Boolean,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
@ -103,7 +103,7 @@ class MdList(private val context: Context, id: Int) : TrackService(id) {
|
||||
FollowStatus.READING.int
|
||||
} else FollowStatus.PLAN_TO_READ.int
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
override suspend fun refresh(track: Track): Track {
|
||||
|
@ -165,7 +165,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
|
||||
.filter {
|
||||
it.jsonObject["node"]!!.jsonObject["title"]!!.jsonPrimitive.content.contains(
|
||||
query,
|
||||
ignoreCase = true
|
||||
ignoreCase = true,
|
||||
)
|
||||
}
|
||||
.map {
|
||||
|
@ -8,7 +8,7 @@ data class OAuth(
|
||||
val access_token: String,
|
||||
val token_type: String,
|
||||
val created_at: Long = System.currentTimeMillis(),
|
||||
val expires_in: Long
|
||||
val expires_in: Long,
|
||||
) {
|
||||
|
||||
fun isExpired() = System.currentTimeMillis() > created_at + (expires_in * 1000)
|
||||
|
@ -8,7 +8,7 @@ data class OAuth(
|
||||
val token_type: String,
|
||||
val created_at: Long,
|
||||
val expires_in: Long,
|
||||
val refresh_token: String?
|
||||
val refresh_token: String?,
|
||||
) {
|
||||
|
||||
// Access token lives 1 day
|
||||
|
@ -44,8 +44,8 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
|
||||
authClient.newCall(
|
||||
POST(
|
||||
"$apiUrl/v2/user_rates",
|
||||
body = payload.toString().toRequestBody(jsonMime)
|
||||
)
|
||||
body = payload.toString().toRequestBody(jsonMime),
|
||||
),
|
||||
).await()
|
||||
track
|
||||
}
|
||||
@ -153,7 +153,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
|
||||
.add("client_secret", clientSecret)
|
||||
.add("code", code)
|
||||
.add("redirect_uri", redirectUrl)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
|
||||
companion object {
|
||||
@ -186,7 +186,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
|
||||
.add("client_id", clientId)
|
||||
.add("client_secret", clientSecret)
|
||||
.add("refresh_token", token)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user