Skip to content

Commit 8b12f21

Browse files
committed
Added platform extensions for ios and android
1 parent 51d0dfa commit 8b12f21

File tree

22 files changed

+53
-2
lines changed
  • firebase-app/src
  • firebase-auth/src
    • androidMain/kotlin/dev/gitlive/firebase/auth
    • iosMain/kotlin/dev/gitlive/firebase/auth
  • firebase-config/src
  • firebase-crashlytics/src
  • firebase-database/src
    • androidMain/kotlin/dev/gitlive/firebase/database
    • iosMain/kotlin/dev/gitlive/firebase/database
  • firebase-firestore/src
  • firebase-functions/src
  • firebase-installations/src
  • firebase-messaging/src
  • firebase-perf/src
  • firebase-storage/src
    • androidMain/kotlin/dev/gitlive/firebase/storage
    • iosMain/kotlin/dev/gitlive/firebase/storage

22 files changed

+53
-2
lines changed

firebase-app/src/androidMain/kotlin/dev/gitlive/firebase/firebase.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public actual typealias FirebaseTooManyRequestsException = com.google.firebase.F
1414

1515
public actual typealias FirebaseApiNotAvailableException = com.google.firebase.FirebaseApiNotAvailableException
1616

17+
public val FirebaseApp.android: com.google.firebase.FirebaseApp get() = com.google.firebase.FirebaseApp.getInstance()
18+
1719
public actual val Firebase.app: FirebaseApp
1820
get() = FirebaseApp(com.google.firebase.FirebaseApp.getInstance())
1921

firebase-app/src/iosMain/kotlin/dev/gitlive/firebase/firebase.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public actual open class FirebaseNetworkException(message: String) : FirebaseExc
1212
public actual open class FirebaseTooManyRequestsException(message: String) : FirebaseException(message)
1313
public actual open class FirebaseApiNotAvailableException(message: String) : FirebaseException(message)
1414

15+
public val Firebase.ios: FIRApp get() = FIRApp.defaultApp()!!
16+
1517
public actual val Firebase.app: FirebaseApp
1618
get() = FirebaseApp(FIRApp.defaultApp()!!)
1719

firebase-auth/src/androidMain/kotlin/dev/gitlive/firebase/auth/auth.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ import com.google.firebase.auth.ActionCodeResult.*
1212
import com.google.firebase.auth.FirebaseAuth.AuthStateListener
1313
import dev.gitlive.firebase.Firebase
1414
import dev.gitlive.firebase.FirebaseApp
15+
import dev.gitlive.firebase.auth.auth
1516
import kotlinx.coroutines.channels.awaitClose
1617
import kotlinx.coroutines.flow.Flow
1718
import kotlinx.coroutines.flow.callbackFlow
1819
import kotlinx.coroutines.tasks.await
1920

21+
public val FirebaseAuth.android: com.google.firebase.auth.FirebaseAuth get() = com.google.firebase.auth.FirebaseAuth.getInstance()
22+
2023
public actual val Firebase.auth: FirebaseAuth
2124
get() = FirebaseAuth(com.google.firebase.auth.FirebaseAuth.getInstance())
2225

firebase-auth/src/iosMain/kotlin/dev/gitlive/firebase/auth/auth.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import kotlinx.coroutines.flow.Flow
1818
import platform.Foundation.NSError
1919
import platform.Foundation.NSURL
2020

21+
public val FirebaseAuth.ios: FIRAuth get() = FIRAuth.auth()
22+
2123
public actual val Firebase.auth: FirebaseAuth
2224
get() = FirebaseAuth(FIRAuth.auth())
2325

firebase-config/src/androidMain/kotlin/dev/gitlive/firebase/remoteconfig/FirebaseRemoteConfig.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import com.google.firebase.remoteconfig.FirebaseRemoteConfig as AndroidFirebaseR
1515
import com.google.firebase.remoteconfig.FirebaseRemoteConfigInfo as AndroidFirebaseRemoteConfigInfo
1616
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings as AndroidFirebaseRemoteConfigSettings
1717

18+
public val FirebaseRemoteConfig.android: AndroidFirebaseRemoteConfig get() = AndroidFirebaseRemoteConfig.getInstance()
19+
1820
public actual val Firebase.remoteConfig: FirebaseRemoteConfig
1921
get() = FirebaseRemoteConfig(com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance())
2022

firebase-config/src/iosMain/kotlin/dev/gitlive/firebase/remoteconfig/FirebaseRemoteConfig.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import kotlin.time.Duration
2020
import kotlin.time.Duration.Companion.seconds
2121
import kotlin.time.DurationUnit
2222

23+
public val FirebaseRemoteConfig.ios: FIRRemoteConfig get() = FIRRemoteConfig.remoteConfig()
24+
2325
public actual val Firebase.remoteConfig: FirebaseRemoteConfig
2426
get() = FirebaseRemoteConfig(FIRRemoteConfig.remoteConfig())
2527

firebase-crashlytics/src/androidMain/kotlin/dev/gitlive/firebase/crashlytics/crashlytics.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ package dev.gitlive.firebase.crashlytics
22

33
import com.google.firebase.FirebaseException
44
import com.google.firebase.crashlytics.CustomKeysAndValues.Builder
5+
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
56
import dev.gitlive.firebase.Firebase
67
import dev.gitlive.firebase.FirebaseApp
78

9+
public val FirebaseCrashlytics.android: com.google.firebase.crashlytics.FirebaseCrashlytics get() = com.google.firebase.crashlytics.FirebaseCrashlytics.getInstance()
10+
811
public actual val Firebase.crashlytics: FirebaseCrashlytics get() =
912
FirebaseCrashlytics(com.google.firebase.crashlytics.FirebaseCrashlytics.getInstance())
1013

firebase-crashlytics/src/iosMain/kotlin/dev/gitlive/firebase/crashlytics/crashlytics.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import dev.gitlive.firebase.Firebase
77
import dev.gitlive.firebase.FirebaseApp
88
import dev.gitlive.firebase.FirebaseException
99

10+
public val FirebaseCrashlytics.ios: FIRCrashlytics get() = FIRCrashlytics.crashlytics()
11+
1012
public actual val Firebase.crashlytics: FirebaseCrashlytics get() =
1113
FirebaseCrashlytics(FIRCrashlytics.crashlytics())
1214

firebase-database/src/androidMain/kotlin/dev/gitlive/firebase/database/database.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import kotlinx.serialization.KSerializer
4040
import java.util.WeakHashMap
4141
import kotlin.time.Duration.Companion.seconds
4242

43+
public val FirebaseDatabase.android: com.google.firebase.database.FirebaseDatabase get() = com.google.firebase.database.FirebaseDatabase.getInstance()
44+
4345
internal suspend fun <T> Task<T>.awaitWhileOnline(database: FirebaseDatabase): T =
4446
merge(
4547
flow { emit(await()) },

firebase-database/src/iosMain/kotlin/dev/gitlive/firebase/database/database.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import kotlinx.serialization.KSerializer
4242
import platform.Foundation.NSError
4343
import platform.Foundation.allObjects
4444

45+
public val FirebaseDatabase.ios: FIRDatabase get() = FIRDatabase.database()
46+
4547
public actual val Firebase.database: FirebaseDatabase
4648
by lazy { FirebaseDatabase(FIRDatabase.database()) }
4749

0 commit comments

Comments
 (0)