Skip to content

Commit f75796f

Browse files
committed
Added functions for ios
1 parent 5a99a8f commit f75796f

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ local.properties
66
/**/*.iml
77

88
firebase-app/src/iosMain/c_interop/modules/
9-
9+
firebase-functions/src/iosMain/c_interop/modules/

firebase-functions/build.gradle.kts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
33
plugins {
44
id("com.android.library")
55
kotlin("multiplatform")
6+
kotlin("native.cocoapods")
67
`maven-publish`
78
}
89

@@ -42,6 +43,14 @@ kotlin {
4243
}
4344
}
4445

46+
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
47+
kotlinOptions.freeCompilerArgs += listOf(
48+
"-Xuse-experimental=kotlin.Experimental",
49+
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
50+
"-Xuse-experimental=kotlinx.serialization.ImplicitReflectionSerializer"
51+
)
52+
}
53+
4554
sourceSets {
4655
val commonMain by getting {
4756
dependencies {
@@ -58,6 +67,7 @@ kotlin {
5867
}
5968
val iosMain by creating {
6069
dependencies {
70+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:0.14.0")
6171
}
6272
}
6373
val jvmMain by getting {
@@ -71,6 +81,22 @@ kotlin {
7181
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:0.14.0")
7282
}
7383
}
84+
85+
configure(listOf(iosArm64, iosX64)) {
86+
compilations.getByName("main") {
87+
source(sourceSets.get("iosMain"))
88+
val firebasefunctions by cinterops.creating {
89+
packageName("cocoapods.FirebaseFunctions")
90+
defFile(file("$projectDir/src/iosMain/c_interop/FirebaseFunctions.def"))
91+
compilerOpts("-F$projectDir/src/iosMain/c_interop/modules/FirebaseFunctions-6.17.0")
92+
}
93+
}
94+
}
95+
96+
cocoapods {
97+
summary = ""
98+
homepage = ""
99+
}
74100
}
75101
}
76102

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language = Objective-C
2+
modules = FirebaseFunctions
3+
compilerOpts = -framework FirebaseFunctions
4+
linkerOpts = -framework FirebaseFunctions
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package dev.teamhub.firebase.functions
2+
3+
import dev.teamhub.firebase.Firebase
4+
import dev.teamhub.firebase.FirebaseApp
5+
import dev.teamhub.firebase.FirebaseException
6+
import kotlinx.serialization.DeserializationStrategy
7+
import kotlinx.serialization.SerializationStrategy
8+
import kotlinx.serialization.ImplicitReflectionSerializer
9+
10+
actual class FirebaseFunctions {
11+
actual fun httpsCallable(
12+
name: String,
13+
timeout: Long?
14+
): HttpsCallableReference {
15+
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
16+
}
17+
}
18+
19+
actual class HttpsCallableReference {
20+
@ImplicitReflectionSerializer
21+
actual suspend inline fun <reified T> call(data: T): HttpsCallableResult {
22+
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
23+
}
24+
25+
actual suspend inline fun <reified T> call(
26+
strategy: SerializationStrategy<T>,
27+
data: T
28+
): HttpsCallableResult {
29+
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
30+
}
31+
32+
actual suspend fun call(): HttpsCallableResult {
33+
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
34+
}
35+
}
36+
37+
actual class HttpsCallableResult {
38+
@ImplicitReflectionSerializer
39+
actual inline fun <reified T> data(): T {
40+
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
41+
}
42+
43+
actual inline fun <reified T> data(strategy: DeserializationStrategy<T>): T {
44+
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
45+
}
46+
}
47+
48+
/** Returns the [FirebaseFunctions] instance of the default [FirebaseApp]. */
49+
actual val Firebase.functions: FirebaseFunctions
50+
get() = kotlin.TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
51+
52+
/** Returns the [FirebaseFunctions] instance of a given [region]. */
53+
actual fun Firebase.functions(region: String): FirebaseFunctions {
54+
kotlin.TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
55+
}
56+
57+
/** Returns the [FirebaseFunctions] instance of a given [FirebaseApp]. */
58+
actual fun Firebase.functions(app: FirebaseApp): FirebaseFunctions {
59+
kotlin.TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
60+
}
61+
62+
/** Returns the [FirebaseFunctions] instance of a given [FirebaseApp] and [region]. */
63+
actual fun Firebase.functions(
64+
app: FirebaseApp,
65+
region: String
66+
): FirebaseFunctions {
67+
kotlin.TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
68+
}
69+
70+
actual class FirebaseFunctionsException : FirebaseException()

0 commit comments

Comments
 (0)