-
Notifications
You must be signed in to change notification settings - Fork 382
chore(samples): replace Sentry with Firebase Crashlytics #2665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2a16222
chore(sample_app): replace Sentry with Firebase Crashlytics
xsahil03x 032341d
chore(sample_app): leave Crashlytics Gradle plugin to flutterfire con…
xsahil03x d8a8845
chore(sample_app): run flutterfire configure for Crashlytics
xsahil03x 9c774a3
chore(sample_app): regenerate iOS Pods after Sentry removal
xsahil03x 4dad8f3
chore(sample_app): floor Android compileSdk at 36 for firebase_crashl…
xsahil03x 1e37279
chore(sample_app): let embedder surface platform errors in debug
xsahil03x 7ddafad
style(sample_app): blank line after early-return guard in onError
xsahil03x 02d92b3
chore(sample_app): default Crashlytics collection off in native config
xsahil03x e27bd06
chore(sample_app): tweak Crashlytics gate comments
xsahil03x cdae974
Merge branch 'master' into chore/replace-sentry-with-firebase
xsahil03x 7961ea5
chore(sample_app): melos format firebase_options.dart
xsahil03x 489bb35
ci(sample_app): install flutterfire_cli before iOS build
xsahil03x a926c7a
chore(sample_app): drop dSYM upload run-script phase
xsahil03x a10ac87
ci(sample_app): upload iOS dSYMs to Crashlytics in distribution lanes
xsahil03x b484ee6
ci(sample_app): handle SPM Crashlytics in upload_crashlytics_symbols
xsahil03x 04363eb
ci(sample_app): disable Swift Package Manager integration on iOS/macOS
xsahil03x 604ccb7
ci(sample_app): propagate DEVELOPMENT_TEAM to SPM packages on archive
xsahil03x 5b37891
ci(sample_app): force manual code-sign style for SPM packages
xsahil03x 9f1d473
Revert "ci(sample_app): force manual code-sign style for SPM packages"
xsahil03x 07ec98f
ci(repo): move legacy_version_analyze path filter to job level
xsahil03x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,46 @@ | ||
| import 'dart:async'; | ||
|
|
||
| import 'package:firebase_core/firebase_core.dart'; | ||
| import 'package:firebase_crashlytics/firebase_crashlytics.dart'; | ||
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:sample_app/app.dart'; | ||
| import 'package:sample_app/firebase_options.dart'; | ||
| import 'package:sample_app/utils/app_config.dart'; | ||
| import 'package:sentry_flutter/sentry_flutter.dart'; | ||
|
|
||
| Future<void> main() async { | ||
| WidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| // Initialize Firebase before wiring Crashlytics handlers so the error | ||
| // reporters have a live Firebase app to talk to. | ||
| await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); | ||
|
|
||
| // Avoid sending Crashlytics reports for crashes that happen during local | ||
| // development; reports still flow in release/profile builds. | ||
| if (!kDebugMode) { | ||
| await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true); | ||
| } | ||
|
|
||
| /// Captures errors reported by the Flutter framework. | ||
| FlutterError.onError = (FlutterErrorDetails details) { | ||
| if (kDebugMode) { | ||
| // In development mode, simply print to console. | ||
| FlutterError.dumpErrorToConsole(details); | ||
| } else { | ||
| // In production mode, report to the application zone to report to sentry. | ||
| Zone.current.handleUncaughtError(details.exception, details.stack!); | ||
| // In production mode, report the framework error to Crashlytics as fatal | ||
| // so it surfaces alongside native crashes. | ||
| FirebaseCrashlytics.instance.recordFlutterFatalError(details); | ||
| } | ||
| }; | ||
|
|
||
| /// Captures errors reported by the native environment, including native iOS | ||
| /// and Android code. | ||
| Future<void> reportError(dynamic error, StackTrace stackTrace) async { | ||
| // Print the exception to the console. | ||
| if (kDebugMode) { | ||
| // Print the full stacktrace in debug mode. | ||
| print(stackTrace); | ||
| return; | ||
| } else { | ||
| // Send the Exception and Stacktrace to sentry in Production mode. | ||
| await Sentry.captureException(error, stackTrace: stackTrace); | ||
| } | ||
| } | ||
| /// Captures errors reported by the platform dispatcher, including async | ||
| /// errors thrown outside the Flutter framework (e.g. from native iOS and | ||
| /// Android code via platform channels). | ||
| PlatformDispatcher.instance.onError = (error, stack) { | ||
| // In debug, return false so the embedder logs the error and the IDE can | ||
| // break on it. In release, hand it to Crashlytics and mark it handled. | ||
| if (kDebugMode) return false; | ||
|
|
||
| /// Runs the app wrapped in a [Zone] that captures errors and sends them to | ||
| /// sentry. | ||
| runZonedGuarded( | ||
| () async { | ||
| WidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| // Wait for Sentry and Firebase to initialize before running the app. | ||
| await Future.wait([ | ||
| SentryFlutter.init((options) => options.dsn = sentryDsn), | ||
| Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform), | ||
| ]); | ||
| FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); | ||
| return true; | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| runApp(const StreamChatSampleApp()); | ||
| }, | ||
| reportError, | ||
| ); | ||
| runApp(const StreamChatSampleApp()); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.