mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 20:01:50 +01:00
Remove some OptIn annotations
This commit is contained in:
parent
7d713b87b1
commit
c06a932c95
@ -289,6 +289,7 @@ tasks {
|
|||||||
"-Xuse-experimental=kotlin.ExperimentalStdlibApi",
|
"-Xuse-experimental=kotlin.ExperimentalStdlibApi",
|
||||||
"-Xuse-experimental=kotlinx.coroutines.FlowPreview",
|
"-Xuse-experimental=kotlinx.coroutines.FlowPreview",
|
||||||
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||||
|
"-Xuse-experimental=kotlinx.coroutines.InternalCoroutinesApi",
|
||||||
"-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi"
|
"-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.data.preference.PreferenceValues.DisplayMode
|
|||||||
import eu.kanade.tachiyomi.data.track.TrackService
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
import eu.kanade.tachiyomi.data.track.anilist.Anilist
|
import eu.kanade.tachiyomi.data.track.anilist.Anilist
|
||||||
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -23,7 +22,6 @@ import java.util.Locale
|
|||||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
|
||||||
fun <T> Preference<T>.asImmediateFlow(block: (value: T) -> Unit): Flow<T> {
|
fun <T> Preference<T>.asImmediateFlow(block: (value: T) -> Unit): Flow<T> {
|
||||||
block(get())
|
block(get())
|
||||||
return asFlow()
|
return asFlow()
|
||||||
@ -38,7 +36,6 @@ operator fun <T> Preference<Set<T>>.minusAssign(item: T) {
|
|||||||
set(get() - item)
|
set(get() - item)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
|
||||||
class PreferencesHelper(val context: Context) {
|
class PreferencesHelper(val context: Context) {
|
||||||
|
|
||||||
private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.util.lang
|
|||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.CoroutineStart
|
import kotlinx.coroutines.CoroutineStart
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -14,6 +13,5 @@ fun launchUI(block: suspend CoroutineScope.() -> Unit): Job =
|
|||||||
fun launchIO(block: suspend CoroutineScope.() -> Unit): Job =
|
fun launchIO(block: suspend CoroutineScope.() -> Unit): Job =
|
||||||
GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT, block)
|
GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT, block)
|
||||||
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
|
||||||
fun launchNow(block: suspend CoroutineScope.() -> Unit): Job =
|
fun launchNow(block: suspend CoroutineScope.() -> Unit): Job =
|
||||||
GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block)
|
GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block)
|
||||||
|
@ -6,9 +6,7 @@ import kotlinx.coroutines.CancellableContinuation
|
|||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.CoroutineStart
|
import kotlinx.coroutines.CoroutineStart
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.InternalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.channels.awaitClose
|
import kotlinx.coroutines.channels.awaitClose
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.callbackFlow
|
import kotlinx.coroutines.flow.callbackFlow
|
||||||
@ -115,27 +113,21 @@ suspend fun <T> Single<T>.await(): T = suspendCancellableCoroutine { cont ->
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
|
||||||
suspend fun <T> Observable<T>.awaitFirst(): T = first().awaitOne()
|
suspend fun <T> Observable<T>.awaitFirst(): T = first().awaitOne()
|
||||||
|
|
||||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
|
||||||
suspend fun <T> Observable<T>.awaitFirstOrDefault(default: T): T =
|
suspend fun <T> Observable<T>.awaitFirstOrDefault(default: T): T =
|
||||||
firstOrDefault(default).awaitOne()
|
firstOrDefault(default).awaitOne()
|
||||||
|
|
||||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
|
||||||
suspend fun <T> Observable<T>.awaitFirstOrNull(): T? = firstOrDefault(null).awaitOne()
|
suspend fun <T> Observable<T>.awaitFirstOrNull(): T? = firstOrDefault(null).awaitOne()
|
||||||
|
|
||||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
|
||||||
suspend fun <T> Observable<T>.awaitFirstOrElse(defaultValue: () -> T): T = switchIfEmpty(
|
suspend fun <T> Observable<T>.awaitFirstOrElse(defaultValue: () -> T): T = switchIfEmpty(
|
||||||
Observable.fromCallable(
|
Observable.fromCallable(
|
||||||
defaultValue
|
defaultValue
|
||||||
)
|
)
|
||||||
).first().awaitOne()
|
).first().awaitOne()
|
||||||
|
|
||||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
|
||||||
suspend fun <T> Observable<T>.awaitLast(): T = last().awaitOne()
|
suspend fun <T> Observable<T>.awaitLast(): T = last().awaitOne()
|
||||||
|
|
||||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
|
||||||
suspend fun <T> Observable<T>.awaitSingle(): T = single().awaitOne()
|
suspend fun <T> Observable<T>.awaitSingle(): T = single().awaitOne()
|
||||||
|
|
||||||
suspend fun <T> Observable<T>.awaitSingleOrDefault(default: T): T =
|
suspend fun <T> Observable<T>.awaitSingleOrDefault(default: T): T =
|
||||||
@ -143,7 +135,6 @@ suspend fun <T> Observable<T>.awaitSingleOrDefault(default: T): T =
|
|||||||
|
|
||||||
suspend fun <T> Observable<T>.awaitSingleOrNull(): T? = singleOrDefault(null).awaitOne()
|
suspend fun <T> Observable<T>.awaitSingleOrNull(): T? = singleOrDefault(null).awaitOne()
|
||||||
|
|
||||||
@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class)
|
|
||||||
private suspend fun <T> Observable<T>.awaitOne(): T = suspendCancellableCoroutine { cont ->
|
private suspend fun <T> Observable<T>.awaitOne(): T = suspendCancellableCoroutine { cont ->
|
||||||
cont.unsubscribeOnCancellation(
|
cont.unsubscribeOnCancellation(
|
||||||
subscribe(
|
subscribe(
|
||||||
|
Loading…
Reference in New Issue
Block a user