feat(firebase): integrate Firebase + APNs/FCM push notifications

Phase 2 of multi-environment setup. Adds Firebase core, Crashlytics,
Analytics, Remote Config, Performance, Messaging and flutter_local_notifications,
plus full APNs configuration for iOS push.

- Wire setupFirebase(env) and setupNotifications() in initApp
- Add firebase_options for dev and staging via flutterfire (sf-platform-pre)
- Register google-services / firebase-perf / crashlytics gradle plugins
- Add per-flavor GoogleService-Info.plist with Build Phase script that
  copies the right plist into the .app bundle based on \$CONFIGURATION
- Bump iOS deployment target 13.0 -> 15.0 (required by firebase_analytics)
- Pin flutter_local_notifications to ^19.4.2 (v20+ needs Dart SDK >=3.10)
- Add aps-environment to staging (development) and production entitlements;
  development flavor intentionally excluded (no App Store Connect entry)
- Fix AppDelegate.swift to call super.application after forwarding to
  AntelopAppDelegate, otherwise Firebase Messaging swizzling breaks and
  the APNs token is never captured
- Crashlytics reports in all builds (debug + release) for early detection
- Tag analytics events with env user property per flavor
- App Check intentionally not included (debug-token friction with large
  QA team); can be re-added release-only later
This commit is contained in:
2026-04-07 03:31:09 +02:00
parent c1954497b8
commit 81284d7efe
23 changed files with 1156 additions and 27 deletions

View File

@@ -3,6 +3,11 @@ import java.io.FileInputStream
plugins {
id("com.android.application")
// START: FlutterFire Configuration
id("com.google.gms.google-services")
id("com.google.firebase.firebase-perf")
id("com.google.firebase.crashlytics")
// END: FlutterFire Configuration
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")

View File

@@ -0,0 +1,48 @@
{
"project_info": {
"project_number": "535646668726",
"project_id": "sf-platform-pre",
"storage_bucket": "sf-platform-pre.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:535646668726:android:c3a09d6c26f0cdf95e6317",
"android_client_info": {
"package_name": "com.savefamily.app.dev"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAzo8E_L6iUYWmK1BDFpNqRri1df6CqJiY"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:535646668726:android:b87245b807258e3e5e6317",
"android_client_info": {
"package_name": "com.savefamily.app.stag"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAzo8E_L6iUYWmK1BDFpNqRri1df6CqJiY"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@@ -21,6 +21,9 @@ plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.9.1" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
id("com.google.gms.google-services") version "4.4.2" apply false
id("com.google.firebase.firebase-perf") version "1.4.2" apply false
id("com.google.firebase.crashlytics") version "3.0.2" apply false
}
include(":app")

View File

@@ -0,0 +1 @@
{"flutter":{"platforms":{"android":{"default":{"projectId":"sf-platform-pre","appId":"1:535646668726:android:b87245b807258e3e5e6317","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"sf-platform-pre","appId":"1:535646668726:ios:5172d626d02dfe215e6317","uploadDebugSymbols":true,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options_dev.dart":{"projectId":"sf-platform-pre","configurations":{"android":"1:535646668726:android:c3a09d6c26f0cdf95e6317","ios":"1:535646668726:ios:524afa641f61d7cb5e6317"}},"lib/firebase_options_staging.dart":{"projectId":"sf-platform-pre","configurations":{"android":"1:535646668726:android:b87245b807258e3e5e6317","ios":"1:535646668726:ios:5172d626d02dfe215e6317"}}}}}}

View File

@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '13.4'
platform :ios, '15.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@@ -1,21 +1,205 @@
PODS:
- Firebase/CoreOnly (12.9.0):
- FirebaseCore (~> 12.9.0)
- Firebase/Crashlytics (12.9.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 12.9.0)
- Firebase/Messaging (12.9.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 12.9.0)
- Firebase/Performance (12.9.0):
- Firebase/CoreOnly
- FirebasePerformance (~> 12.9.0)
- Firebase/RemoteConfig (12.9.0):
- Firebase/CoreOnly
- FirebaseRemoteConfig (~> 12.9.0)
- firebase_analytics (12.2.0):
- firebase_core
- FirebaseAnalytics (= 12.9.0)
- Flutter
- firebase_core (4.6.0):
- Firebase/CoreOnly (= 12.9.0)
- Flutter
- firebase_crashlytics (5.1.0):
- Firebase/Crashlytics (= 12.9.0)
- firebase_core
- Flutter
- firebase_messaging (16.1.3):
- Firebase/Messaging (= 12.9.0)
- firebase_core
- Flutter
- firebase_performance (0.11.2):
- Firebase/Performance (= 12.9.0)
- firebase_core
- Flutter
- firebase_remote_config (6.3.0):
- Firebase/RemoteConfig (= 12.9.0)
- firebase_core
- Flutter
- FirebaseABTesting (12.9.0):
- FirebaseCore (~> 12.9.0)
- FirebaseAnalytics (12.9.0):
- FirebaseAnalytics/Default (= 12.9.0)
- FirebaseCore (~> 12.9.0)
- FirebaseInstallations (~> 12.9.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- FirebaseAnalytics/Default (12.9.0):
- FirebaseCore (~> 12.9.0)
- FirebaseInstallations (~> 12.9.0)
- GoogleAppMeasurement/Default (= 12.9.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- FirebaseCore (12.9.0):
- FirebaseCoreInternal (~> 12.9.0)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/Logger (~> 8.1)
- FirebaseCoreExtension (12.9.0):
- FirebaseCore (~> 12.9.0)
- FirebaseCoreInternal (12.9.0):
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- FirebaseCrashlytics (12.9.0):
- FirebaseCore (~> 12.9.0)
- FirebaseInstallations (~> 12.9.0)
- FirebaseRemoteConfigInterop (~> 12.9.0)
- FirebaseSessions (~> 12.9.0)
- GoogleDataTransport (~> 10.1)
- GoogleUtilities/Environment (~> 8.1)
- nanopb (~> 3.30910.0)
- PromisesObjC (~> 2.4)
- FirebaseInstallations (12.9.0):
- FirebaseCore (~> 12.9.0)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/UserDefaults (~> 8.1)
- PromisesObjC (~> 2.4)
- FirebaseMessaging (12.9.0):
- FirebaseCore (~> 12.9.0)
- FirebaseInstallations (~> 12.9.0)
- GoogleDataTransport (~> 10.1)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/Reachability (~> 8.1)
- GoogleUtilities/UserDefaults (~> 8.1)
- nanopb (~> 3.30910.0)
- FirebasePerformance (12.9.0):
- FirebaseCore (~> 12.9.0)
- FirebaseInstallations (~> 12.9.0)
- FirebaseRemoteConfig (~> 12.9.0)
- FirebaseSessions (~> 12.9.0)
- GoogleDataTransport (~> 10.1)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/UserDefaults (~> 8.1)
- nanopb (~> 3.30910.0)
- FirebaseRemoteConfig (12.9.0):
- FirebaseABTesting (~> 12.9.0)
- FirebaseCore (~> 12.9.0)
- FirebaseInstallations (~> 12.9.0)
- FirebaseRemoteConfigInterop (~> 12.9.0)
- FirebaseSharedSwift (~> 12.9.0)
- GoogleUtilities/Environment (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- FirebaseRemoteConfigInterop (12.9.0)
- FirebaseSessions (12.9.0):
- FirebaseCore (~> 12.9.0)
- FirebaseCoreExtension (~> 12.9.0)
- FirebaseInstallations (~> 12.9.0)
- GoogleDataTransport (~> 10.1)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/UserDefaults (~> 8.1)
- nanopb (~> 3.30910.0)
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (12.9.0)
- Flutter (1.0.0)
- flutter_contacts (0.0.1):
- Flutter
- flutter_local_notifications (0.0.1):
- Flutter
- flutter_native_splash (2.4.3):
- Flutter
- flutter_treezor_entrust_sdk_bridge (0.0.1):
- Flutter
- GoogleAdsOnDeviceConversion (3.2.0):
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/Logger (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/Core (12.9.0):
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/Default (12.9.0):
- GoogleAdsOnDeviceConversion (~> 3.2.0)
- GoogleAppMeasurement/Core (= 12.9.0)
- GoogleAppMeasurement/IdentitySupport (= 12.9.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/IdentitySupport (12.9.0):
- GoogleAppMeasurement/Core (= 12.9.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- GoogleDataTransport (10.1.0):
- nanopb (~> 3.30910.0)
- PromisesObjC (~> 2.4)
- GoogleUtilities/AppDelegateSwizzler (8.1.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Privacy
- GoogleUtilities/Environment (8.1.0):
- GoogleUtilities/Privacy
- GoogleUtilities/Logger (8.1.0):
- GoogleUtilities/Environment
- GoogleUtilities/Privacy
- GoogleUtilities/MethodSwizzler (8.1.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/Network (8.1.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Privacy
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (8.1.0)":
- GoogleUtilities/Privacy
- GoogleUtilities/Privacy (8.1.0)
- GoogleUtilities/Reachability (8.1.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/UserDefaults (8.1.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- image_picker_ios (0.0.1):
- Flutter
- mobile_scanner (7.0.0):
- Flutter
- FlutterMacOS
- nanopb (3.30910.0):
- nanopb/decode (= 3.30910.0)
- nanopb/encode (= 3.30910.0)
- nanopb/decode (3.30910.0)
- nanopb/encode (3.30910.0)
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.3.0):
- Flutter
- PromisesObjC (2.4.0)
- PromisesSwift (2.4.0):
- PromisesObjC (= 2.4.0)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
@@ -28,8 +212,15 @@ PODS:
- FlutterMacOS
DEPENDENCIES:
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- firebase_performance (from `.symlinks/plugins/firebase_performance/ios`)
- firebase_remote_config (from `.symlinks/plugins/firebase_remote_config/ios`)
- Flutter (from `Flutter`)
- flutter_contacts (from `.symlinks/plugins/flutter_contacts/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_treezor_entrust_sdk_bridge (from `.symlinks/plugins/flutter_treezor_entrust_sdk_bridge/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
@@ -41,11 +232,49 @@ DEPENDENCIES:
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)
SPEC REPOS:
trunk:
- Firebase
- FirebaseABTesting
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreExtension
- FirebaseCoreInternal
- FirebaseCrashlytics
- FirebaseInstallations
- FirebaseMessaging
- FirebasePerformance
- FirebaseRemoteConfig
- FirebaseRemoteConfigInterop
- FirebaseSessions
- FirebaseSharedSwift
- GoogleAdsOnDeviceConversion
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleUtilities
- nanopb
- PromisesObjC
- PromisesSwift
EXTERNAL SOURCES:
firebase_analytics:
:path: ".symlinks/plugins/firebase_analytics/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_crashlytics:
:path: ".symlinks/plugins/firebase_crashlytics/ios"
firebase_messaging:
:path: ".symlinks/plugins/firebase_messaging/ios"
firebase_performance:
:path: ".symlinks/plugins/firebase_performance/ios"
firebase_remote_config:
:path: ".symlinks/plugins/firebase_remote_config/ios"
Flutter:
:path: Flutter
flutter_contacts:
:path: ".symlinks/plugins/flutter_contacts/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_treezor_entrust_sdk_bridge:
@@ -68,19 +297,47 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"
SPEC CHECKSUMS:
Firebase: 065f2bb395062046623036d8e6dc857bc2521d56
firebase_analytics: 42693ebf35c4d330b74abcb46ca80351703644e0
firebase_core: 98bcc1bd1a097bcb8b1ed6e091de3039802527c4
firebase_crashlytics: 2fd6c030ca2f91e8d3b13d2e6e9a08a282c9d259
firebase_messaging: e24e69d994d53e46fd794143544841877bd85a53
firebase_performance: 39d7f9632628c64cacd9e9808d4783cffd83eaa2
firebase_remote_config: 0d060eef0fdfb288ffc41903ba9a60bb963755ea
FirebaseABTesting: a399ffe546392a39b19a5c2fb28bd8ea178a6f47
FirebaseAnalytics: cd7d01d352f3c237c9a0e31552c257cd0b0c0352
FirebaseCore: 428912f751178b06bef0a1793effeb4a5e09a9b8
FirebaseCoreExtension: e911052d59cd0da237a45d706fc0f81654f035c1
FirebaseCoreInternal: b321eafae5362113bc182956fafc9922cfc77b72
FirebaseCrashlytics: 43913d587ef07beaf5db703baa61eacf9554658c
FirebaseInstallations: 7b64ffd006032b2b019a59b803858df5112d9eaa
FirebaseMessaging: 7d6cdbff969127c4151c824fe432f0e301210f15
FirebasePerformance: 94f614453614d8bb2a1a0177f3a1a6d2dbf4c504
FirebaseRemoteConfig: a2f6545e41551ffb520241d38b5d3d6776c9ebe8
FirebaseRemoteConfigInterop: 765ee19cd2bfa8e54937c8dae901eb634ad6787d
FirebaseSessions: a2d06fd980431fda934c7a543901aca05fc4edcc
FirebaseSharedSwift: 9d2fa84a46676302b89dbd5e6e62bce2fe376909
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_contacts: edb1c5ce76aa433e20e6cb14c615f4c0b66e0983
flutter_local_notifications: ff50f8405aaa0ccdc7dcfb9022ca192e8ad9688f
flutter_native_splash: df59bb2e1421aa0282cb2e95618af4dcb0c56c29
flutter_treezor_entrust_sdk_bridge: 4c2c94fb74ab57576e8d49f5f2a4b214e41141fe
GoogleAdsOnDeviceConversion: d68c69dd9581a0f5da02617b6f377e5be483970f
GoogleAppMeasurement: fce7c1c90640d2f9f5c56771f71deacb2ba3f98c
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
image_picker_ios: 4f2f91b01abdb52842a8e277617df877e40f905b
mobile_scanner: 77265f3dc8d580810e91849d4a0811a90467ed5e
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
path_provider_foundation: 0b743cbb62d8e47eab856f09262bb8c1ddcfe6ba
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
shared_preferences_foundation: 5086985c1d43c5ba4d5e69a4e8083a389e2909e6
url_launcher_ios: bb13df5870e8c4234ca12609d04010a21be43dfa
webview_flutter_wkwebview: 29eb20d43355b48fe7d07113835b9128f84e3af4
PODFILE CHECKSUM: 02dccdf227cb9aef09ff0299e4898a8a19004223
PODFILE CHECKSUM: 2ff48235bd696a83f30729eab21272c929e12684
COCOAPODS: 1.16.2

View File

@@ -18,6 +18,7 @@
AA0000011234567800000001 /* AntelopRelease.plist in Resources */ = {isa = PBXBuildFile; fileRef = AA0000011234567800000002 /* AntelopRelease.plist */; };
AA5000010000000000000001 /* AntelopRelease-development.plist in Resources */ = {isa = PBXBuildFile; fileRef = AA5000010000000000000002 /* AntelopRelease-development.plist */; };
AA5000010000000000000003 /* AntelopRelease-staging.plist in Resources */ = {isa = PBXBuildFile; fileRef = AA5000010000000000000004 /* AntelopRelease-staging.plist */; };
D6B9158A899AF56C44180233 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B8D66015CBEA02CDD29EB55 /* GoogleService-Info.plist */; };
FB256274E508EC552E337980 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B56AB2467FA9548370ACF02 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
@@ -53,6 +54,7 @@
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B8D66015CBEA02CDD29EB55 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
401E1064C971570DADB8AA9B /* Pods-RunnerTests.profile-development.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile-development.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile-development.xcconfig"; sourceTree = "<group>"; };
4B56AB2467FA9548370ACF02 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4E688A593FA9E76BDD0DFBFB /* Pods-Runner.debug-staging.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-staging.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-staging.xcconfig"; sourceTree = "<group>"; };
@@ -144,6 +146,7 @@
331C8082294A63A400263BE5 /* RunnerTests */,
CB8808A12E373F2255B5FC16 /* Pods */,
BE496D7F3574271661ADBDCE /* Frameworks */,
3B8D66015CBEA02CDD29EB55 /* GoogleService-Info.plist */,
);
sourceTree = "<group>";
};
@@ -252,8 +255,10 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
F0758EB530B1A8787EB3F30B /* Copy GoogleService-Info */,
437F5EA1E5D92D7C421FD996 /* [CP] Embed Pods Frameworks */,
791C3CA41F1AAEE1267769C8 /* [CP] Copy Pods Resources */,
0F0F4E82D9AA0B3E11014E72 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
);
buildRules = (
);
@@ -322,12 +327,31 @@
AA0000011234567800000001 /* AntelopRelease.plist in Resources */,
AA5000010000000000000001 /* AntelopRelease-development.plist in Resources */,
AA5000010000000000000003 /* AntelopRelease-staging.plist in Resources */,
D6B9158A899AF56C44180233 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
0F0F4E82D9AA0B3E11014E72 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\"";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\n#!/bin/bash\nPATH=\"${PATH}:$FLUTTER_ROOT/bin:${PUB_CACHE}/bin:$HOME/.pub-cache/bin\"\n\nif [ -z \"$PODS_ROOT\" ] || [ ! -d \"$PODS_ROOT/FirebaseCrashlytics\" ]; then\n # Cannot use \"BUILD_DIR%/Build/*\" as per Firebase documentation, it points to \"flutter-project/build/ios/*\" path which doesn't have run script\n DERIVED_DATA_PATH=$(echo \"$BUILD_ROOT\" | sed -E 's|(.*DerivedData/[^/]+).*|\\1|')\n PATH_TO_CRASHLYTICS_UPLOAD_SCRIPT=\"${DERIVED_DATA_PATH}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\"\nelse\n PATH_TO_CRASHLYTICS_UPLOAD_SCRIPT=\"$PODS_ROOT/FirebaseCrashlytics/run\"\nfi\n\n# Command to upload symbols script used to upload symbols to Firebase server\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=\"$PATH_TO_CRASHLYTICS_UPLOAD_SCRIPT\" --platform=ios --apple-project-path=\"${SRCROOT}\" --env-platform-name=\"${PLATFORM_NAME}\" --env-configuration=\"${CONFIGURATION}\" --env-project-dir=\"${PROJECT_DIR}\" --env-built-products-dir=\"${BUILT_PRODUCTS_DIR}\" --env-dwarf-dsym-folder-path=\"${DWARF_DSYM_FOLDER_PATH}\" --env-dwarf-dsym-file-name=\"${DWARF_DSYM_FILE_NAME}\" --env-infoplist-path=\"${INFOPLIST_PATH}\" --default-config=default\n";
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
@@ -437,6 +461,24 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
F0758EB530B1A8787EB3F30B /* Copy GoogleService-Info */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Copy GoogleService-Info";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/scripts/copy-google-service-plist.sh\"";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -530,7 +572,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -543,7 +585,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-development;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-development";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-development.entitlements";
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -661,7 +703,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -712,7 +754,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -727,7 +769,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-development;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-development";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-development.entitlements";
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -751,7 +793,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-development;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-development";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-development.entitlements";
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -819,7 +861,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -876,7 +918,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -927,7 +969,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -981,7 +1023,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -1035,7 +1077,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -1087,7 +1129,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -1100,7 +1142,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-staging;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-staging";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-staging.entitlements";
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -1124,7 +1166,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-production;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-production";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -1148,7 +1190,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-staging;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-staging";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-staging.entitlements";
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -1171,7 +1213,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-production;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-production";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -1194,7 +1236,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-staging;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-staging";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-staging.entitlements";
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
@@ -1217,7 +1259,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-production;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-production";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";

View File

@@ -23,12 +23,16 @@ import AntelopSDK
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
AntelopAppDelegate.shared.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
// Forward to FlutterAppDelegate so Firebase Messaging can capture the APNs token via swizzling.
super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
}
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
guard !AntelopAppDelegate.shared.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler) else {
if AntelopAppDelegate.shared.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler) {
return
}
// Forward to FlutterAppDelegate so Firebase Messaging can deliver the notification to Dart.
super.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
}
override func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>AIzaSyBeijehJIznndwIUlbMkj6reYT4z-WHGfQ</string>
<key>GCM_SENDER_ID</key>
<string>535646668726</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.savefamily.app.dev</string>
<key>PROJECT_ID</key>
<string>sf-platform-pre</string>
<key>STORAGE_BUCKET</key>
<string>sf-platform-pre.firebasestorage.app</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:535646668726:ios:524afa641f61d7cb5e6317</string>
</dict>
</plist>

View File

@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.savefamily.app.stag</string>

View File

@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.savefamily.app.prod</string>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>AIzaSyBeijehJIznndwIUlbMkj6reYT4z-WHGfQ</string>
<key>GCM_SENDER_ID</key>
<string>535646668726</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.savefamily.app.dev</string>
<key>PROJECT_ID</key>
<string>sf-platform-pre</string>
<key>STORAGE_BUCKET</key>
<string>sf-platform-pre.firebasestorage.app</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:535646668726:ios:524afa641f61d7cb5e6317</string>
</dict>
</plist>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>AIzaSyBeijehJIznndwIUlbMkj6reYT4z-WHGfQ</string>
<key>GCM_SENDER_ID</key>
<string>535646668726</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.savefamily.app.stag</string>
<key>PROJECT_ID</key>
<string>sf-platform-pre</string>
<key>STORAGE_BUCKET</key>
<string>sf-platform-pre.firebasestorage.app</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:535646668726:ios:5172d626d02dfe215e6317</string>
</dict>
</plist>

View File

@@ -0,0 +1,85 @@
#!/usr/bin/env ruby
#
# Adds a "Copy GoogleService-Info" Run Script Build Phase to the Runner target.
# The script copies ios/flavors/{flavor}/GoogleService-Info.plist to the .app
# bundle based on the build CONFIGURATION (Debug-development, Release-staging, etc.).
#
# Idempotent: if the build phase already exists, does nothing.
#
# Usage:
# ruby ios/scripts/add-copy-google-service-build-phase.rb
require 'xcodeproj'
PROJECT_PATH = File.expand_path('../../Runner.xcodeproj', __FILE__)
TARGET_NAME = 'Runner'
PHASE_NAME = 'Copy GoogleService-Info'
SHELL_SCRIPT = '"${SRCROOT}/scripts/copy-google-service-plist.sh"'
project = Xcodeproj::Project.open(PROJECT_PATH)
target = project.targets.find { |t| t.name == TARGET_NAME }
unless target
abort "ERROR: Target '#{TARGET_NAME}' not found in project."
end
# Check if the build phase already exists (idempotency)
existing = target.build_phases.find do |phase|
phase.is_a?(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) && phase.name == PHASE_NAME
end
if existing
puts "OK: Build phase '#{PHASE_NAME}' already exists. No changes needed."
exit 0
end
# Create the new build phase
phase = target.new_shell_script_build_phase(PHASE_NAME)
phase.shell_path = '/bin/sh'
phase.shell_script = SHELL_SCRIPT
phase.input_paths = []
phase.output_paths = []
phase.run_only_for_deployment_postprocessing = '0'
# Move it before the embed frameworks phase (or at the end if no such phase)
# Order: Sources -> Frameworks -> Resources -> ... -> ThinBinary -> CopyGoogleService -> EmbedPodsFrameworks -> CopyPodsResources
build_phases = target.build_phases
# Find the index of "Thin Binary" if it exists
thin_binary_idx = build_phases.find_index do |p|
p.respond_to?(:name) && p.name == 'Thin Binary'
end
# Find the index of "[CP] Embed Pods Frameworks" if it exists
embed_pods_idx = build_phases.find_index do |p|
p.respond_to?(:name) && p.name && p.name.include?('Embed Pods Frameworks')
end
# Remove the just-added phase from its current position (it gets appended at the end)
build_phases.delete(phase)
# Insert at the right spot
target_idx = if thin_binary_idx && embed_pods_idx && thin_binary_idx < embed_pods_idx
# Place between Thin Binary and Embed Pods Frameworks
embed_pods_idx
elsif thin_binary_idx
# Place right after Thin Binary
thin_binary_idx + 1
elsif embed_pods_idx
# Place right before Embed Pods Frameworks
embed_pods_idx
else
# Append at the end
build_phases.length
end
build_phases.insert(target_idx, phase)
project.save
puts "OK: Added build phase '#{PHASE_NAME}' at position #{target_idx}."
puts "Build phases order:"
target.build_phases.each_with_index do |p, i|
name = p.respond_to?(:name) && p.name ? p.name : p.class.name
puts " #{i}: #{name}"
end

View File

@@ -0,0 +1,35 @@
#!/bin/bash
#
# Copies the correct GoogleService-Info.plist into the .app bundle
# based on the active build CONFIGURATION (Debug-development,
# Release-staging, etc.). Reads from ios/flavors/{flavor}/GoogleService-Info.plist
# and writes to the final bundle.
#
# Add this as a Run Script Build Phase in Xcode AFTER "Thin Binary" and
# BEFORE "[CP] Embed Pods Frameworks" (or near the end of the phases).
set -e
echo "Configuration: ${CONFIGURATION}"
# Extract flavor from the build configuration name (everything after the last "-")
if [[ $CONFIGURATION =~ \-([^-]*)$ ]]; then
flavor=${BASH_REMATCH[1]}
else
echo "warning: Could not extract flavor from CONFIGURATION='${CONFIGURATION}', defaulting to 'development'"
flavor="development"
fi
echo "Flavor: $flavor"
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist
GOOGLESERVICE_INFO_FILE="${PROJECT_DIR}/flavors/${flavor}/${GOOGLESERVICE_INFO_PLIST}"
if [ ! -f "$GOOGLESERVICE_INFO_FILE" ]; then
echo "error: ${GOOGLESERVICE_INFO_FILE} not found"
exit 1
fi
PLIST_DESTINATION="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app"
echo "Copying ${GOOGLESERVICE_INFO_FILE} -> ${PLIST_DESTINATION}/${GOOGLESERVICE_INFO_PLIST}"
cp "${GOOGLESERVICE_INFO_FILE}" "${PLIST_DESTINATION}/${GOOGLESERVICE_INFO_PLIST}"

View File

@@ -0,0 +1,58 @@
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:firebase_performance/firebase_performance.dart';
import 'package:firebase_remote_config/firebase_remote_config.dart';
import 'package:flutter/foundation.dart';
import '../config/env/environment_enum.dart';
import '../firebase_options_dev.dart' as dev_options;
import '../firebase_options_staging.dart' as staging_options;
Future<void> setupFirebase(EnvironmentEnum env) async {
final FirebaseOptions options;
switch (env) {
case EnvironmentEnum.development:
options = dev_options.DefaultFirebaseOptions.currentPlatform;
case EnvironmentEnum.staging:
options = staging_options.DefaultFirebaseOptions.currentPlatform;
case EnvironmentEnum.production:
// TODO: replace with prod_options.DefaultFirebaseOptions.currentPlatform
// once the production Firebase project is created.
throw UnsupportedError(
'Production Firebase project is not configured yet. '
'Run `flutterfire configure --project=<prod-project-id>` and import it here.',
);
}
await Firebase.initializeApp(options: options);
// Report crashes in ALL builds (debug + release) so we catch issues during testing too.
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
PlatformDispatcher.instance.onError = (error, stack) {
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
return true;
};
await FirebaseAnalytics.instance.setUserProperty(
name: 'env',
value: env.name,
);
final remoteConfig = FirebaseRemoteConfig.instance;
await remoteConfig.setConfigSettings(
RemoteConfigSettings(
fetchTimeout: const Duration(minutes: 1),
minimumFetchInterval: kDebugMode
? const Duration(minutes: 1)
: const Duration(hours: 12),
),
);
try {
await remoteConfig.fetchAndActivate();
} catch (e) {
debugPrint('[Firebase] RemoteConfig fetch failed: $e');
}
FirebasePerformance.instance.setPerformanceCollectionEnabled(true);
}

View File

@@ -8,6 +8,8 @@ import 'package:sca_treezor/sca_treezor.dart';
import 'package:sf_app_platform/config/env/environment_enum.dart';
import 'package:sf_app_platform/config/env/save_family_env_config.dart';
import 'package:sf_app_platform/core/config/app_mode.dart';
import 'package:sf_app_platform/core/firebase_init.dart';
import 'package:sf_app_platform/core/notifications_init.dart';
import 'package:sf_app_platform/navigation/app_router.dart';
import 'package:sf_app_platform/save_family_app.dart';
import 'package:navigation/navigation.dart';
@@ -22,17 +24,14 @@ Future<void> initApp(EnvironmentEnum env) async {
configureAppRouter();
themePackages();
// --- Fase 2: Firebase ---
// await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
await setupFirebase(env);
await setupNotifications();
// --- Fase 2: Sentry ---
// await initSentry(env);
// TODO Fase 2: await initSentry(env);
await configureDependencies(
SaveFamilyEnvConfig(),
log: env.isDevelopment || kDebugMode,
// Treezor-specific detection (message + 500) runs in both modes;
// only the destination route differs based on the active app mode.
onTokenExpired: isPaymentMode
? () => appRouter.go(AppRoutes.scaTreezor)
: () => appRouter.go(AppRoutes.legacyLogin),

View File

@@ -0,0 +1,147 @@
import 'dart:convert';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
/// Background message handler. MUST be a top-level function annotated with
/// `@pragma('vm:entry-point')` so the Flutter engine can dispatch it from a
/// background isolate when the app is terminated or backgrounded.
///
/// This runs in a separate isolate: it CANNOT access main-isolate state
/// (providers, GetIt, navigation). Keep it side-effect free or schedule work
/// via shared_preferences. Do not call `Firebase.initializeApp` here —
/// firebase_messaging 14+ auto-initializes the default app for the background
/// isolate.
@pragma('vm:entry-point')
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
debugPrint(
'[FCM-bg] message received: ${message.messageId} - ${message.notification?.title}',
);
}
const String _localChannelId = 'sf_default_channel';
const String _localChannelName = 'General';
const String _localChannelDescription =
'General notifications shown while the app is in the foreground.';
final FlutterLocalNotificationsPlugin _localNotifications =
FlutterLocalNotificationsPlugin();
Future<void> setupNotifications() async {
final messaging = FirebaseMessaging.instance;
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
final settings = await messaging.requestPermission(
alert: true,
badge: true,
sound: true,
);
debugPrint('[FCM] permission: ${settings.authorizationStatus.name}');
await messaging.setForegroundNotificationPresentationOptions(
alert: true,
badge: true,
sound: true,
);
await _initLocalNotifications();
FirebaseMessaging.onMessage.listen(_onForegroundMessage);
FirebaseMessaging.onMessageOpenedApp.listen(_onMessageOpenedApp);
final initialMessage = await messaging.getInitialMessage();
if (initialMessage != null) {
_onMessageOpenedApp(initialMessage);
}
// TODO: integrate with backend (Treezor/SaveFamily api).
messaging.onTokenRefresh.listen((newToken) {
debugPrint('[FCM] token refreshed: $newToken');
});
try {
final token = await messaging.getToken();
debugPrint('[FCM] initial token: $token');
} catch (e) {
debugPrint('[FCM] getToken failed: $e');
}
}
Future<void> _initLocalNotifications() async {
const androidInit = AndroidInitializationSettings('@mipmap/ic_launcher');
const iosInit = DarwinInitializationSettings(
requestAlertPermission: false, // already requested via FirebaseMessaging
requestBadgePermission: false,
requestSoundPermission: false,
);
const initSettings = InitializationSettings(
android: androidInit,
iOS: iosInit,
);
await _localNotifications.initialize(
initSettings,
onDidReceiveNotificationResponse: _onLocalNotificationTapped,
);
// Android 8+ requires every notification to belong to a channel.
const channel = AndroidNotificationChannel(
_localChannelId,
_localChannelName,
description: _localChannelDescription,
importance: Importance.high,
);
await _localNotifications
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin
>()
?.createNotificationChannel(channel);
}
void _onForegroundMessage(RemoteMessage message) {
debugPrint(
'[FCM-fg] message received: ${message.messageId} - ${message.notification?.title}',
);
final notification = message.notification;
if (notification == null) return;
final notificationId = message.messageId?.hashCode ?? 0;
_localNotifications.show(
notificationId,
notification.title,
notification.body,
const NotificationDetails(
android: AndroidNotificationDetails(
_localChannelId,
_localChannelName,
channelDescription: _localChannelDescription,
importance: Importance.high,
priority: Priority.high,
),
iOS: DarwinNotificationDetails(
presentAlert: true,
presentBadge: true,
presentSound: true,
),
),
payload: jsonEncode(message.data),
);
}
void _onMessageOpenedApp(RemoteMessage message) {
debugPrint(
'[FCM-tap] user tapped notification: ${message.messageId} - data: ${message.data}',
);
// TODO: handle deep linking based on message.data.
}
void _onLocalNotificationTapped(NotificationResponse response) {
debugPrint(
'[FCM-localtap] user tapped local notification: id=${response.id} payload=${response.payload}',
);
// TODO: handle deep linking. Payload contains JSON-encoded message.data.
}

View File

@@ -0,0 +1,68 @@
// File generated by FlutterFire CLI.
// ignore_for_file: type=lint
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options_dev.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyAzo8E_L6iUYWmK1BDFpNqRri1df6CqJiY',
appId: '1:535646668726:android:c3a09d6c26f0cdf95e6317',
messagingSenderId: '535646668726',
projectId: 'sf-platform-pre',
storageBucket: 'sf-platform-pre.firebasestorage.app',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyBeijehJIznndwIUlbMkj6reYT4z-WHGfQ',
appId: '1:535646668726:ios:524afa641f61d7cb5e6317',
messagingSenderId: '535646668726',
projectId: 'sf-platform-pre',
storageBucket: 'sf-platform-pre.firebasestorage.app',
iosBundleId: 'com.savefamily.app.dev',
);
}

View File

@@ -0,0 +1,69 @@
// File generated by FlutterFire CLI.
// ignore_for_file: type=lint
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options_staging.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyAzo8E_L6iUYWmK1BDFpNqRri1df6CqJiY',
appId: '1:535646668726:android:b87245b807258e3e5e6317',
messagingSenderId: '535646668726',
projectId: 'sf-platform-pre',
storageBucket: 'sf-platform-pre.firebasestorage.app',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyBeijehJIznndwIUlbMkj6reYT4z-WHGfQ',
appId: '1:535646668726:ios:5172d626d02dfe215e6317',
messagingSenderId: '535646668726',
projectId: 'sf-platform-pre',
storageBucket: 'sf-platform-pre.firebasestorage.app',
iosBundleId: 'com.savefamily.app.stag',
);
}

View File

@@ -99,6 +99,16 @@ dependencies:
flutter_native_splash: ^2.4.7
permission_handler: ^12.0.1
dio: ^5.9.2
# Firebase
firebase_core: ^4.6.0
firebase_crashlytics: ^5.1.0
firebase_analytics: ^12.2.0
firebase_remote_config: ^6.3.0
firebase_messaging: ^16.1.3
firebase_performance: ^0.11.2
# Notifications (foreground display + tap handling)
flutter_local_notifications: ^19.4.2
dev_dependencies:
flutter_test:
sdk: flutter

View File

@@ -9,6 +9,18 @@
# ============================================================================
dependencies:
# ---------------- Firebase ----------------
firebase_core: ^4.6.0
firebase_crashlytics: ^5.1.0
firebase_analytics: ^12.2.0
firebase_remote_config: ^6.3.0
firebase_messaging: ^16.1.3
firebase_performance: ^0.11.2
# ---------------- Notifications ----------------
# Pinned to ^19 because v20+ requires Dart SDK >=3.10 (we are on 3.9.2).
flutter_local_notifications: ^19.4.2
# ---------------- Network ----------------
dio: ^5.9.2
dio_cookie_manager: ^3.3.0

View File

@@ -9,6 +9,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "85.0.0"
_flutterfire_internals:
dependency: transitive
description:
name: _flutterfire_internals
sha256: f698de6eb8a0dd7a9a931bbfe13568e8b77e702eb2deb13dd83480c5373e7746
url: "https://pub.dev"
source: hosted
version: "1.3.68"
analyzer:
dependency: transitive
description:
@@ -361,6 +369,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.1"
dbus:
dependency: transitive
description:
name: dbus
sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270
url: "https://pub.dev"
source: hosted
version: "0.7.12"
diacritic:
dependency: transitive
description:
@@ -457,6 +473,142 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.9.3+5"
firebase_analytics:
dependency: transitive
description:
name: firebase_analytics
sha256: e5679ed436d5554e230013287bbe993e41b97850e34972962d62140908e7b4ae
url: "https://pub.dev"
source: hosted
version: "12.2.0"
firebase_analytics_platform_interface:
dependency: transitive
description:
name: firebase_analytics_platform_interface
sha256: "121e8c54c69f7c4da0b99fc616d513db130dd407c8720ddd8cb63b4adaab70e6"
url: "https://pub.dev"
source: hosted
version: "5.1.0"
firebase_analytics_web:
dependency: transitive
description:
name: firebase_analytics_web
sha256: "0cabfa34f122858fde79719c88e49d76e16999df30d03d1601a457f25dfed7ab"
url: "https://pub.dev"
source: hosted
version: "0.6.1+4"
firebase_core:
dependency: transitive
description:
name: firebase_core
sha256: "2f988dab915efde3b3105268dbd69efce0e8570d767a218ccd914afd0c10c8cc"
url: "https://pub.dev"
source: hosted
version: "4.6.0"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
sha256: "0ecda14c1bfc9ed8cac303dd0f8d04a320811b479362a9a4efb14fd331a473ce"
url: "https://pub.dev"
source: hosted
version: "6.0.3"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
sha256: "1399ab1f0ac3b503d8a9be64a4c997fc066bbf33f701f42866e5569f26205ebe"
url: "https://pub.dev"
source: hosted
version: "3.5.1"
firebase_crashlytics:
dependency: transitive
description:
name: firebase_crashlytics
sha256: "9f9831b4ca1282421f4387181bfb8e6c4ee82049e616e433272c4fd13dfd5484"
url: "https://pub.dev"
source: hosted
version: "5.1.0"
firebase_crashlytics_platform_interface:
dependency: transitive
description:
name: firebase_crashlytics_platform_interface
sha256: "310f6ecc2bb27e36025c6777bef9d2e7dd32562a7cae3d914ea88ad5a2d536e4"
url: "https://pub.dev"
source: hosted
version: "3.8.19"
firebase_messaging:
dependency: transitive
description:
name: firebase_messaging
sha256: "8dc372085b1647f05e3ec1b8bc1dada87c0062f93b2a6976f620eb85edc44f97"
url: "https://pub.dev"
source: hosted
version: "16.1.3"
firebase_messaging_platform_interface:
dependency: transitive
description:
name: firebase_messaging_platform_interface
sha256: "6ea10f7df747542b17679d5939213c09163aab9c301b2f9b858cb55f38efdb54"
url: "https://pub.dev"
source: hosted
version: "4.7.8"
firebase_messaging_web:
dependency: transitive
description:
name: firebase_messaging_web
sha256: "1f9798c8021ccf22b7e43e7fba81becd42252cb168228379fcabb7c2ef7dd638"
url: "https://pub.dev"
source: hosted
version: "4.1.4"
firebase_performance:
dependency: transitive
description:
name: firebase_performance
sha256: "13512979e0f313e4c640e5508c14f5fb634eeb48091bbe1bc14711bba92e411c"
url: "https://pub.dev"
source: hosted
version: "0.11.2"
firebase_performance_platform_interface:
dependency: transitive
description:
name: firebase_performance_platform_interface
sha256: "7e7227f0b1d70fe5b9af69b9d1b9705897c899bcb5ec03127d184b2baf1e87ae"
url: "https://pub.dev"
source: hosted
version: "0.1.6+6"
firebase_performance_web:
dependency: transitive
description:
name: firebase_performance_web
sha256: c8498a78c0704c4910bd3048b9fbbd041db8a4f36cbef4ff4efabf14a4b03e43
url: "https://pub.dev"
source: hosted
version: "0.1.8+4"
firebase_remote_config:
dependency: transitive
description:
name: firebase_remote_config
sha256: "823c9017277daa6f754e6d7389de8fb4b96723894fca3f42cf0860019e6a4053"
url: "https://pub.dev"
source: hosted
version: "6.3.0"
firebase_remote_config_platform_interface:
dependency: transitive
description:
name: firebase_remote_config_platform_interface
sha256: "93662b23fc8cc4463f98355a2aeebbfb6f67ab81bfc763c7e6e874107f31d217"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
firebase_remote_config_web:
dependency: transitive
description:
name: firebase_remote_config_web
sha256: "427e4d1495580e3edde5b2b6f641a712799fec7b43c7db157622b29267daa15b"
url: "https://pub.dev"
source: hosted
version: "1.10.5"
fixnum:
dependency: transitive
description:
@@ -502,6 +654,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.0"
flutter_local_notifications:
dependency: transitive
description:
name: flutter_local_notifications
sha256: "19ffb0a8bb7407875555e5e98d7343a633bb73707bae6c6a5f37c90014077875"
url: "https://pub.dev"
source: hosted
version: "19.5.0"
flutter_local_notifications_linux:
dependency: transitive
description:
name: flutter_local_notifications_linux
sha256: e3c277b2daab8e36ac5a6820536668d07e83851aeeb79c446e525a70710770a5
url: "https://pub.dev"
source: hosted
version: "6.0.0"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
sha256: "277d25d960c15674ce78ca97f57d0bae2ee401c844b6ac80fcd972a9c99d09fe"
url: "https://pub.dev"
source: hosted
version: "9.1.0"
flutter_local_notifications_windows:
dependency: transitive
description:
name: flutter_local_notifications_windows
sha256: "8d658f0d367c48bd420e7cf2d26655e2d1130147bca1eea917e576ca76668aaf"
url: "https://pub.dev"
source: hosted
version: "1.0.3"
flutter_localizations:
dependency: transitive
description: flutter
@@ -1522,6 +1706,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.11"
timezone:
dependency: transitive
description:
name: timezone
sha256: dd14a3b83cfd7cb19e7888f1cbc20f258b8d71b54c06f79ac585f14093a287d1
url: "https://pub.dev"
source: hosted
version: "0.10.1"
timing:
dependency: transitive
description: