geekdroid-firebase: remove Play core task extensions as latest version use gms Tasks
--- a/geekdroid-firebase/build.gradle.kts Thu Dec 01 19:52:51 2022 -0400
+++ b/geekdroid-firebase/build.gradle.kts Wed Dec 07 20:32:30 2022 -0400
@@ -59,9 +59,6 @@
// not firebase but they often work together so here we are
implementation("com.google.android.gms:play-services-location:21.0.1")
- // not firebase but similar to gms api
- implementation("com.google.android.play:core:1.10.3")
-
// fix for guava conflict
// firebase depends on a older version of these dependencies while testImplementation dependencies
// depends on new version
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/gms/Tasks.kt Thu Dec 01 19:52:51 2022 -0400
+++ b/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/gms/Tasks.kt Wed Dec 07 20:32:30 2022 -0400
@@ -22,13 +22,11 @@
package com.geekorum.geekdroid.gms
import com.google.android.gms.tasks.Task
-import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
-import com.google.android.play.core.tasks.Task as PlayCoreTask
/**
* Await for the result of a [Task]
@@ -84,7 +82,7 @@
/**
* Converts this task to an instance of [Deferred].
*/
-fun <T> PlayCoreTask<T>.asDeferred(): Deferred<T> {
+fun <T> Task<T>.asDeferred(): Deferred<T> {
if (isComplete) {
val e = exception
return if (e == null) {
@@ -108,34 +106,3 @@
return result
}
-/**
- * Awaits for completion of the task without blocking a thread.
- *
- * If the [Job] of the current coroutine is cancelled or completed while this suspending function is waiting, this function
- * stops waiting for the completion stage and immediately resumes with [CancellationException].
- */
-suspend fun <T> PlayCoreTask<T>.await(): T {
- // fast path
- if (isComplete) {
- val e = exception
- return if (e == null) {
- @Suppress("UNCHECKED_CAST")
- result as T
- } else {
- throw e
- }
- }
-
- return suspendCancellableCoroutine { cont ->
- addOnCompleteListener {
- val e = exception
- if (e == null) {
- @Suppress("UNCHECKED_CAST")
- cont.resume(result as T)
- } else {
- cont.resumeWithException(e)
- }
- }
- }
-}
-