From 1f0b7c57410d7704c71d63a9deed93d9daf073de Mon Sep 17 00:00:00 2001 From: Bryan Oltman Date: Mon, 1 Jul 2024 11:01:38 -0400 Subject: [PATCH 1/2] Add WIP Crashlytics guide --- .../guides/crash-reporting/crashlytics.mdx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/content/docs/guides/crash-reporting/crashlytics.mdx diff --git a/src/content/docs/guides/crash-reporting/crashlytics.mdx b/src/content/docs/guides/crash-reporting/crashlytics.mdx new file mode 100644 index 00000000..695c5dc0 --- /dev/null +++ b/src/content/docs/guides/crash-reporting/crashlytics.mdx @@ -0,0 +1,21 @@ +--- +title: Crashlytics Integration +description: Integrate Shorebird into your Crashlytics crash reporting +sidebar: + label: Crashlytics + order: 2 +--- + +If you're using Crashlytics for crash reporting, it will work out-of-the-box +with Shorebird releases and patches. However, if you have multiple patches, it +can be unclear which patch caused the crash. This document shows how you can use +Crashlytics TODO to differentiate between patches. + +## Add the `shorebird_code_push` package to your project. + +[shorebird_code_push](https://pub.dev/packages/shorebird_code_push) is available +on pub.dev and lets you programmatically determine your app's current patch +number. To add it to your project, follow the instructions on the package's +pub.dev page. + +## Configure Crashlytics From f27cf9c9281c8e1c5f2b520c144e032bed382845 Mon Sep 17 00:00:00 2001 From: Erick Zanardo Date: Mon, 1 Jul 2024 12:32:37 -0300 Subject: [PATCH 2/2] adding more information about crashlytics --- .../guides/crash-reporting/crashlytics.mdx | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/content/docs/guides/crash-reporting/crashlytics.mdx b/src/content/docs/guides/crash-reporting/crashlytics.mdx index 695c5dc0..c4c22240 100644 --- a/src/content/docs/guides/crash-reporting/crashlytics.mdx +++ b/src/content/docs/guides/crash-reporting/crashlytics.mdx @@ -9,7 +9,7 @@ sidebar: If you're using Crashlytics for crash reporting, it will work out-of-the-box with Shorebird releases and patches. However, if you have multiple patches, it can be unclear which patch caused the crash. This document shows how you can use -Crashlytics TODO to differentiate between patches. +Crashlytics to differentiate between patches. ## Add the `shorebird_code_push` package to your project. @@ -19,3 +19,29 @@ number. To add it to your project, follow the instructions on the package's pub.dev page. ## Configure Crashlytics + +If you haven't already, follow the Crashlytics [getting started with +Flutter](https://firebase.google.com/docs/crashlytics/get-started?platform=flutter) guide. + +Update the Firebase init code to include the patch number as a custom key. This will look +something like: + +```dart +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + + final patchNumber = await ShorebirdCodePush().currentPatchNumber(); + + // Add the patch number as a tag. You can use whatever name you would like + // as the key. `$patchNumber` will be "null" if there is no patch. You may + // wish to handle this case differently. + FirebaseCrashlytics.instance.setCustomKey( + 'shorebird_patch_number', + '$patchNumber', + ); + runApp(const MyApp()); +} +```