Set preview/experimental compiler flags instead of using annotations
(cherry picked from commit 781971ee813b9c3a71558c268365e9495dbc41c2) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt
This commit is contained in:
parent
b4be82d021
commit
b25e604bc2
@ -351,7 +351,14 @@ repositories {
|
||||
|
||||
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api-markers
|
||||
tasks.withType(AbstractKotlinCompile).all {
|
||||
kotlinOptions.freeCompilerArgs += ["-Xopt-in=kotlin.Experimental"]
|
||||
kotlinOptions.freeCompilerArgs += [
|
||||
"-Xopt-in=kotlin.Experimental",
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xuse-experimental=kotlin.ExperimentalStdlibApi",
|
||||
"-Xuse-experimental=kotlinx.coroutines.FlowPreview",
|
||||
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||
"-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi",
|
||||
]
|
||||
}
|
||||
|
||||
// Duplicating Hebrew string assets due to some locale code issues on different devices
|
||||
|
@ -1,13 +1,8 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
/**
|
||||
* Backup json model
|
||||
*/
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class Backup(
|
||||
@ProtoNumber(1) val backupManga: List<BackupManga>,
|
||||
|
@ -2,11 +2,9 @@ package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import eu.kanade.tachiyomi.data.database.models.Category
|
||||
import eu.kanade.tachiyomi.data.database.models.CategoryImpl
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
class BackupCategory(
|
||||
@ProtoNumber(1) var name: String,
|
||||
|
@ -2,11 +2,9 @@ package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
import eu.kanade.tachiyomi.data.database.models.ChapterImpl
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupChapter(
|
||||
// in 1.x some of these values have different names
|
||||
|
@ -4,11 +4,9 @@ import eu.kanade.tachiyomi.data.backup.full.models.metadata.BackupSearchMetadata
|
||||
import eu.kanade.tachiyomi.data.backup.full.models.metadata.BackupSearchTag
|
||||
import eu.kanade.tachiyomi.data.backup.full.models.metadata.BackupSearchTitle
|
||||
import exh.metadata.metadata.base.FlatMetadata
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupFlatMetadata(
|
||||
@ProtoNumber(1) var searchMetadata: BackupSearchMetadata,
|
||||
|
@ -1,10 +1,8 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupHistory(
|
||||
@ProtoNumber(0) var url: String,
|
||||
|
@ -4,11 +4,9 @@ import eu.kanade.tachiyomi.data.database.models.ChapterImpl
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.MangaImpl
|
||||
import eu.kanade.tachiyomi.data.database.models.TrackImpl
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupManga(
|
||||
// in 1.x some of these values have different names
|
||||
|
@ -1,14 +1,12 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import exh.merged.sql.models.MergedMangaReference
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
/*
|
||||
* SY merged manga backup class
|
||||
*/
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupMergedMangaReference(
|
||||
@ProtoNumber(1) var isInfoManga: Boolean,
|
||||
|
@ -1,13 +1,11 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
/*
|
||||
* SY saved searches class
|
||||
*/
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupSavedSearch(
|
||||
@ProtoNumber(1) val name: String,
|
||||
|
@ -1,8 +1,6 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializer
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializer(forClass = Backup::class)
|
||||
object BackupSerializer
|
||||
|
@ -1,11 +1,9 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupSource(
|
||||
@ProtoNumber(0) var name: String = "",
|
||||
|
@ -2,11 +2,9 @@ package eu.kanade.tachiyomi.data.backup.full.models
|
||||
|
||||
import eu.kanade.tachiyomi.data.database.models.Track
|
||||
import eu.kanade.tachiyomi.data.database.models.TrackImpl
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupTracking(
|
||||
// in 1.x some of these values have different types or names
|
||||
|
@ -1,11 +1,9 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models.metadata
|
||||
|
||||
import exh.metadata.sql.models.SearchMetadata
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupSearchMetadata(
|
||||
@ProtoNumber(1) var uploader: String? = null,
|
||||
|
@ -1,11 +1,9 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models.metadata
|
||||
|
||||
import exh.metadata.sql.models.SearchTag
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupSearchTag(
|
||||
@ProtoNumber(1) var namespace: String? = null,
|
||||
|
@ -1,11 +1,9 @@
|
||||
package eu.kanade.tachiyomi.data.backup.full.models.metadata
|
||||
|
||||
import exh.metadata.sql.models.SearchTitle
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class BackupSearchTitle(
|
||||
@ProtoNumber(1) var title: String,
|
||||
|
@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.util.lang.asObservable
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
@ -29,7 +28,6 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param page the page number to retrieve.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchPopularManga(page: Int): Observable<MangasPage> {
|
||||
return fetchPopularMangaFlow(page).asObservable()
|
||||
}
|
||||
@ -73,7 +71,6 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
* @param query the search query.
|
||||
* @param filters the list of filters to apply.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||
return fetchSearchMangaSuspended(page, query, filters).asObservable()
|
||||
}
|
||||
@ -116,7 +113,6 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param page the page number to retrieve.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchLatestUpdates(page: Int): Observable<MangasPage> {
|
||||
return fetchLatestUpdatesFlow(page).asObservable()
|
||||
}
|
||||
@ -158,7 +154,6 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param manga the manga to be updated.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
||||
return fetchMangaDetailsFlow(manga).asObservable()
|
||||
}
|
||||
@ -203,7 +198,6 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param manga the manga to look for chapters.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||
return try {
|
||||
fetchChapterListFlow(manga).asObservable()
|
||||
@ -256,7 +250,6 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param chapter the chapter whose page list has to be fetched.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||
return fetchPageListFlow(chapter).asObservable()
|
||||
}
|
||||
@ -301,7 +294,6 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param page the page whose source image has to be fetched.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchImageUrl(page: Page): Observable<String> {
|
||||
return fetchImageUrlFlow(page).asObservable()
|
||||
}
|
||||
@ -345,7 +337,6 @@ abstract class SuspendHttpSource : HttpSource() {
|
||||
*
|
||||
* @param page the page whose source image has to be downloaded.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
final override fun fetchImage(page: Page): Observable<Response> {
|
||||
return fetchImageFlow(page).asObservable()
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import okhttp3.CacheControl
|
||||
import okhttp3.FormBody
|
||||
import okhttp3.Headers
|
||||
@ -120,7 +119,6 @@ class MangaDex(delegate: HttpSource, val context: Context) :
|
||||
return MangaHandler(client, headers, listOf(mdLang), preferences.mangaDexForceLatestCovers().get()).fetchChapterListObservable(manga)
|
||||
}
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||
return if (chapter.scanlator == "MangaPlus") {
|
||||
client.newCall(mangaPlusPageListRequest(chapter))
|
||||
|
@ -43,7 +43,6 @@ import exh.util.executeOnIO
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.isActive
|
||||
@ -122,7 +121,6 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
private suspend fun runMigrations(mangas: List<MigratingManga>) {
|
||||
throttleManager.resetThrottle()
|
||||
if (config == null) return
|
||||
@ -335,7 +333,6 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
fun useMangaForMigration(manga: Manga, source: Source) {
|
||||
val firstIndex = selectedPosition ?: return
|
||||
val migratingManga = adapter?.getItem(firstIndex) ?: return
|
||||
|
@ -19,7 +19,6 @@ import eu.kanade.tachiyomi.ui.browse.migration.advanced.process.MigrationListCon
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationInterface
|
||||
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController
|
||||
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchPresenter
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
@ -100,7 +99,6 @@ class SearchController(
|
||||
} else router.popController(this)
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
override fun onMangaClick(manga: Manga) {
|
||||
if (targetController is MigrationListController) {
|
||||
val migrationListController = targetController as? MigrationListController
|
||||
|
@ -11,7 +11,6 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.merge
|
||||
@ -53,7 +52,6 @@ class MangaChaptersHeaderAdapter(
|
||||
}
|
||||
|
||||
inner class HeaderViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||
@ExperimentalCoroutinesApi
|
||||
fun bind() {
|
||||
binding.chaptersLabel.text = if (numChapters == null) {
|
||||
view.context.getString(R.string.chapters)
|
||||
|
@ -29,7 +29,6 @@ import exh.util.makeSearchChip
|
||||
import exh.util.setChipsExtended
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.merge
|
||||
@ -112,7 +111,6 @@ class MangaInfoItemAdapter(
|
||||
* @param manga manga object containing information about manga.
|
||||
* @param source the source of the manga.
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
private fun setMangaInfo(manga: Manga, source: Source?) {
|
||||
// Manga info section
|
||||
val hasInfoContent = !manga.description.isNullOrBlank() || !manga.genre.isNullOrBlank()
|
||||
|
@ -17,7 +17,6 @@ import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import kotlinx.android.synthetic.main.track_search_dialog.view.progress
|
||||
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search
|
||||
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search_list
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
@ -95,7 +94,6 @@ class TrackSearchDialog : DialogController {
|
||||
adapter = null
|
||||
}
|
||||
|
||||
@FlowPreview
|
||||
override fun onAttach(view: View) {
|
||||
super.onAttach(view)
|
||||
dialogView!!.track_search.textChanges()
|
||||
|
@ -70,7 +70,6 @@ import eu.kanade.tachiyomi.widget.SimpleSeekBarListener
|
||||
import exh.util.defaultReaderType
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.delay
|
||||
@ -938,7 +937,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
/**
|
||||
* Class that handles the user preferences of the reader.
|
||||
*/
|
||||
@FlowPreview
|
||||
private inner class ReaderConfig {
|
||||
|
||||
/**
|
||||
@ -1059,7 +1057,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
/**
|
||||
* Sets the custom brightness overlay according to [enabled].
|
||||
*/
|
||||
@FlowPreview
|
||||
private fun setCustomBrightness(enabled: Boolean) {
|
||||
if (enabled) {
|
||||
preferences.customBrightnessValue().asFlow()
|
||||
@ -1074,7 +1071,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
||||
/**
|
||||
* Sets the color filter overlay according to [enabled].
|
||||
*/
|
||||
@FlowPreview
|
||||
private fun setColorFilter(enabled: Boolean) {
|
||||
if (enabled) {
|
||||
preferences.colorFilterValue().asFlow()
|
||||
|
@ -32,7 +32,6 @@ import kotlin.coroutines.resumeWithException
|
||||
* Util functions for bridging RxJava and coroutines. Taken from TachiyomiEH/SY.
|
||||
*/
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
suspend fun <T> Single<T>.await(subscribeOn: Scheduler? = null): T {
|
||||
return suspendCancellableCoroutine { continuation ->
|
||||
val self = if (subscribeOn != null) subscribeOn(subscribeOn) else this
|
||||
@ -59,7 +58,6 @@ suspend fun <T> Single<T>.await(subscribeOn: Scheduler? = null): T {
|
||||
suspend fun <T> PreparedOperation<T>.await(): T = asRxSingle().await()
|
||||
suspend fun <T> PreparedGetObject<T>.await(): T? = asRxSingle().await()
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
suspend fun Completable.awaitSuspending(subscribeOn: Scheduler? = null) {
|
||||
return suspendCancellableCoroutine { continuation ->
|
||||
val self = if (subscribeOn != null) subscribeOn(subscribeOn) else this
|
||||
@ -183,7 +181,6 @@ private suspend fun <T> Observable<T>.awaitOne(): T = suspendCancellableCoroutin
|
||||
internal fun <T> CancellableContinuation<T>.unsubscribeOnCancellation(sub: Subscription) =
|
||||
invokeOnCancellation { sub.unsubscribe() }
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
fun <T : Any> Observable<T>.asFlow(): Flow<T> = callbackFlow {
|
||||
val observer = object : Observer<T> {
|
||||
override fun onNext(t: T) {
|
||||
@ -202,7 +199,6 @@ fun <T : Any> Observable<T>.asFlow(): Flow<T> = callbackFlow {
|
||||
awaitClose { subscription.unsubscribe() }
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
fun <T : Any> Flow<T>.asObservable(backpressureMode: Emitter.BackpressureMode = Emitter.BackpressureMode.NONE): Observable<T> {
|
||||
return Observable.create(
|
||||
{ emitter ->
|
||||
|
@ -48,7 +48,6 @@ fun String.byteSize(): Int {
|
||||
* Returns a string containing the first [n] bytes from this string, or the entire string if this
|
||||
* string is shorter.
|
||||
*/
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun String.takeBytes(n: Int): String {
|
||||
val bytes = toByteArray(Charsets.UTF_8)
|
||||
return if (bytes.size <= n) {
|
||||
|
@ -20,7 +20,6 @@ import exh.metadata.metadata.base.insertFlatMetadata
|
||||
import exh.savedsearches.JsonSavedSearch
|
||||
import exh.util.cancellable
|
||||
import exh.util.jobScheduler
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.flow.mapNotNull
|
||||
import kotlinx.coroutines.flow.toList
|
||||
@ -31,7 +30,6 @@ import kotlinx.serialization.json.Json
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.lang.RuntimeException
|
||||
|
||||
@OptIn(FlowPreview::class)
|
||||
object DebugFunctions {
|
||||
val app: Application by injectLazy()
|
||||
val db: DatabaseHelper by injectLazy()
|
||||
|
@ -1,7 +1,6 @@
|
||||
package exh.debug
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.Locale
|
||||
|
||||
@ -19,7 +18,6 @@ enum class DebugToggles(val default: Boolean) {
|
||||
|
||||
val prefKey = "eh_debug_toggle_${name.toLowerCase(Locale.getDefault())}"
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
var enabled: Boolean
|
||||
get() = prefs.flowPrefs.getBoolean(prefKey, default).get()
|
||||
set(value) {
|
||||
|
@ -29,7 +29,6 @@ import exh.util.cancellable
|
||||
import exh.util.jobScheduler
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancelAndJoin
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
@ -130,7 +129,6 @@ class EHentaiUpdateWorker : JobService(), CoroutineScope {
|
||||
return true
|
||||
}
|
||||
|
||||
@OptIn(FlowPreview::class)
|
||||
private suspend fun startUpdating() {
|
||||
logger.d("Update job started!")
|
||||
val startTime = System.currentTimeMillis()
|
||||
|
@ -3,7 +3,6 @@ package exh.md.handlers
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import exh.md.handlers.serializers.MangaPlusSerializer
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.protobuf.ProtoBuf
|
||||
import okhttp3.Headers
|
||||
import okhttp3.Interceptor
|
||||
@ -26,7 +25,6 @@ class MangaPlusHandler(currentClient: OkHttpClient) {
|
||||
.addInterceptor { imageIntercept(it) }
|
||||
.build()
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
fun fetchPageList(chapterId: String): List<Page> {
|
||||
val response = client.newCall(pageListRequest(chapterId)).execute()
|
||||
return pageListParse(response)
|
||||
@ -39,7 +37,6 @@ class MangaPlusHandler(currentClient: OkHttpClient) {
|
||||
)
|
||||
}
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
private fun pageListParse(response: Response): List<Page> {
|
||||
val result = ProtoBuf.decodeFromByteArray(MangaPlusSerializer, response.body!!.bytes())
|
||||
|
||||
|
@ -5,7 +5,6 @@ import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import exh.md.utils.MdUtil
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import okhttp3.CacheControl
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
@ -15,7 +14,6 @@ import rx.Observable
|
||||
// Unused, kept for reference todo
|
||||
class PageHandler(val client: OkHttpClient, val headers: Headers, private val imageServer: String, val dataSaver: String?) {
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||
if (chapter.scanlator.equals("MangaPlus")) {
|
||||
return client.newCall(pageListRequest(chapter))
|
||||
|
@ -1,22 +1,18 @@
|
||||
package exh.md.handlers.serializers
|
||||
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Serializer
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializer(forClass = MangaPlusResponse::class)
|
||||
object MangaPlusSerializer
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class MangaPlusResponse(
|
||||
@ProtoNumber(1) val success: SuccessResult? = null,
|
||||
@ProtoNumber(2) val error: ErrorResult? = null
|
||||
)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class ErrorResult(
|
||||
@ProtoNumber(1) val action: Action,
|
||||
@ -26,14 +22,12 @@ data class ErrorResult(
|
||||
|
||||
enum class Action { DEFAULT, UNAUTHORIZED, MAINTAINENCE, GEOIP_BLOCKING }
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class Popup(
|
||||
@ProtoNumber(1) val subject: String,
|
||||
@ProtoNumber(2) val body: String
|
||||
)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class SuccessResult(
|
||||
@ProtoNumber(1) val isFeaturedUpdated: Boolean? = false,
|
||||
@ -44,19 +38,15 @@ data class SuccessResult(
|
||||
@ProtoNumber(11) val webHomeView: WebHomeView? = null
|
||||
)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class TitleRankingView(@ProtoNumber(1) val titles: List<Title> = emptyList())
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class AllTitlesView(@ProtoNumber(1) val titles: List<Title> = emptyList())
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class WebHomeView(@ProtoNumber(2) val groups: List<UpdatedTitleGroup> = emptyList())
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class TitleDetailView(
|
||||
@ProtoNumber(1) val title: Title,
|
||||
@ -75,11 +65,9 @@ data class TitleDetailView(
|
||||
|
||||
enum class UpdateTiming { NOT_REGULARLY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY, DAY }
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class MangaViewer(@ProtoNumber(1) val pages: List<MangaPlusPage> = emptyList())
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class Title(
|
||||
@ProtoNumber(1) val titleId: Int,
|
||||
@ -91,7 +79,6 @@ data class Title(
|
||||
@ProtoNumber(7) val language: Language? = Language.ENGLISH
|
||||
)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
enum class Language(val id: Int) {
|
||||
@ProtoNumber(0)
|
||||
@ -101,20 +88,17 @@ enum class Language(val id: Int) {
|
||||
SPANISH(1)
|
||||
}
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class UpdatedTitleGroup(
|
||||
@ProtoNumber(1) val groupName: String,
|
||||
@ProtoNumber(2) val titles: List<UpdatedTitle> = emptyList()
|
||||
)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class UpdatedTitle(
|
||||
@ProtoNumber(1) val title: Title? = null
|
||||
)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class Chapter(
|
||||
@ProtoNumber(1) val titleId: Int,
|
||||
@ -125,11 +109,9 @@ data class Chapter(
|
||||
@ProtoNumber(7) val endTimeStamp: Int
|
||||
)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class MangaPlusPage(@ProtoNumber(1) val page: MangaPage? = null)
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
@Serializable
|
||||
data class MangaPage(
|
||||
@ProtoNumber(1) val imageUrl: String,
|
||||
|
@ -2,7 +2,6 @@ package exh.md.similar
|
||||
|
||||
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.ResponseBody
|
||||
@ -28,7 +27,6 @@ interface SimilarHttpService {
|
||||
.build()
|
||||
}
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
fun create(): SimilarHttpService {
|
||||
// actual builder, which will parse the underlying json file
|
||||
val adapter = Retrofit.Builder()
|
||||
|
@ -1,12 +1,10 @@
|
||||
package exh.util
|
||||
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.ensureActive
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlin.coroutines.coroutineContext
|
||||
|
||||
@FlowPreview
|
||||
fun <T> Flow<T>.cancellable() = onEach {
|
||||
coroutineContext.ensureActive()
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import kotlinx.coroutines.CancellableContinuation
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineStart
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.InternalCoroutinesApi
|
||||
import kotlinx.coroutines.channels.awaitClose
|
||||
@ -51,7 +50,6 @@ fun <T> Observable<T>.melt(): Observable<T> {
|
||||
return rs
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
suspend fun <T> Single<T>.await(subscribeOn: Scheduler? = null): T {
|
||||
return suspendCancellableCoroutine { continuation ->
|
||||
val self = if (subscribeOn != null) subscribeOn(subscribeOn) else this
|
||||
@ -78,7 +76,6 @@ suspend fun <T> Single<T>.await(subscribeOn: Scheduler? = null): T {
|
||||
suspend fun <T> PreparedOperation<T>.await(): T = asRxSingle().await()
|
||||
suspend fun <T> PreparedGetObject<T>.await(): T? = asRxSingle().await()
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
suspend fun Completable.awaitSuspending(subscribeOn: Scheduler? = null) {
|
||||
return suspendCancellableCoroutine { continuation ->
|
||||
val self = if (subscribeOn != null) subscribeOn(subscribeOn) else this
|
||||
@ -136,33 +133,33 @@ suspend fun <T> Single<T>.await(): T = suspendCancellableCoroutine { cont ->
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
||||
@OptIn(InternalCoroutinesApi::class)
|
||||
suspend fun <T> Observable<T>.awaitFirst(): T = first().awaitOne()
|
||||
|
||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
||||
@OptIn(InternalCoroutinesApi::class)
|
||||
suspend fun <T> Observable<T>.awaitFirstOrDefault(default: T): T = firstOrDefault(default).awaitOne()
|
||||
|
||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
||||
@OptIn(InternalCoroutinesApi::class)
|
||||
suspend fun <T> Observable<T>.awaitFirstOrNull(): T? = firstOrDefault(null).awaitOne()
|
||||
|
||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
||||
@OptIn(InternalCoroutinesApi::class)
|
||||
suspend fun <T> Observable<T>.awaitFirstOrElse(defaultValue: () -> T): T = switchIfEmpty(
|
||||
Observable.fromCallable(
|
||||
defaultValue
|
||||
)
|
||||
).first().awaitOne()
|
||||
|
||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
||||
@OptIn(InternalCoroutinesApi::class)
|
||||
suspend fun <T> Observable<T>.awaitLast(): T = last().awaitOne()
|
||||
|
||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
||||
@OptIn(InternalCoroutinesApi::class)
|
||||
suspend fun <T> Observable<T>.awaitSingle(): T = single().awaitOne()
|
||||
|
||||
suspend fun <T> Observable<T>.awaitSingleOrDefault(default: T): T = singleOrDefault(default).awaitOne()
|
||||
|
||||
suspend fun <T> Observable<T>.awaitSingleOrNull(): T? = singleOrDefault(null).awaitOne()
|
||||
|
||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
||||
@OptIn(InternalCoroutinesApi::class)
|
||||
private suspend fun <T> Observable<T>.awaitOne(): T = suspendCancellableCoroutine { cont ->
|
||||
cont.unsubscribeOnCancellation(
|
||||
subscribe(
|
||||
@ -202,7 +199,6 @@ private suspend fun <T> Observable<T>.awaitOne(): T = suspendCancellableCoroutin
|
||||
internal fun <T> CancellableContinuation<T>.unsubscribeOnCancellation(sub: Subscription) =
|
||||
invokeOnCancellation { sub.unsubscribe() }
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
fun <T : Any> Observable<T>.asFlow(): Flow<T> = callbackFlow {
|
||||
val observer = object : Observer<T> {
|
||||
override fun onNext(t: T) {
|
||||
@ -221,7 +217,6 @@ fun <T : Any> Observable<T>.asFlow(): Flow<T> = callbackFlow {
|
||||
awaitClose { subscription.unsubscribe() }
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
fun <T : Any> Flow<T>.asObservable(backpressureMode: Emitter.BackpressureMode = Emitter.BackpressureMode.NONE): Observable<T> {
|
||||
return Observable.create(
|
||||
{ emitter ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user