From 2375a806e0657c659351a41c567aa49e489c079f Mon Sep 17 00:00:00 2001 From: Luna712 <142361265+Luna712@users.noreply.github.com> Date: Sat, 13 Jun 2026 16:55:44 -0600 Subject: [PATCH] ParCollections: remove deprecated methods runBlocking is not available on some platforms, instead of handling that with a temporary expect/actual, we can just remove these. They have been deprecated for awhile anyway. --- .../lagradost/cloudstream3/ParCollections.kt | 68 +------------------ 1 file changed, 1 insertion(+), 67 deletions(-) diff --git a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/ParCollections.kt b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/ParCollections.kt index 9e6cb99e5be..df55a804e67 100644 --- a/library/src/commonMain/kotlin/com/lagradost/cloudstream3/ParCollections.kt +++ b/library/src/commonMain/kotlin/com/lagradost/cloudstream3/ParCollections.kt @@ -15,19 +15,6 @@ suspend fun Map.amap(f: suspend (Map.Entry) -> R): Lis map { async { f(it) } }.map { it.await() } } -/** - * Short for "Asynchronous Parallel Map", but is not really parallel, only concurrent. - */ -@Deprecated( - "This blocks with runBlocking, and should not be used inside a suspended context", - replaceWith = ReplaceWith("amap(f)", "com.lagradost.cloudstream3.amap"), - level = DeprecationLevel.ERROR -) -@Throws(CancellationException::class) -fun Map.apmap(f: suspend (Map.Entry) -> R): List = runBlocking { - map { async { f(it) } }.map { it.await() } -} - /** * Short for "Asynchronous Map", runs on all values concurrently, * this means that if you are not doing networking, you should use a regular map @@ -39,32 +26,6 @@ suspend fun List.amap(f: suspend (A) -> B): List = map { async { f(it) } }.map { it.await() } } -/** - * Short for "Asynchronous Parallel Map", but is not really parallel, only concurrent. - */ -@Deprecated( - "This blocks with runBlocking, and should not be used inside a suspended context", - replaceWith = ReplaceWith("amap(f)", "com.lagradost.cloudstream3.amap"), - level = DeprecationLevel.ERROR -) -@Throws(CancellationException::class) -fun List.apmap(f: suspend (A) -> B): List = runBlocking { - map { async { f(it) } }.map { it.await() } -} - -/** - * Short for "Asynchronous Parallel Map" with an Index, but is not really parallel, only concurrent. - */ -@Deprecated( - "This blocks with runBlocking, and should not be used inside a suspended context", - replaceWith = ReplaceWith("amapIndexed(f)", "com.lagradost.cloudstream3.amapIndexed"), - level = DeprecationLevel.ERROR -) -@Throws(CancellationException::class) -fun List.apmapIndexed(f: suspend (index: Int, A) -> B): List = runBlocking { - mapIndexed { index, a -> async { f(index, a) } }.map { it.await() } -} - /** * Short for "Asynchronous Map" with an Index, runs on all values concurrently, * this means that if you are not doing networking, you should use a regular mapIndexed @@ -76,33 +37,6 @@ suspend fun List.amapIndexed(f: suspend (index: Int, A) -> B): List mapIndexed { index, a -> async { f(index, a) } }.map { it.await() } } -/** - * Short for "Argument Asynchronous Map" because it allows for a variadic number of paramaters. - * - * Runs all different functions at the same time and awaits for all to be finished, then returns - * a list of all those items or null if they fail. However Unit is often used. - */ -@Deprecated( - "This blocks with runBlocking, and should not be used inside a suspended context", - replaceWith = ReplaceWith("runAllAsync(transforms)", "com.lagradost.cloudstream3.runAllAsync"), - level = DeprecationLevel.ERROR -) -@Throws(CancellationException::class) -fun argamap( - vararg transforms: suspend () -> R, -) : List = runBlocking { - transforms.map { - async { - try { - it.invoke() - } catch (e: Exception) { - logError(e) - null - } - } - }.map { it.await() } -} - /** * Runs all different functions at the same time and awaits for all to be finished, then returns * a list of all those items or null if they fail. However Unit is often used. @@ -122,4 +56,4 @@ suspend fun runAllAsync( } } }.map { it.await() } -} \ No newline at end of file +}