mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-13 20:48:56 +01:00
Formatting
This commit is contained in:
@@ -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) {
|
||||
@@ -144,7 +144,7 @@ class BackupNotifier(private val context: Context) {
|
||||
addAction(
|
||||
R.drawable.ic_folder_24dp,
|
||||
context.getString(R.string.action_show_errors),
|
||||
errorLogIntent
|
||||
errorLogIntent,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||
backupManga(databaseManga, flags),
|
||||
backupCategories(),
|
||||
emptyList(),
|
||||
backupExtensionInfo(databaseManga)
|
||||
backupExtensionInfo(databaseManga),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class BackupCategory(
|
||||
return BackupCategory(
|
||||
name = category.name,
|
||||
order = category.order,
|
||||
flags = category.flags
|
||||
flags = category.flags,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ data class BackupManga(
|
||||
dateAdded = manga.date_added,
|
||||
viewer = manga.readingModeType,
|
||||
viewer_flags = manga.viewer_flags,
|
||||
chapterFlags = manga.chapter_flags
|
||||
chapterFlags = manga.chapter_flags,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ data class BackupSource(
|
||||
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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class ChapterCache(private val context: Context) {
|
||||
File(context.cacheDir, PARAMETER_CACHE_DIRECTORY),
|
||||
PARAMETER_APP_VERSION,
|
||||
PARAMETER_VALUE_COUNT,
|
||||
PARAMETER_CACHE_SIZE
|
||||
PARAMETER_CACHE_SIZE,
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) {
|
||||
// Fix kissmanga covers after supporting cloudflare
|
||||
db.execSQL(
|
||||
"""UPDATE mangas SET thumbnail_url =
|
||||
REPLACE(thumbnail_url, '93.174.95.110', 'kissmanga.com') WHERE source = 4"""
|
||||
REPLACE(thumbnail_url, '93.174.95.110', 'kissmanga.com') WHERE source = 4""",
|
||||
)
|
||||
}
|
||||
if (oldVersion < 3) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import eu.kanade.tachiyomi.data.database.tables.CategoryTable.TABLE
|
||||
class CategoryTypeMapping : SQLiteTypeMapping<Category>(
|
||||
CategoryPutResolver(),
|
||||
CategoryGetResolver(),
|
||||
CategoryDeleteResolver()
|
||||
CategoryDeleteResolver(),
|
||||
)
|
||||
|
||||
class CategoryPutResolver : DefaultPutResolver<Category>() {
|
||||
@@ -40,7 +40,7 @@ class CategoryPutResolver : DefaultPutResolver<Category>() {
|
||||
COL_ID to obj.id,
|
||||
COL_NAME to obj.name,
|
||||
COL_ORDER to obj.order,
|
||||
COL_FLAGS to obj.flags
|
||||
COL_FLAGS to obj.flags,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable.TABLE
|
||||
class MangaTypeMapping : SQLiteTypeMapping<Manga>(
|
||||
MangaPutResolver(),
|
||||
MangaGetResolver(),
|
||||
MangaDeleteResolver()
|
||||
MangaDeleteResolver(),
|
||||
)
|
||||
|
||||
class MangaPutResolver : DefaultPutResolver<Manga>() {
|
||||
@@ -66,7 +66,7 @@ class MangaPutResolver : DefaultPutResolver<Manga>() {
|
||||
COL_VIEWER to obj.viewer_flags,
|
||||
COL_CHAPTER_FLAGS to obj.chapter_flags,
|
||||
COL_COVER_LAST_MODIFIED to obj.cover_last_modified,
|
||||
COL_DATE_ADDED to obj.date_added
|
||||
COL_DATE_ADDED to obj.date_added,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,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()
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_MANGA_ID} = ?")
|
||||
.whereArgs(manga.id)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -34,7 +34,7 @@ interface ChapterQueries : DbProvider {
|
||||
.query(getRecentsQuery())
|
||||
.args(date.time)
|
||||
.observesTables(ChapterTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.withGetResolver(MangaChapterGetResolver.INSTANCE)
|
||||
.prepare()
|
||||
@@ -46,7 +46,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_ID} = ?")
|
||||
.whereArgs(id)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -57,7 +57,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_URL} = ?")
|
||||
.whereArgs(url)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -68,7 +68,7 @@ interface ChapterQueries : DbProvider {
|
||||
.table(ChapterTable.TABLE)
|
||||
.where("${ChapterTable.COL_URL} = ? AND ${ChapterTable.COL_MANGA_ID} = ?")
|
||||
.whereArgs(url, mangaId)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ interface HistoryQueries : DbProvider {
|
||||
.query(getRecentMangasQuery(search))
|
||||
.args(date.time, limit, offset)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.withGetResolver(MangaChapterHistoryGetResolver.INSTANCE)
|
||||
.prepare()
|
||||
@@ -44,7 +44,7 @@ interface HistoryQueries : DbProvider {
|
||||
.query(getHistoryByMangaId())
|
||||
.args(mangaId)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -55,7 +55,7 @@ interface HistoryQueries : DbProvider {
|
||||
.query(getHistoryByChapterUrl())
|
||||
.args(chapterUrl)
|
||||
.observesTables(HistoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -83,7 +83,7 @@ interface HistoryQueries : DbProvider {
|
||||
.byQuery(
|
||||
DeleteQuery.builder()
|
||||
.table(HistoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -93,7 +93,7 @@ interface HistoryQueries : DbProvider {
|
||||
.table(HistoryTable.TABLE)
|
||||
.where("${HistoryTable.COL_LAST_READ} = ?")
|
||||
.whereArgs(0)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(libraryQuery)
|
||||
.observesTables(MangaTable.TABLE, ChapterTable.TABLE, MangaCategoryTable.TABLE, CategoryTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.withGetResolver(LibraryMangaGetResolver.INSTANCE)
|
||||
.prepare()
|
||||
@@ -42,10 +42,10 @@ interface MangaQueries : DbProvider {
|
||||
.where("${MangaTable.COL_FAVORITE} = 1 AND LOWER(${MangaTable.COL_TITLE}) = ? AND ${MangaTable.COL_SOURCE} != ?")
|
||||
.whereArgs(
|
||||
manga.title.lowercase(),
|
||||
manga.source
|
||||
manga.source,
|
||||
)
|
||||
.limit(1)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -72,7 +72,7 @@ interface MangaQueries : DbProvider {
|
||||
.table(MangaTable.TABLE)
|
||||
.where("${MangaTable.COL_URL} = ? AND ${MangaTable.COL_SOURCE} = ?")
|
||||
.whereArgs(url, sourceId)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -83,7 +83,7 @@ interface MangaQueries : DbProvider {
|
||||
.table(MangaTable.TABLE)
|
||||
.where("${MangaTable.COL_ID} = ?")
|
||||
.whereArgs(id)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -93,7 +93,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getSourceIdsWithNonLibraryMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.withGetResolver(SourceIdMangaCountGetResolver.INSTANCE)
|
||||
.prepare()
|
||||
@@ -152,7 +152,7 @@ interface MangaQueries : DbProvider {
|
||||
.table(MangaTable.TABLE)
|
||||
.where("${MangaTable.COL_FAVORITE} = ? AND ${MangaTable.COL_SOURCE} IN (${Queries.placeholders(sourceIds.size)})")
|
||||
.whereArgs(0, *sourceIds.toTypedArray())
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -160,7 +160,7 @@ interface MangaQueries : DbProvider {
|
||||
.byQuery(
|
||||
DeleteQuery.builder()
|
||||
.table(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -170,7 +170,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getLastReadMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -180,7 +180,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getTotalChapterMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -190,7 +190,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getLatestChapterMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
|
||||
@@ -200,7 +200,7 @@ interface MangaQueries : DbProvider {
|
||||
RawQuery.builder()
|
||||
.query(getChapterFetchDateMangaQuery())
|
||||
.observesTables(MangaTable.TABLE)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
.prepare()
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ class MangaFavoritePutResolver : PutResolver<Manga>() {
|
||||
|
||||
fun mapToContentValues(manga: Manga) =
|
||||
contentValuesOf(
|
||||
MangaTable.COL_FAVORITE to manga.favorite
|
||||
MangaTable.COL_FAVORITE to manga.favorite,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -138,7 +138,7 @@ class DownloadProvider(private val context: Context) {
|
||||
when {
|
||||
chapter.scanlator != null -> "${chapter.scanlator}_${chapter.name}"
|
||||
else -> chapter.name
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -157,7 +157,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),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ class Downloader(
|
||||
downloadChapter(download).subscribeOn(Schedulers.io())
|
||||
}
|
||||
},
|
||||
5
|
||||
5,
|
||||
)
|
||||
.onBackpressureLatest()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -223,7 +223,7 @@ class Downloader(
|
||||
DownloadService.stop(context)
|
||||
logcat(LogPriority.ERROR, error)
|
||||
notifier.onError(error.message)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -86,7 +86,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
Notifications.ID_LIBRARY_PROGRESS,
|
||||
progressNotificationBuilder
|
||||
.setProgress(total, current, false)
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
|
||||
setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri))
|
||||
}
|
||||
.build()
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -131,7 +131,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(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -161,8 +161,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
NotificationCompat.BigTextStyle().bigText(
|
||||
updates.joinToString("\n") {
|
||||
it.first.title.chop(NOTIF_TITLE_MAX_LEN)
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
|
||||
setContentIntent(getNotificationIntent())
|
||||
setAutoCancel(true)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// Per-manga notification
|
||||
@@ -222,8 +222,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
context,
|
||||
manga,
|
||||
chapters,
|
||||
Notifications.ID_NEW_CHAPTERS
|
||||
)
|
||||
Notifications.ID_NEW_CHAPTERS,
|
||||
),
|
||||
)
|
||||
// View chapters action
|
||||
addAction(
|
||||
@@ -232,8 +232,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
|
||||
@@ -245,8 +245,8 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
context,
|
||||
manga,
|
||||
chapters,
|
||||
Notifications.ID_NEW_CHAPTERS
|
||||
)
|
||||
Notifications.ID_NEW_CHAPTERS,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -273,7 +273,7 @@ class LibraryUpdateNotifier(private val context: Context) {
|
||||
val formatter = DecimalFormat(
|
||||
"#.###",
|
||||
DecimalFormatSymbols()
|
||||
.apply { decimalSeparator = '.' }
|
||||
.apply { decimalSeparator = '.' },
|
||||
)
|
||||
|
||||
val displayableChapterNumbers = chapters
|
||||
|
||||
@@ -310,7 +310,7 @@ class LibraryUpdateService(
|
||||
withUpdateNotification(
|
||||
currentlyUpdatingManga,
|
||||
progressCount,
|
||||
manga
|
||||
manga,
|
||||
) { manga ->
|
||||
try {
|
||||
when {
|
||||
@@ -336,7 +336,7 @@ class LibraryUpdateService(
|
||||
// Convert to the manga that contains new chapters
|
||||
newUpdates.add(
|
||||
manga to newChapters.sortedByDescending { ch -> ch.source_order }
|
||||
.toTypedArray()
|
||||
.toTypedArray(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -383,7 +383,7 @@ class LibraryUpdateService(
|
||||
val errorFile = writeErrorFile(failedUpdates)
|
||||
notifier.showUpdateErrorNotification(
|
||||
failedUpdates.size,
|
||||
errorFile.getUriCompat(this)
|
||||
errorFile.getUriCompat(this),
|
||||
)
|
||||
}
|
||||
if (skippedUpdates.isNotEmpty()) {
|
||||
@@ -446,7 +446,7 @@ class LibraryUpdateService(
|
||||
withUpdateNotification(
|
||||
currentlyUpdatingManga,
|
||||
progressCount,
|
||||
manga
|
||||
manga,
|
||||
) { manga ->
|
||||
sourceManager.get(manga.source)?.let { source ->
|
||||
try {
|
||||
@@ -536,7 +536,7 @@ class LibraryUpdateService(
|
||||
notifier.showProgressNotification(
|
||||
updatingManga,
|
||||
completed.get(),
|
||||
mangaToUpdate.size
|
||||
mangaToUpdate.size,
|
||||
)
|
||||
|
||||
block(manga)
|
||||
@@ -550,7 +550,7 @@ class LibraryUpdateService(
|
||||
notifier.showProgressNotification(
|
||||
updatingManga,
|
||||
completed.get(),
|
||||
mangaToUpdate.size
|
||||
mangaToUpdate.size,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ object Notifications {
|
||||
"backup_restore_complete_channel",
|
||||
"library_channel",
|
||||
"library_progress_channel",
|
||||
"updates_ext_channel"
|
||||
"updates_ext_channel",
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -115,8 +115,8 @@ object Notifications {
|
||||
},
|
||||
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
|
||||
setName(context.getString(R.string.label_recent_updates))
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
notificationService.createNotificationChannelsCompat(
|
||||
@@ -181,8 +181,8 @@ object Notifications {
|
||||
buildNotificationChannel(CHANNEL_EXTENSIONS_UPDATE, IMPORTANCE_DEFAULT) {
|
||||
setGroup(GROUP_APK_UPDATES)
|
||||
setName(context.getString(R.string.channel_ext_updates))
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,13 +34,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)
|
||||
@@ -67,12 +67,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)
|
||||
@@ -137,8 +137,6 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun webtoonSidePadding() = flowPrefs.getInt("webtoon_side_padding", 0)
|
||||
|
||||
fun readWithTapping() = flowPrefs.getBoolean("reader_tap", true)
|
||||
|
||||
fun pagerNavInverted() = flowPrefs.getEnum("reader_tapping_inverted", Values.TappingInvertMode.NONE)
|
||||
|
||||
fun webtoonNavInverted() = flowPrefs.getEnum("reader_tapping_inverted_webtoon", Values.TappingInvertMode.NONE)
|
||||
@@ -318,7 +316,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)
|
||||
|
||||
@@ -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 ->
|
||||
@@ -133,12 +133,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
|
||||
|
||||
@@ -56,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>()
|
||||
@@ -140,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>()
|
||||
@@ -208,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>()
|
||||
@@ -250,8 +250,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>()
|
||||
@@ -260,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,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -275,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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -287,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),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -297,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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -39,7 +39,7 @@ class DelayedTrackingStore(context: Context) {
|
||||
DelayedTrackingItem(
|
||||
trackId = it.key.toLong(),
|
||||
mangaId = mangaId.toLong(),
|
||||
lastChapterRead = lastChapterRead.toFloat()
|
||||
lastChapterRead = lastChapterRead.toFloat(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>()
|
||||
@@ -137,10 +137,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||
"X-Algolia-Application-Id",
|
||||
algoliaAppId,
|
||||
"X-Algolia-API-Key",
|
||||
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(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -92,7 +92,7 @@ data class ReadProgressDto(
|
||||
booksUnreadCount,
|
||||
booksInProgressCount,
|
||||
lastReadContinuousIndex.toFloat(),
|
||||
booksCount.toFloat()
|
||||
booksCount.toFloat(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class AppUpdateJob(private val context: Context, workerParams: WorkerParameters)
|
||||
7,
|
||||
TimeUnit.DAYS,
|
||||
3,
|
||||
TimeUnit.HOURS
|
||||
TimeUnit.HOURS,
|
||||
)
|
||||
.addTag(TAG)
|
||||
.setConstraints(constraints)
|
||||
|
||||
@@ -47,12 +47,12 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||
addAction(
|
||||
android.R.drawable.stat_sys_download_done,
|
||||
context.getString(R.string.action_download),
|
||||
updateIntent
|
||||
updateIntent,
|
||||
)
|
||||
addAction(
|
||||
R.drawable.ic_info_24dp,
|
||||
context.getString(R.string.whats_new),
|
||||
releaseInfoIntent
|
||||
releaseInfoIntent,
|
||||
)
|
||||
}
|
||||
notificationBuilder.show()
|
||||
@@ -105,12 +105,12 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||
addAction(
|
||||
R.drawable.ic_system_update_alt_white_24dp,
|
||||
context.getString(R.string.action_install),
|
||||
installIntent
|
||||
installIntent,
|
||||
)
|
||||
addAction(
|
||||
R.drawable.ic_close_24dp,
|
||||
context.getString(R.string.action_cancel),
|
||||
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER)
|
||||
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER),
|
||||
)
|
||||
}
|
||||
notificationBuilder.show()
|
||||
@@ -132,12 +132,12 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||
addAction(
|
||||
R.drawable.ic_refresh_24dp,
|
||||
context.getString(R.string.action_retry),
|
||||
AppUpdateService.downloadApkPendingService(context, url)
|
||||
AppUpdateService.downloadApkPendingService(context, url),
|
||||
)
|
||||
addAction(
|
||||
R.drawable.ic_close_24dp,
|
||||
context.getString(R.string.action_cancel),
|
||||
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER)
|
||||
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER),
|
||||
)
|
||||
}
|
||||
notificationBuilder.show(Notifications.ID_APP_UPDATER)
|
||||
|
||||
Reference in New Issue
Block a user