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

Integrate Firebase for Android and iOS #21983

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from

Conversation

seanstrom
Copy link
Member

@seanstrom seanstrom commented Jan 24, 2025

resolves #22090
resolves #22174

Summary

  • This PR attempts to integrate the react-native Firebase SDK into both the iOS and Android apps.

Review notes

  • As a note to reviewers, this PR is the first step towards integrating Firebase across the mobile apps. This PR will introduce new native dependencies and will likely require a make clean before rebuilding the app.

Testing notes

  • Testing the integration of this PR will require access to the Firebase app console, and/or a terminal to send push notification requests through the Status push notification servers.

Platforms

  • Android
  • iOS

Areas that may be impacted

Functional

  • Android Remote Push Notifications
  • iOS Remote Push Notifications

Steps to test

WIP

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Jan 24, 2025

Jenkins Builds

Click to see older builds (83)
Commit #️⃣ Finished (UTC) Duration Platform Result
5d1c4d5 #1 2025-01-24 11:38:49 ~8 min tests 📄log
✔️ 5d1c4d5 #1 2025-01-24 11:42:22 ~12 min ios 📱ipa 📲
✔️ 5d1c4d5 #1 2025-01-24 11:43:50 ~13 min android-e2e 🤖apk 📲
✔️ 5d1c4d5 #1 2025-01-24 11:44:36 ~14 min android 🤖apk 📲
77b27d4 #2 2025-01-24 15:40:29 ~11 min tests 📄log
✔️ 77b27d4 #2 2025-01-24 15:43:28 ~14 min android 🤖apk 📲
✔️ 77b27d4 #2 2025-01-24 15:45:03 ~15 min ios 📱ipa 📲
d61b665 #3 2025-01-24 15:54:13 ~5 min tests 📄log
✔️ d61b665 #3 2025-01-24 15:58:20 ~9 min android-e2e 🤖apk 📲
✔️ d61b665 #3 2025-01-24 15:59:30 ~10 min android 🤖apk 📲
✔️ d61b665 #3 2025-01-24 15:59:48 ~10 min ios 📱ipa 📲
0c19fa4 #4 2025-01-24 16:01:33 ~25 sec ios 📄log
0c19fa4 #4 2025-01-24 16:01:41 ~34 sec android 📄log
373e3c1 #5 2025-01-24 16:03:36 ~24 sec ios 📄log
373e3c1 #5 2025-01-24 16:03:40 ~32 sec android-e2e 📄log
373e3c1 #5 2025-01-24 16:05:12 ~2 min android 📄log
373e3c1 #5 2025-01-24 16:05:47 ~2 min tests 📄log
00c90b7 #6 2025-01-24 16:09:49 ~2 min tests 📄log
✔️ 00c90b7 #6 2025-01-24 16:13:59 ~7 min android 🤖apk 📲
✔️ 00c90b7 #6 2025-01-24 16:14:51 ~8 min android-e2e 🤖apk 📲
✔️ 00c90b7 #6 2025-01-24 16:16:40 ~9 min ios 📱ipa 📲
✔️ e49478b #7 2025-01-24 16:27:02 ~4 min tests 📄log
✔️ e49478b #7 2025-01-24 16:30:29 ~8 min android 🤖apk 📲
✔️ e49478b #7 2025-01-24 16:30:36 ~8 min android-e2e 🤖apk 📲
✔️ e49478b #7 2025-01-24 16:36:38 ~14 min ios 📱ipa 📲
✔️ ca8441e #8 2025-01-31 11:36:26 ~4 min tests 📄log
✔️ ca8441e #8 2025-01-31 11:39:50 ~8 min android 🤖apk 📲
✔️ ca8441e #8 2025-01-31 11:40:01 ~8 min android-e2e 🤖apk 📲
✔️ ca8441e #8 2025-01-31 11:41:52 ~10 min ios 📱ipa 📲
✔️ a1d94fd #9 2025-02-10 06:52:21 ~4 min tests 📄log
✔️ a1d94fd #9 2025-02-10 06:56:25 ~9 min android-e2e 🤖apk 📲
✔️ a1d94fd #9 2025-02-10 06:56:56 ~9 min android 🤖apk 📲
✔️ a1d94fd #9 2025-02-10 06:57:48 ~10 min ios 📱ipa 📲
✔️ 5307db3 #10 2025-02-10 13:09:40 ~4 min tests 📄log
✔️ 5307db3 #10 2025-02-10 13:13:49 ~8 min android-e2e 🤖apk 📲
✔️ 5307db3 #10 2025-02-10 13:14:24 ~9 min android 🤖apk 📲
✔️ 5307db3 #10 2025-02-10 13:14:35 ~9 min ios 📱ipa 📲
✔️ be2a8c2 #11 2025-02-13 11:14:15 ~4 min tests 📄log
✔️ be2a8c2 #11 2025-02-13 11:17:32 ~8 min android-e2e 🤖apk 📲
✔️ be2a8c2 #11 2025-02-13 11:18:05 ~8 min android 🤖apk 📲
✔️ be2a8c2 #11 2025-02-13 11:19:50 ~10 min ios 📱ipa 📲
✔️ 818b1fd #12 2025-02-17 07:33:41 ~4 min tests 📄log
✔️ 818b1fd #12 2025-02-17 07:35:33 ~6 min android-e2e 🤖apk 📲
✔️ 818b1fd #12 2025-02-17 07:37:51 ~9 min android 🤖apk 📲
✔️ 818b1fd #12 2025-02-17 07:38:57 ~10 min ios 📱ipa 📲
✔️ c8f1543 #13 2025-02-18 13:03:47 ~7 min tests 📄log
✔️ c8f1543 #13 2025-02-18 13:07:39 ~10 min android 🤖apk 📲
✔️ c8f1543 #13 2025-02-18 13:07:45 ~11 min android-e2e 🤖apk 📲
✔️ c8f1543 #13 2025-02-18 13:08:01 ~11 min ios 📱ipa 📲
f58e51a #15 2025-02-21 12:34:12 ~8 min tests 📄log
f58e51a #15 2025-02-21 12:36:07 ~10 min android 📄log
f58e51a #15 2025-02-21 12:36:09 ~10 min android-e2e 📄log
✔️ f58e51a #15 2025-02-21 12:41:39 ~16 min ios 📱ipa 📲
✔️ fb74c25 #17 2025-02-24 09:12:49 ~8 min android-e2e 🤖apk 📲
fb74c25 #17 2025-02-24 09:14:24 ~10 min tests 📄log
fb74c25 #17 2025-02-24 09:14:36 ~10 min android 📄log
✔️ fb74c25 #17 2025-02-24 09:16:41 ~12 min ios 📱ipa 📲
6c73939 #18 2025-02-24 12:44:03 ~10 min android 📄log
6c73939 #18 2025-02-24 12:44:13 ~10 min tests 📄log
✔️ 6c73939 #18 2025-02-24 12:44:47 ~11 min ios 📱ipa 📲
✔️ 6c73939 #18 2025-02-24 12:46:17 ~12 min android-e2e 🤖apk 📲
✔️ 066e74c #19 2025-02-24 13:10:37 ~7 min android-e2e 🤖apk 📲
066e74c #19 2025-02-24 13:13:15 ~10 min android 📄log
066e74c #19 2025-02-24 13:13:16 ~10 min tests 📄log
✔️ 066e74c #19 2025-02-24 13:15:34 ~12 min ios 📱ipa 📲
✔️ 8fbb226 #20 2025-02-24 13:24:11 ~6 min android-e2e 🤖apk 📲
8fbb226 #20 2025-02-24 13:25:03 ~7 min tests 📄log
✔️ 8fbb226 #20 2025-02-24 13:27:12 ~9 min ios 📱ipa 📲
✔️ 8fbb226 #20 2025-02-24 13:31:14 ~13 min android 🤖apk 📲
✔️ 408bbf2 #21 2025-02-24 15:19:55 ~5 min tests 📄log
✔️ 408bbf2 #21 2025-02-24 15:22:33 ~8 min android-e2e 🤖apk 📲
✔️ 408bbf2 #21 2025-02-24 15:23:50 ~9 min android 🤖apk 📲
✔️ 408bbf2 #21 2025-02-24 15:33:10 ~18 min ios 📱ipa 📲
✔️ 86757ba #22 2025-02-26 13:09:32 ~4 min tests 📄log
86757ba #22 2025-02-26 13:10:54 ~6 min ios 📄log
✔️ 86757ba #22 2025-02-26 13:11:39 ~6 min android-e2e 🤖apk 📲
✔️ 86757ba #22 2025-02-26 13:13:26 ~8 min android 🤖apk 📲
64e9ef3 #23 2025-02-26 13:32:38 ~2 min ios 📄log
✔️ 64e9ef3 #23 2025-02-26 13:34:57 ~5 min tests 📄log
✔️ 64e9ef3 #23 2025-02-26 13:39:01 ~9 min android-e2e 🤖apk 📲
✔️ 64e9ef3 #23 2025-02-26 13:39:29 ~9 min android 🤖apk 📲
d455ee1 #24 2025-02-26 14:17:19 ~3 min ios 📄log
✔️ d455ee1 #24 2025-02-26 14:18:42 ~5 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
9173de4 #25 2025-02-26 14:25:38 ~3 min ios 📄log
✔️ 9173de4 #25 2025-02-26 14:27:23 ~4 min tests 📄log
✔️ 9173de4 #25 2025-02-26 14:29:13 ~6 min android-e2e 🤖apk 📲
✔️ 9173de4 #25 2025-02-26 14:31:00 ~8 min android 🤖apk 📲
a13ab31 #26 2025-02-27 10:48:21 ~2 min tests 📄log
a13ab31 #26 2025-02-27 10:48:34 ~2 min ios 📄log
✔️ a13ab31 #26 2025-02-27 10:53:46 ~8 min android-e2e 🤖apk 📲
✔️ a13ab31 #26 2025-02-27 10:54:23 ~8 min android 🤖apk 📲

@seanstrom seanstrom force-pushed the seanstrom/firebase-integration branch 6 times, most recently from e49478b to ca8441e Compare January 31, 2025 11:31
@seanstrom seanstrom force-pushed the seanstrom/firebase-integration branch 3 times, most recently from 5307db3 to be2a8c2 Compare February 13, 2025 11:09
@seanstrom seanstrom force-pushed the seanstrom/firebase-integration branch 3 times, most recently from 4453b01 to f58e51a Compare February 21, 2025 12:25
@seanstrom seanstrom force-pushed the seanstrom/firebase-integration branch 2 times, most recently from fb74c25 to 6c73939 Compare February 24, 2025 12:33
@seanstrom seanstrom changed the title wip: re-integrate firebase Integrate Firebase for Android and iOS Feb 24, 2025
@seanstrom seanstrom marked this pull request as ready for review February 24, 2025 12:53
@seanstrom seanstrom requested a review from jakubgs as a code owner February 24, 2025 12:53
Copy link
Member Author

@seanstrom seanstrom left a comment

Choose a reason for hiding this comment

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

First pass self-review comments 📑

I've attempted to review some the confusing portions of the code, but there are still places involving the logic that I have not commented yet. I'll return for another pass on these areas soon.

.env.jenkins Outdated
Comment on lines 38 to 42
FLAG_WALLET_CONNECT_ENABLED=1
API_LOGGING_ENABLED=1
GOOGLE_FREE=0
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're adding a environment variable for configuring the build to avoid bundling Google dependencies for Firebase and Google Play Services.

Comment on lines 212 to 216
build-fdroid: ##@build Build release for F-Droid
@scripts/google-free.sh
@scripts/build-android.sh

Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're adding an additional script step for preparing an Android build for FDroid.

@@ -1 +1 @@
2.32.0
2.32.21983
Copy link
Member Author

Choose a reason for hiding this comment

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

This version change is temporary and should be removed before merge.

Copy link
Member Author

Choose a reason for hiding this comment

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

This version change is used for creating a testable release builds via the PR number, and as a best practice we change the app version number so we don't conflicts with upcoming releases in the build pipeline.

Comment on lines 86 to 90
/**
* Exclude google library so we can publish to external android stores
*/
def googleFree = project.env.get("GOOGLE_FREE", 0) == '1'

Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're accessing the environment variable from the Android build system (Gradle), and we use this flag to configure the build's dependencies.

Comment on lines 298 to 311
if (googleFree) {
implementation(project(':react-native-firebase_app')) {
exclude group: 'com.google.firebase'
exclude group: 'com.google.gms'
}

implementation(project(':react-native-firebase_messaging')) {
exclude group: 'com.google.firebase'
exclude group: 'com.google.gms'
}
} else {
implementation 'com.google.firebase:firebase-messaging:24.1.0'
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're attempting to exclude Firebase and Google dependencies from the app when attempting to build a FDroid build.

Comment on lines 57 to 62
# Used by Clojure at compile time for remove import of firebase for fdroid release
if [[ -n "${READER_FEATURES}" ]]; then
append_env_export 'READER_FEATURES'
fi

Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're integrating with ShadowCLJS during the Android build to forward the GOOGLE_FREE flag as a reader conditional. This allows us to conditionally include Firebase dependencies in JavaScript bundle.

Comment on lines +1 to +11
#!/usr/bin/env bash

set -e

# Used by Clojure to condition code and Gradle to make dependencies optional
sed -i -e '$aGOOGLE_FREE=1' .env.release

# remove firebase (uses google dependencies) and google-services.json for the fdroid-build
yarn remove @react-native-firebase/app
yarn remove @react-native-firebase/messaging
rm android/app/google-services.json
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're defining a cleanup script for the FDroid builds that removes Firebase dependencies and related files before continuing with building Android app for FDroid.

shadow-cljs.edn Outdated
Comment on lines 110 to 112
:reader-features #{:mobile
#shadow/env ["READER_FEATURES" :as :keyword :default
:cljs]}}
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're configuring ShadowCLJS mobile build with the extra reader conditional flags.

Comment on lines 19 to 24
::profile-pictures-visibility (enabled-in-env? :FLAG_PROFILE_PICTURES_VISIBILITY_ENABLED)
::settings.import-all-keypairs (enabled-in-env? :FLAG_WALLET_SETTINGS_IMPORT_ALL_KEYPAIRS)
::settings.remote-notifications (enabled-in-env? :FLAG_NOTIFICATION_SETTINGS_REMOTE_NOTIFICATIONS)
::wallet.add-watched-address (enabled-in-env? :FLAG_ADD_WATCHED_ADDRESS)
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're adding the feature flag for the remote notifications toggle.

Comment on lines 1 to 11
(ns react-native.firebase
(:require
#?@(:google-free
[[react-native.firebase.firebase-fdroid]]
:cljs
[[react-native.firebase.firebase-google]])))

#?(:google-free
[(def request-remote-token react-native.firebase.firebase-fdroid/request-remote-token)]
:cljs
[(def request-remote-token react-native.firebase.firebase-google/request-remote-token)])
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we're using the ShadowCLJS reader conditionals to avoid requiring the Firebase bindings and dependencies when building for FDroid.

@seanstrom seanstrom force-pushed the seanstrom/firebase-integration branch from d455ee1 to 9173de4 Compare February 26, 2025 14:22
@seanstrom seanstrom force-pushed the seanstrom/firebase-integration branch from 9173de4 to a13ab31 Compare February 27, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: CONTRIBUTOR
Development

Successfully merging this pull request may close these issues.

Integrate Firebase push notifications for iOS devices Re-integrate Firebase push notifications for Android
2 participants