From 4e29cf8673bb812d4f84e6ed50813d20ddfc602b Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 4 Oct 2022 13:46:38 +0100 Subject: [PATCH 1/7] chore(crashlytics): update example apps to use "flutterfire-e2e-tests" --- .../example/android/app/google-services.json | 417 +++++++++++++++++- .../example/ios/GoogleService-Info.plist | 38 -- .../ios/Runner.xcodeproj/project.pbxproj | 17 +- .../example/ios/Runner/Info.plist | 4 +- .../example/lib/firebase_options.dart | 75 ++-- .../macos/Runner.xcodeproj/project.pbxproj | 8 +- .../macos/Runner/GoogleService-Info.plist | 2 +- 7 files changed, 472 insertions(+), 89 deletions(-) delete mode 100644 packages/firebase_crashlytics/firebase_crashlytics/example/ios/GoogleService-Info.plist diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/android/app/google-services.json b/packages/firebase_crashlytics/firebase_crashlytics/example/android/app/google-services.json index 71e2bfecccc8..13dc69de2fee 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/android/app/google-services.json +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/android/app/google-services.json @@ -6,6 +6,162 @@ "storage_bucket": "flutterfire-e2e-tests.appspot.com" }, "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:e0752d466d8936243574d0", + "android_client_info": { + "package_name": "com.example.testcliapp" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:a241c4b471513a203574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebase.appcheck.example" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-7bvmqp0fffe24vm2arng0dtdeh2tvkgl.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebase.appcheck.example", + "certificate_hash": "909ca1482ef022bbae45a2db6b6d05d807a4c4aa" + } + }, + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:3ef965ff044efc0b3574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebase.database.example" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:40da41183cb3d3ff3574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebase.dynamiclinksexample" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, { "client_info": { "mobilesdk_app_id": "1:406099696497:android:7ca3394493cc601a3574d0", @@ -14,6 +170,14 @@ } }, "oauth_client": [ + { + "client_id": "406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebase.functions.example", + "certificate_hash": "a4256c0612686b336af6d138a5479b7dc1ee1af6" + } + }, { "client_id": "406099696497-tvtvuiqogct1gs1s6lh114jeps7hpjm5.apps.googleusercontent.com", "client_type": 1, @@ -40,10 +204,48 @@ "client_type": 3 }, { - "client_id": "406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com", + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:74ebb073d7727cd43574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebase.messaging.example" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "io.flutter.plugins.firebase.crashlytics.example" + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" } } ] @@ -76,10 +278,175 @@ "client_type": 3 }, { - "client_id": "406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com", + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:899c6485cfce26c13574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebase_ui_example" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-ltgvphphcckosvqhituel5km2k3aecg8.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebase_ui_example", + "certificate_hash": "a4256c0612686b336af6d138a5479b7dc1ee1af6" + } + }, + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:b7a347ba65ca3b803574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebaseanalyticsexample" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "io.flutter.plugins.firebase.crashlytics.example" + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:61e67dfd35ab93ad3574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebaseauthexample" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-j20pm6c84pofkl1ivo4f7fe797smfnp4.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "io.flutter.plugins.firebaseauthexample", + "certificate_hash": "a4256c0612686b336af6d138a5479b7dc1ee1af6" + } + }, + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:bc0b12b0605df8633574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebasecoreexample" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" } } ] @@ -112,10 +479,48 @@ "client_type": 3 }, { - "client_id": "406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com", + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:406099696497:android:2751af6868a69f073574d0", + "android_client_info": { + "package_name": "io.flutter.plugins.firebasestorageexample" + } + }, + "oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "406099696497-a12gakvts4epfk5pkio7dphc1anjiggc.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "406099696497-17cfsesi620nhia0sck4map450gngkoh.apps.googleusercontent.com", "client_type": 2, "ios_info": { - "bundle_id": "io.flutter.plugins.firebase.crashlytics.example" + "bundle_id": "io.flutter.plugins.firebase.appcheck.example", + "app_store_id": "123456" } } ] diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/ios/GoogleService-Info.plist b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/GoogleService-Info.plist deleted file mode 100644 index e5559131439f..000000000000 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/ios/GoogleService-Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CLIENT_ID - 448618578101-54jhd806d0tr4vkgode0b4fi8iruvjpn.apps.googleusercontent.com - REVERSED_CLIENT_ID - com.googleusercontent.apps.448618578101-54jhd806d0tr4vkgode0b4fi8iruvjpn - ANDROID_CLIENT_ID - 448618578101-velutq65ok2dr5ohh0oi1q62irr920ss.apps.googleusercontent.com - API_KEY - AIzaSyAHAsf51D0A407EklG1bs-5wA7EbyfNFg0 - GCM_SENDER_ID - 448618578101 - PLIST_VERSION - 1 - BUNDLE_ID - io.flutter.plugins.firebase.crashlytics.firebaseCrashlyticsExample - PROJECT_ID - react-native-firebase-testing - STORAGE_BUCKET - react-native-firebase-testing.appspot.com - IS_ADS_ENABLED - - IS_ANALYTICS_ENABLED - - IS_APPINVITE_ENABLED - - IS_GCM_ENABLED - - IS_SIGNIN_ENABLED - - GOOGLE_APP_ID - 1:448618578101:ios:3d7b3d90894e689eac3efc - DATABASE_URL - https://react-native-firebase-testing.firebaseio.com - - \ No newline at end of file diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner.xcodeproj/project.pbxproj b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner.xcodeproj/project.pbxproj index 1110354b41e3..0602d8ef8636 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -16,6 +16,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + AAE9D7BFA8AAA8783C2860B2 /* GoogleService-Info.plist in Sources */ = {isa = PBXBuildFile; fileRef = 864CBEC4F3EDA362F4B5B76D /* GoogleService-Info.plist */; }; F3CD36E5DA207BF24A9BECE5 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 90669E7218FC80716B8D1896 /* libPods-Runner.a */; }; /* End PBXBuildFile section */ @@ -42,6 +43,7 @@ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 864CBEC4F3EDA362F4B5B76D /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 90669E7218FC80716B8D1896 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; @@ -104,6 +106,7 @@ 97C146EF1CF9000F007C117D /* Products */, 578F13DB49C24452CA02A630 /* Pods */, 9278C72542532A6D4853596F /* Frameworks */, + 864CBEC4F3EDA362F4B5B76D /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -175,6 +178,7 @@ TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = YYX2P3XVJ7; }; }; }; @@ -292,6 +296,7 @@ 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + AAE9D7BFA8AAA8783C2860B2 /* GoogleService-Info.plist in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -370,7 +375,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = S8QB4VV633; + DEVELOPMENT_TEAM = YYX2P3XVJ7; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -382,7 +387,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.firebaseCrashlyticsExample; + PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.example; PRODUCT_NAME = "$(TARGET_NAME)"; VERSIONING_SYSTEM = "apple-generic"; }; @@ -495,6 +500,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = YYX2P3XVJ7; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -506,7 +512,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.firebaseCrashlyticsExample; + PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.example; PRODUCT_NAME = "$(TARGET_NAME)"; VERSIONING_SYSTEM = "apple-generic"; }; @@ -518,6 +524,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = YYX2P3XVJ7; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -529,7 +536,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.firebaseCrashlyticsExample; + PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.example; PRODUCT_NAME = "$(TARGET_NAME)"; VERSIONING_SYSTEM = "apple-generic"; }; diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner/Info.plist b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner/Info.plist index 725e580a2228..ba7b92d7d78c 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner/Info.plist +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner/Info.plist @@ -2,6 +2,8 @@ + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion en CFBundleExecutable @@ -41,7 +43,5 @@ UIViewControllerBasedStatusBarAppearance - CADisableMinimumFrameDurationOnPhone - diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/lib/firebase_options.dart b/packages/firebase_crashlytics/firebase_crashlytics/example/lib/firebase_options.dart index a492366c3556..afa8a0791206 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/lib/firebase_options.dart +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/lib/firebase_options.dart @@ -1,5 +1,5 @@ // File generated by FlutterFire CLI. -// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; @@ -22,7 +22,6 @@ class DefaultFirebaseOptions { 'you can reconfigure this by running the FlutterFire CLI again.', ); } - // ignore: missing_enum_constant_in_switch switch (defaultTargetPlatform) { case TargetPlatform.android: return android; @@ -30,49 +29,53 @@ class DefaultFirebaseOptions { return ios; case TargetPlatform.macOS: return macos; + 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.', + ); } - - throw UnsupportedError( - 'DefaultFirebaseOptions are not supported for this platform.', - ); } static const FirebaseOptions android = FirebaseOptions( - apiKey: 'AIzaSyAHAsf51D0A407EklG1bs-5wA7EbyfNFg0', - appId: '1:448618578101:ios:3d7b3d90894e689eac3efc', - messagingSenderId: '448618578101', - projectId: 'react-native-firebase-testing', - databaseURL: 'https://react-native-firebase-testing.firebaseio.com', - storageBucket: 'react-native-firebase-testing.appspot.com', + apiKey: 'AIzaSyCdRjCVZlhrq72RuEklEyyxYlBRCYhI2Sw', + appId: '1:406099696497:android:0f3f7bfe78b8b7103574d0', + messagingSenderId: '406099696497', + projectId: 'flutterfire-e2e-tests', + databaseURL: 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', + storageBucket: 'flutterfire-e2e-tests.appspot.com', ); static const FirebaseOptions ios = FirebaseOptions( - apiKey: 'AIzaSyAHAsf51D0A407EklG1bs-5wA7EbyfNFg0', - appId: '1:448618578101:ios:3d7b3d90894e689eac3efc', - messagingSenderId: '448618578101', - projectId: 'react-native-firebase-testing', - databaseURL: 'https://react-native-firebase-testing.firebaseio.com', - storageBucket: 'react-native-firebase-testing.appspot.com', - androidClientId: - '448618578101-velutq65ok2dr5ohh0oi1q62irr920ss.apps.googleusercontent.com', - iosClientId: - '448618578101-54jhd806d0tr4vkgode0b4fi8iruvjpn.apps.googleusercontent.com', - iosBundleId: - 'io.flutter.plugins.firebase.crashlytics.firebaseCrashlyticsExample', + apiKey: 'AIzaSyDooSUGSf63Ghq02_iIhtnmwMDs4HlWS6c', + appId: '1:406099696497:ios:1d042a17c4dd64323574d0', + messagingSenderId: '406099696497', + projectId: 'flutterfire-e2e-tests', + databaseURL: 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', + storageBucket: 'flutterfire-e2e-tests.appspot.com', + androidClientId: '406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com', + iosClientId: '406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com', + iosBundleId: 'io.flutter.plugins.firebase.crashlytics.example', ); static const FirebaseOptions macos = FirebaseOptions( - apiKey: 'AIzaSyAHAsf51D0A407EklG1bs-5wA7EbyfNFg0', - appId: '1:448618578101:ios:3d7b3d90894e689eac3efc', - messagingSenderId: '448618578101', - projectId: 'react-native-firebase-testing', - databaseURL: 'https://react-native-firebase-testing.firebaseio.com', - storageBucket: 'react-native-firebase-testing.appspot.com', - androidClientId: - '448618578101-velutq65ok2dr5ohh0oi1q62irr920ss.apps.googleusercontent.com', - iosClientId: - '448618578101-54jhd806d0tr4vkgode0b4fi8iruvjpn.apps.googleusercontent.com', - iosBundleId: - 'io.flutter.plugins.firebase.crashlytics.firebaseCrashlyticsExample', + apiKey: 'AIzaSyDooSUGSf63Ghq02_iIhtnmwMDs4HlWS6c', + appId: '1:406099696497:ios:1d042a17c4dd64323574d0', + messagingSenderId: '406099696497', + projectId: 'flutterfire-e2e-tests', + databaseURL: 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', + storageBucket: 'flutterfire-e2e-tests.appspot.com', + androidClientId: '406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com', + iosClientId: '406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com', + iosBundleId: 'io.flutter.plugins.firebase.crashlytics.example', ); } diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/macos/Runner.xcodeproj/project.pbxproj b/packages/firebase_crashlytics/firebase_crashlytics/example/macos/Runner.xcodeproj/project.pbxproj index 1cf0a894d900..5183e67a9506 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/macos/Runner.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 492007BCB1A0ACAE35BFED17 /* GoogleService-Info.plist in Sources */ = {isa = PBXBuildFile; fileRef = F818CA0E0AA6AA728FD7888E /* GoogleService-Info.plist */; }; A778181074198B5AB83282EB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6342CA55BF53810F97AF20C /* Pods_Runner.framework */; }; B5515A0723F6830A00F4A798 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B5515A0623F6830A00F4A798 /* GoogleService-Info.plist */; }; /* End PBXBuildFile section */ @@ -75,6 +76,7 @@ B5515A0623F6830A00F4A798 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; D6342CA55BF53810F97AF20C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; F66FF69A43A7D1A9235BA2DA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + F818CA0E0AA6AA728FD7888E /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -96,7 +98,6 @@ AD1C0B47B3CC4549F903FB8C /* Pods-Runner.release.xcconfig */, 569624C19DCFE29B888EF618 /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -119,6 +120,7 @@ 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, 1F66EACC943169C3E49C1DC4 /* Pods */, + F818CA0E0AA6AA728FD7888E /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -359,6 +361,7 @@ 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + 492007BCB1A0ACAE35BFED17 /* GoogleService-Info.plist in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -449,6 +452,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.example; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; @@ -579,6 +583,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.example; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -603,6 +608,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); + PRODUCT_BUNDLE_IDENTIFIER = io.flutter.plugins.firebase.crashlytics.example; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; }; diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/macos/Runner/GoogleService-Info.plist b/packages/firebase_crashlytics/firebase_crashlytics/example/macos/Runner/GoogleService-Info.plist index e6c9fe545762..1da32534601c 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/macos/Runner/GoogleService-Info.plist +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/macos/Runner/GoogleService-Info.plist @@ -7,7 +7,7 @@ REVERSED_CLIENT_ID com.googleusercontent.apps.406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3 ANDROID_CLIENT_ID - 406099696497-tvtvuiqogct1gs1s6lh114jeps7hpjm5.apps.googleusercontent.com + 406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com API_KEY AIzaSyDooSUGSf63Ghq02_iIhtnmwMDs4HlWS6c GCM_SENDER_ID From 158941119fc19a630260045513186505a479f26e Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 4 Oct 2022 13:47:32 +0100 Subject: [PATCH 2/7] chore(crashlytics): update example app to use `PlatformDispatcher.instance.onError` --- .../firebase_crashlytics/example/lib/main.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/lib/main.dart b/packages/firebase_crashlytics/firebase_crashlytics/example/lib/main.dart index 281be9d3357e..4833f1eee14c 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/lib/main.dart +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/lib/main.dart @@ -21,16 +21,21 @@ const _kShouldTestAsyncErrorOnInit = false; const _kTestingCrashlytics = true; Future main() async { - await runZonedGuarded(() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); - FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError; + FlutterError.onError = (errorDetails) { + // If you wish to record a "non-fatal" exception, please use `FirebaseCrashlytics.instance.recordFlutterError` instead + FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails); + }; + PlatformDispatcher.instance.onError = (error, stack) { + // If you wish to record a "non-fatal" exception, please remove the "fatal" parameter + FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); + return true; + }; runApp(MyApp()); - }, (error, stackTrace) { - FirebaseCrashlytics.instance.recordError(error, stackTrace); - }); + } class MyApp extends StatefulWidget { From d3cffb8490a8833a8a134a7238fff512d63d4192 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 4 Oct 2022 13:54:21 +0100 Subject: [PATCH 3/7] chore(crashlytics): more flutterfire-e2e-tests config --- .../ios/Runner/GoogleService-Info.plist | 38 +++++++++++++++++++ .../example/ios/firebase_app_id_file.json | 7 ++++ .../example/macos/firebase_app_id_file.json | 7 ++++ 3 files changed, 52 insertions(+) create mode 100644 packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner/GoogleService-Info.plist create mode 100644 packages/firebase_crashlytics/firebase_crashlytics/example/ios/firebase_app_id_file.json create mode 100644 packages/firebase_crashlytics/firebase_crashlytics/example/macos/firebase_app_id_file.json diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner/GoogleService-Info.plist b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner/GoogleService-Info.plist new file mode 100644 index 000000000000..1da32534601c --- /dev/null +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,38 @@ + + + + + CLIENT_ID + 406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3 + ANDROID_CLIENT_ID + 406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com + API_KEY + AIzaSyDooSUGSf63Ghq02_iIhtnmwMDs4HlWS6c + GCM_SENDER_ID + 406099696497 + PLIST_VERSION + 1 + BUNDLE_ID + io.flutter.plugins.firebase.crashlytics.example + PROJECT_ID + flutterfire-e2e-tests + STORAGE_BUCKET + flutterfire-e2e-tests.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:406099696497:ios:1d042a17c4dd64323574d0 + DATABASE_URL + https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app + + \ No newline at end of file diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/ios/firebase_app_id_file.json b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/firebase_app_id_file.json new file mode 100644 index 000000000000..5a9675ea0399 --- /dev/null +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/ios/firebase_app_id_file.json @@ -0,0 +1,7 @@ +{ + "file_generated_by": "FlutterFire CLI", + "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", + "GOOGLE_APP_ID": "1:406099696497:ios:1d042a17c4dd64323574d0", + "FIREBASE_PROJECT_ID": "flutterfire-e2e-tests", + "GCM_SENDER_ID": "406099696497" +} \ No newline at end of file diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/macos/firebase_app_id_file.json b/packages/firebase_crashlytics/firebase_crashlytics/example/macos/firebase_app_id_file.json new file mode 100644 index 000000000000..5a9675ea0399 --- /dev/null +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/macos/firebase_app_id_file.json @@ -0,0 +1,7 @@ +{ + "file_generated_by": "FlutterFire CLI", + "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", + "GOOGLE_APP_ID": "1:406099696497:ios:1d042a17c4dd64323574d0", + "FIREBASE_PROJECT_ID": "flutterfire-e2e-tests", + "GCM_SENDER_ID": "406099696497" +} \ No newline at end of file From a5870f13d5182a7f47865998ce3b60afcb68dee7 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 4 Oct 2022 14:04:59 +0100 Subject: [PATCH 4/7] chore(crashlytics): format --- .../example/lib/firebase_options.dart | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/lib/firebase_options.dart b/packages/firebase_crashlytics/firebase_crashlytics/example/lib/firebase_options.dart index afa8a0791206..ebc19d290e1b 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/lib/firebase_options.dart +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/lib/firebase_options.dart @@ -51,7 +51,8 @@ class DefaultFirebaseOptions { appId: '1:406099696497:android:0f3f7bfe78b8b7103574d0', messagingSenderId: '406099696497', projectId: 'flutterfire-e2e-tests', - databaseURL: 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', + databaseURL: + 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', storageBucket: 'flutterfire-e2e-tests.appspot.com', ); @@ -60,10 +61,13 @@ class DefaultFirebaseOptions { appId: '1:406099696497:ios:1d042a17c4dd64323574d0', messagingSenderId: '406099696497', projectId: 'flutterfire-e2e-tests', - databaseURL: 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', + databaseURL: + 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', storageBucket: 'flutterfire-e2e-tests.appspot.com', - androidClientId: '406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com', - iosClientId: '406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com', + androidClientId: + '406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com', + iosClientId: + '406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com', iosBundleId: 'io.flutter.plugins.firebase.crashlytics.example', ); @@ -72,10 +76,13 @@ class DefaultFirebaseOptions { appId: '1:406099696497:ios:1d042a17c4dd64323574d0', messagingSenderId: '406099696497', projectId: 'flutterfire-e2e-tests', - databaseURL: 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', + databaseURL: + 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', storageBucket: 'flutterfire-e2e-tests.appspot.com', - androidClientId: '406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com', - iosClientId: '406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com', + androidClientId: + '406099696497-17qn06u8a0dc717u8ul7s49ampk13lul.apps.googleusercontent.com', + iosClientId: + '406099696497-epk7902e2mb4pj4i4gcotk4q7dp2i9h3.apps.googleusercontent.com', iosBundleId: 'io.flutter.plugins.firebase.crashlytics.example', ); } From 0ed8327737ccb653e539252f440ecc572c615545 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 4 Oct 2022 14:06:02 +0100 Subject: [PATCH 5/7] chore(crashlytics): format --- .../example/lib/main.dart | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/packages/firebase_crashlytics/firebase_crashlytics/example/lib/main.dart b/packages/firebase_crashlytics/firebase_crashlytics/example/lib/main.dart index 4833f1eee14c..78516614521a 100644 --- a/packages/firebase_crashlytics/firebase_crashlytics/example/lib/main.dart +++ b/packages/firebase_crashlytics/firebase_crashlytics/example/lib/main.dart @@ -21,21 +21,20 @@ const _kShouldTestAsyncErrorOnInit = false; const _kTestingCrashlytics = true; Future main() async { - WidgetsFlutterBinding.ensureInitialized(); - await Firebase.initializeApp( - options: DefaultFirebaseOptions.currentPlatform, - ); - FlutterError.onError = (errorDetails) { - // If you wish to record a "non-fatal" exception, please use `FirebaseCrashlytics.instance.recordFlutterError` instead - FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails); - }; - PlatformDispatcher.instance.onError = (error, stack) { - // If you wish to record a "non-fatal" exception, please remove the "fatal" parameter - FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); - return true; - }; - runApp(MyApp()); - + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + FlutterError.onError = (errorDetails) { + // If you wish to record a "non-fatal" exception, please use `FirebaseCrashlytics.instance.recordFlutterError` instead + FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails); + }; + PlatformDispatcher.instance.onError = (error, stack) { + // If you wish to record a "non-fatal" exception, please remove the "fatal" parameter + FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); + return true; + }; + runApp(MyApp()); } class MyApp extends StatefulWidget { From 1fb45fd5d0e448e5a8c5295405ebb8ec8c120328 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 4 Oct 2022 14:06:40 +0100 Subject: [PATCH 6/7] docs(crashlytics): update to use `PlatformDispatcher.instance.onError` and general improvement --- docs/crashlytics/_customize-crash-reports.md | 53 ++++++++++++-------- docs/crashlytics/_get-started.md | 26 +++++----- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/docs/crashlytics/_customize-crash-reports.md b/docs/crashlytics/_customize-crash-reports.md index db45ccec04c5..5b3a6b3ecdf0 100644 --- a/docs/crashlytics/_customize-crash-reports.md +++ b/docs/crashlytics/_customize-crash-reports.md @@ -20,57 +20,63 @@ to disk to be sent along with the next fatal report or when the app restarts. ## Report uncaught exceptions {: #report-uncaught-exceptions} -You can automatically catch all errors that are thrown within the Flutter +You can automatically catch all "fatal" errors that are thrown within the Flutter framework by overriding `FlutterError.onError` with -`FirebaseCrashlytics.instance.recordFlutterFatalError`: +`FirebaseCrashlytics.instance.recordFlutterFatalError`. Alternatively, if you wish +to catch "non-fatal" exceptions, please use: `FirebaseCrashlytics.instance.recordFlutterError`: + ```dart void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); - - // Pass all uncaught errors from the framework to Crashlytics. - FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError; + bool weWantFatalErrorRecording = true; + FlutterError.onError = (errorDetails) { + if(weWantFatalErrorRecording){ + FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails); + } else { + FirebaseCrashlytics.instance.recordFlutterError(errorDetails); + } + }; runApp(MyApp()); } ``` -### Zoned errors {: #zoned-errors} -Not all errors are caught by Flutter. Sometimes, errors are instead caught by -`Zones`. A common case where relying on Flutter to catch errors would not be -enough is when an exception happens inside the `onPressed` handler of a button: +### Asynchronous errors {: #asynchronous-errors} + +Asynchronous errors are not caught by the Flutter framework: ```dart ElevatedButton( - onPressed: () { + onPressed: () async { throw Error(); } ... ) ``` -To catch such errors, you can use `runZonedGuarded`: +To catch such errors, you can use the `PlatformDispatcher.instance.onError` handler: ```dart -void main() async { - runZonedGuarded>(() async { +Future main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); - // The following lines are the same as previously explained in "Handling uncaught errors" - FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError; - + FlutterError.onError = (errorDetails) { + FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails); + }; + // Pass all uncaught asynchronous errors that aren't handled by the Flutter framework to Crashlytics + PlatformDispatcher.instance.onError = (error, stack) { + FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); + return true; + }; runApp(MyApp()); - }, (error, stack) => FirebaseCrashlytics.instance.recordError(error, stack, fatal: true)); + } ``` -Note: You must call `WidgetsFlutterBinding.ensureInitialized()` _inside_ -`runZonedGuarded`. Error handling wouldn’t work if -`WidgetsFlutterBinding.ensureInitialized()` was called from the outside. - ### Errors outside of Flutter {: #errors-outside-flutter} To catch errors that happen outside of the Flutter context, install an error @@ -97,7 +103,7 @@ event is reported or when the app restarts. Note: {{crashlytics}} only stores the most recent eight recorded non-fatal exceptions. If your app throws more than eight, older exceptions are lost. This count is reset each time a fatal exception is thrown, since this causes a report -to be sent to {{crashlytics}}. +to be sent to {{crashlytics}}. Use the `recordError` method to record non-fatal exceptions in your app's catch blocks. For example: @@ -108,6 +114,9 @@ await FirebaseCrashlytics.instance.recordError( stackTrace, reason: 'a non-fatal error' ); + +// Or you can use: +await FirebaseCrashlytics.instance.recordFlutterError(errorDetails); ``` Warning: If you want to include a unique value (for example, a user ID or a diff --git a/docs/crashlytics/_get-started.md b/docs/crashlytics/_get-started.md index 31d5f944b726..56e4306b6277 100644 --- a/docs/crashlytics/_get-started.md +++ b/docs/crashlytics/_get-started.md @@ -66,29 +66,31 @@ void main() async { await Firebase.initializeApp(); - // Pass all uncaught errors from the framework to Crashlytics. + // Pass all uncaught "fatal" errors from the framework to Crashlytics FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError; runApp(MyApp()); } ``` -If you're using zones, instrumenting the zone’s error handler will catch errors -that aren't caught by the Flutter framework (for example, in a button’s -`onPressed` handler): +To catch asynchronous errors that aren't handled by the Flutter framework, use +`PlatformDispatcher.instance.onError`: + ```dart -void main() async { - runZonedGuarded>(() async { +Future main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); - - FlutterError.onError = - FirebaseCrashlytics.instance.recordFlutterFatalError; - + FlutterError.onError = (errorDetails) { + FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails); + }; + // Pass all uncaught asynchronous errors that aren't handled by the Flutter framework to Crashlytics + PlatformDispatcher.instance.onError = (error, stack) { + FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); + return true; + }; runApp(MyApp()); - }, (error, stack) => - FirebaseCrashlytics.instance.recordError(error, stack, fatal: true)); + } ``` From 062f99b08b82bb62d9cdfc50364841c5af9ac01e Mon Sep 17 00:00:00 2001 From: Russell Wheatley Date: Wed, 26 Oct 2022 11:36:09 +0100 Subject: [PATCH 7/7] Update docs/crashlytics/_customize-crash-reports.md Co-authored-by: Kevin Cheung --- docs/crashlytics/_customize-crash-reports.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/crashlytics/_customize-crash-reports.md b/docs/crashlytics/_customize-crash-reports.md index 5b3a6b3ecdf0..c9388fad8d83 100644 --- a/docs/crashlytics/_customize-crash-reports.md +++ b/docs/crashlytics/_customize-crash-reports.md @@ -22,9 +22,8 @@ to disk to be sent along with the next fatal report or when the app restarts. You can automatically catch all "fatal" errors that are thrown within the Flutter framework by overriding `FlutterError.onError` with -`FirebaseCrashlytics.instance.recordFlutterFatalError`. Alternatively, if you wish -to catch "non-fatal" exceptions, please use: `FirebaseCrashlytics.instance.recordFlutterError`: - +`FirebaseCrashlytics.instance.recordFlutterFatalError`. Alternatively, +to also catch "non-fatal" exceptions, override `FlutterError.onError` with `FirebaseCrashlytics.instance.recordFlutterError`: ```dart void main() async {