File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
src/androidMain/kotlin/dev/teamhub/firebase/functions Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,14 @@ kotlin {
50
50
val androidMain by getting {
51
51
dependencies {
52
52
api(" com.google.firebase:firebase-functions:17.0.0" )
53
+ implementation(" com.google.code.gson:gson:2.7" )
53
54
}
54
55
}
55
56
val jvmMain by getting {
56
57
kotlin.srcDir(" src/androidMain/kotlin" )
58
+ dependencies {
59
+ implementation(" com.google.code.gson:gson:2.7" )
60
+ }
57
61
}
58
62
}
59
63
}
Original file line number Diff line number Diff line change 1
1
package dev.teamhub.firebase.functions
2
2
3
+ import com.google.gson.Gson
3
4
import kotlinx.coroutines.tasks.await
5
+ import org.json.JSONTokener
4
6
import java.util.concurrent.TimeUnit
5
7
8
+ private val gson by lazy { Gson () }
9
+
6
10
actual fun getFirebaseFunctions () = FirebaseFunctions .getInstance()
7
11
8
12
actual typealias FirebaseFunctions = com.google.firebase.functions.FirebaseFunctions
9
13
10
14
actual typealias HttpsCallableReference = com.google.firebase.functions.HttpsCallableReference
11
15
12
- actual suspend fun HttpsCallableReference.awaitCall (data : Any? ) = call(data).await()
16
+ actual suspend fun HttpsCallableReference.awaitCall (data : Any? ) = call(JSONTokener (gson.toJson( data)).nextValue() ).await()
13
17
actual suspend fun HttpsCallableReference.awaitCall () = call().await()
14
18
15
19
actual typealias HttpsCallableResult = com.google.firebase.functions.HttpsCallableResult
@@ -20,4 +24,4 @@ actual val HttpsCallableResult.data: Any
20
24
actual fun FirebaseFunctions.getHttpsCallable (name : String , timeout : Long? ) =
21
25
getHttpsCallable(name).apply { timeout?.let { setTimeout(it, TimeUnit .MILLISECONDS ) } }
22
26
23
- actual typealias FirebaseFunctionsException = com.google.firebase.functions.FirebaseFunctionsException
27
+ actual typealias FirebaseFunctionsException = com.google.firebase.functions.FirebaseFunctionsException
You can’t perform that action at this time.
0 commit comments