From c06a932c9516288e41e7ce4c617ce6c557428123 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 4 Jan 2021 10:22:26 -0500 Subject: [PATCH] Remove some OptIn annotations --- app/build.gradle.kts | 1 + .../tachiyomi/data/preference/PreferencesHelper.kt | 3 --- .../kanade/tachiyomi/util/lang/CoroutinesExtensions.kt | 2 -- .../eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt | 9 --------- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e7fe2f5cd..04ad59b54 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -289,6 +289,7 @@ tasks { "-Xuse-experimental=kotlin.ExperimentalStdlibApi", "-Xuse-experimental=kotlinx.coroutines.FlowPreview", "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", + "-Xuse-experimental=kotlinx.coroutines.InternalCoroutinesApi", "-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi" ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index 946078b0e..b24ded3bb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -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.anilist.Anilist import eu.kanade.tachiyomi.widget.ExtendedNavigationView -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.onEach 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.PreferenceValues as Values -@OptIn(ExperimentalCoroutinesApi::class) fun Preference.asImmediateFlow(block: (value: T) -> Unit): Flow { block(get()) return asFlow() @@ -38,7 +36,6 @@ operator fun Preference>.minusAssign(item: T) { set(get() - item) } -@OptIn(ExperimentalCoroutinesApi::class) class PreferencesHelper(val context: Context) { private val prefs = PreferenceManager.getDefaultSharedPreferences(context) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/CoroutinesExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/CoroutinesExtensions.kt index c126c028a..a789d4fcf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/CoroutinesExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/CoroutinesExtensions.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.util.lang import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.Job import kotlinx.coroutines.launch @@ -14,6 +13,5 @@ fun launchUI(block: suspend CoroutineScope.() -> Unit): Job = fun launchIO(block: suspend CoroutineScope.() -> Unit): Job = GlobalScope.launch(Dispatchers.IO, CoroutineStart.DEFAULT, block) -@OptIn(ExperimentalCoroutinesApi::class) fun launchNow(block: suspend CoroutineScope.() -> Unit): Job = GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt index 67d8e195b..678fe5b43 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt @@ -6,9 +6,7 @@ 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 import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow @@ -115,27 +113,21 @@ suspend fun Single.await(): T = suspendCancellableCoroutine { cont -> ) } -@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class) suspend fun Observable.awaitFirst(): T = first().awaitOne() -@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class) suspend fun Observable.awaitFirstOrDefault(default: T): T = firstOrDefault(default).awaitOne() -@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class) suspend fun Observable.awaitFirstOrNull(): T? = firstOrDefault(null).awaitOne() -@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class) suspend fun Observable.awaitFirstOrElse(defaultValue: () -> T): T = switchIfEmpty( Observable.fromCallable( defaultValue ) ).first().awaitOne() -@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class) suspend fun Observable.awaitLast(): T = last().awaitOne() -@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class) suspend fun Observable.awaitSingle(): T = single().awaitOne() suspend fun Observable.awaitSingleOrDefault(default: T): T = @@ -143,7 +135,6 @@ suspend fun Observable.awaitSingleOrDefault(default: T): T = suspend fun Observable.awaitSingleOrNull(): T? = singleOrDefault(null).awaitOne() -@OptIn(InternalCoroutinesApi::class, ExperimentalCoroutinesApi::class) private suspend fun Observable.awaitOne(): T = suspendCancellableCoroutine { cont -> cont.unsubscribeOnCancellation( subscribe(