Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix passing GCMSenderId to FirebaseOptions on Android/iOS #447

Merged
merged 4 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ actual fun Firebase.initialize(context: Any?, options: FirebaseOptions, name: St
actual fun Firebase.initialize(context: Any?, options: FirebaseOptions) =
FirebaseApp(com.google.firebase.FirebaseApp.initializeApp(context as Context, options.toAndroid()))

actual class FirebaseApp internal constructor(val android: com.google.firebase.FirebaseApp) {
actual data class FirebaseApp internal constructor(val android: com.google.firebase.FirebaseApp) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a data class now?

Copy link
Contributor Author

@Daeda88 Daeda88 Jan 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you can do proper equality checks. Useful for testing

I other words: 'Firebase.app("name") == Firebase.app("name")' should return true, as it would on the regular sdks

actual val name: String
get() = android.name
actual val options: FirebaseOptions
get() = android.options.run { FirebaseOptions(applicationId, apiKey, databaseUrl, gaTrackingId, storageBucket, projectId) }
get() = android.options.run { FirebaseOptions(applicationId, apiKey, databaseUrl, gaTrackingId, storageBucket, projectId, gcmSenderId) }

actual suspend fun delete() {
android.delete()
Expand All @@ -51,4 +51,4 @@ private fun FirebaseOptions.toAndroid() = com.google.firebase.FirebaseOptions.Bu
.setStorageBucket(storageBucket)
.setProjectId(projectId)
.setGcmSenderId(gcmSenderId)
.build()
.build()
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ actual fun Firebase.initialize(context: Any?, options: FirebaseOptions, name: St
actual fun Firebase.initialize(context: Any?, options: FirebaseOptions) =
FIRApp.configureWithOptions(options.toIos()).let { app }

actual class FirebaseApp internal constructor(val ios: FIRApp) {
actual data class FirebaseApp internal constructor(val ios: FIRApp) {
actual val name: String
get() = ios.name
actual val options: FirebaseOptions
get() = ios.options.run { FirebaseOptions(bundleID, APIKey!!, databaseURL!!, trackingID, storageBucket, projectID) }
get() = ios.options.run { FirebaseOptions(bundleID, APIKey!!, databaseURL!!, trackingID, storageBucket, projectID, GCMSenderID) }

actual suspend fun delete() {
val deleted = CompletableDeferred<Unit>()
Expand Down
2 changes: 1 addition & 1 deletion firebase-crashlytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gitlive/firebase-crashlytics",
"version": "1.11.4",
"version": "1.11.0",
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
"main": "firebase-crashlytics.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion firebase-installations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gitlive/firebase-installations",
"version": "1.11.4",
"version": "1.11.0",
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
"main": "firebase-installations.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion firebase-perf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gitlive/firebase-perf",
"version": "1.11.4",
"version": "1.11.0",
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
"main": "firebase-perf.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion firebase-storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gitlive/firebase-storage",
"version": "1.11.4",
"version": "1.11.0",
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
"main": "firebase-storage.js",
"scripts": {
Expand Down
Loading