diff --git a/.gitignore b/.gitignore index fca2b26..1f18998 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,7 @@ Thumbs.db # Editor .vscode/ .idea/ + +# Firebase service-account keys (SECRET private key — NEVER commit) +**/*firebase-adminsdk*.json +**/*service-account*.json diff --git a/codemagic.yaml b/codemagic.yaml index 18f226e..5277562 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -218,16 +218,24 @@ workflows: # camera/mic/notification permissions the web UI needs (mirrors ios-patch.sh for iOS). Tolerant + idempotent. node scripts/android-patch.js android/app/src/main/AndroidManifest.xml - - name: (Optional) Firebase google-services.json for FCM push + - name: Firebase google-services.json for FCM push script: | - cd mobile/android/app - if [ -n "$GOOGLE_SERVICES_JSON" ]; then - # Portable decode: GNU coreutils uses --decode/-d, BSD/macOS base64 uses -D. - echo "$GOOGLE_SERVICES_JSON" | { base64 --decode 2>/dev/null || base64 -D; } > google-services.json - echo "google-services.json written — FCM push enabled in this build" + # Place the client Firebase config into android/app/ so the google-services Gradle plugin applies and + # FirebaseApp initializes at runtime — WITHOUT it, PushNotifications.register() throws + # "Default FirebaseApp is not initialized" and crashes the app on Android. Prefer the committed file; + # fall back to a base64 GOOGLE_SERVICES_JSON env var. (Runs from the repo root; the Android project was + # generated in the previous step.) + DEST=mobile/android/app/google-services.json + if [ -f mobile/FirebaseAccount_Google/google-services.json ]; then + cp mobile/FirebaseAccount_Google/google-services.json "$DEST" + echo "google-services.json copied from repo → FCM enabled" + elif [ -n "$GOOGLE_SERVICES_JSON" ]; then + echo "$GOOGLE_SERVICES_JSON" | { base64 --decode 2>/dev/null || base64 -D; } > "$DEST" + echo "google-services.json written from env → FCM enabled" else - echo "No GOOGLE_SERVICES_JSON set — building WITHOUT FCM push (fine for a shell/UI test build)" + echo "No google-services.json found — building WITHOUT FCM push" fi + ls -l "$DEST" 2>/dev/null || echo "(no google-services.json placed)" - name: Build the debug APK script: | diff --git a/mobile/FirebaseAccount_Google/google-services.json b/mobile/FirebaseAccount_Google/google-services.json new file mode 100644 index 0000000..3b29529 --- /dev/null +++ b/mobile/FirebaseAccount_Google/google-services.json @@ -0,0 +1,29 @@ +{ + "project_info": { + "project_number": "860472998800", + "project_id": "bizgaze-connect", + "storage_bucket": "bizgaze-connect.firebasestorage.app" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:860472998800:android:107cc0fc6936d6898dd115", + "android_client_info": { + "package_name": "com.bizgaze.connect" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyB6gSqIDYr21GKYA4c1e7plUBQMXIcX1Dw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file