From d1a7e9e3d9f954a15bb8eee7d69927e48e4883ea Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Thu, 17 Aug 2023 11:30:38 +0200 Subject: [PATCH] chore: Upgrade Sentry + add screenshots (#4566) * Upgrade Sentry + add screenshots * Upgrade iOS & macOS dependencies * Remove unused variable --- packages/smooth_app/ios/Podfile.lock | 58 +++++++++++++------ .../lib/helpers/analytics_helper.dart | 30 ++++++---- packages/smooth_app/lib/main.dart | 24 ++++---- .../logs/fimber/trees/sentry_fimber_tree.dart | 4 +- packages/smooth_app/macos/Podfile.lock | 26 +++++++-- packages/smooth_app/pubspec.lock | 19 +++--- packages/smooth_app/pubspec.yaml | 2 +- 7 files changed, 104 insertions(+), 59 deletions(-) diff --git a/packages/smooth_app/ios/Podfile.lock b/packages/smooth_app/ios/Podfile.lock index bb2a4506744..c28131dc1b0 100644 --- a/packages/smooth_app/ios/Podfile.lock +++ b/packages/smooth_app/ios/Podfile.lock @@ -5,6 +5,9 @@ PODS: - Flutter - camera_avfoundation (0.0.1): - Flutter + - connectivity_plus (0.0.1): + - Flutter + - ReachabilitySwift - data_importer (0.0.1): - Flutter - KeychainAccess @@ -16,6 +19,8 @@ PODS: - Flutter - flutter_email_sender (0.0.1): - Flutter + - flutter_icmp_ping (0.0.1): + - Flutter - flutter_image_compress_common (1.0.0): - Flutter - Mantle @@ -28,7 +33,7 @@ PODS: - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) - - GoogleDataTransport (9.2.1): + - GoogleDataTransport (9.2.5): - GoogleUtilities/Environment (~> 7.7) - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) @@ -49,11 +54,11 @@ PODS: - GoogleToolboxForMac/Defines (= 2.3.2) - "GoogleToolboxForMac/NSString+URLArguments (= 2.3.2)" - "GoogleToolboxForMac/NSString+URLArguments (2.3.2)" - - GoogleUtilities/Environment (7.11.0): + - GoogleUtilities/Environment (7.11.5): - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.11.0): + - GoogleUtilities/Logger (7.11.5): - GoogleUtilities/Environment - - GoogleUtilities/UserDefaults (7.11.0): + - GoogleUtilities/UserDefaults (7.11.5): - GoogleUtilities/Logger - GoogleUtilitiesComponents (1.1.0): - GoogleUtilities/Logger @@ -116,15 +121,16 @@ PODS: - FlutterMacOS - permission_handler_apple (9.1.1): - Flutter - - PromisesObjC (2.2.0) + - PromisesObjC (2.3.1) - qr_code_scanner (0.2.0): - Flutter - MTBBarcodeScanner - - Realm (10.37.2): - - Realm/Headers (= 10.37.2) - - Realm/Headers (10.37.2) - - RealmSwift (10.37.2): - - Realm (= 10.37.2) + - ReachabilitySwift (5.0.0) + - Realm (10.42.0): + - Realm/Headers (= 10.42.0) + - Realm/Headers (10.42.0) + - RealmSwift (10.42.0): + - Realm (= 10.42.0) - rive_common (0.0.1): - Flutter - SDWebImage (5.17.0): @@ -135,11 +141,13 @@ PODS: - SDWebImage/Core (~> 5.17) - sensors_plus (0.0.1): - Flutter - - Sentry/HybridSDK (7.31.5) + - Sentry/HybridSDK (8.9.1): + - SentryPrivate (= 8.9.1) - sentry_flutter (0.0.1): - Flutter - FlutterMacOS - - Sentry/HybridSDK (= 7.31.5) + - Sentry/HybridSDK (= 8.9.1) + - SentryPrivate (8.9.1) - share_plus (0.0.1): - Flutter - shared_preferences_foundation (0.0.1): @@ -157,11 +165,13 @@ DEPENDENCIES: - app_settings (from `.symlinks/plugins/app_settings/ios`) - audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`) - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - data_importer (from `.symlinks/plugins/data_importer/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - Flutter (from `Flutter`) - flutter_custom_tabs (from `.symlinks/plugins/flutter_custom_tabs/ios`) - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`) + - flutter_icmp_ping (from `.symlinks/plugins/flutter_icmp_ping/ios`) - flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`) - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) @@ -202,11 +212,13 @@ SPEC REPOS: - MTBBarcodeScanner - nanopb - PromisesObjC + - ReachabilitySwift - Realm - RealmSwift - SDWebImage - SDWebImageWebPCoder - Sentry + - SentryPrivate EXTERNAL SOURCES: app_settings: @@ -215,6 +227,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/audioplayers_darwin/ios" camera_avfoundation: :path: ".symlinks/plugins/camera_avfoundation/ios" + connectivity_plus: + :path: ".symlinks/plugins/connectivity_plus/ios" data_importer: :path: ".symlinks/plugins/data_importer/ios" device_info_plus: @@ -225,6 +239,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_custom_tabs/ios" flutter_email_sender: :path: ".symlinks/plugins/flutter_email_sender/ios" + flutter_icmp_ping: + :path: ".symlinks/plugins/flutter_icmp_ping/ios" flutter_image_compress_common: :path: ".symlinks/plugins/flutter_image_compress_common/ios" flutter_native_splash: @@ -270,19 +286,21 @@ SPEC CHECKSUMS: app_settings: d103828c9f5d515c4df9ee754dabd443f7cedcf3 audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb + connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a data_importer: ab8c74aaf553878170aed03c03626d5820c5cb1f device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_custom_tabs: 7a10a08686955cb748e5d26e0ae586d30689bf89 flutter_email_sender: 02d7443217d8c41483223627972bfdc09f74276b + flutter_icmp_ping: 2b159955eee0c487c766ad83fec224ae35e7c935 flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - GoogleDataTransport: ea169759df570f4e37bdee1623ec32a7e64e67c4 + GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2 GoogleMLKit: 2bd0dc6253c4d4f227aad460f69215a504b2980e GoogleToolboxForMac: 8bef7c7c5cf7291c687cf5354f39f9db6399ad34 - GoogleUtilities: c2bdc4cf2ce786c4d2e6b3bcfd599a25ca78f06f + GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084 GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2 image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 @@ -302,16 +320,18 @@ SPEC CHECKSUMS: package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 - PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef + PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4 qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e - Realm: 09e17879e909fafc5336864bff22272de9bd11bf - RealmSwift: adaf8f6fd925b41447089fcfab71b9b7cdc3982d + ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 + Realm: 490aad28f1360e58fc22256d5d686d3a36525346 + RealmSwift: f6a9b56d747bbdd7931de1835896c5f024b6898a rive_common: 8a159d68033a8b073e5853acc50f03aa486a2888 SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9 SDWebImageWebPCoder: af09429398d99d524cae2fe00f6f0f6e491ed102 sensors_plus: bda64198ccc7d3ccbb49e6ae17d92f67687bee20 - Sentry: 4c9babff9034785067c896fd580b1f7de44da020 - sentry_flutter: 1346a880b24c0240807b53b10cf50ddad40f504e + Sentry: e3203780941722a1fcfee99e351de14244c7f806 + sentry_flutter: 8f0ffd53088e6a4d50c095852c5cad9e4405025c + SentryPrivate: 5e3683390f66611fc7c6215e27645873adb55d13 share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 diff --git a/packages/smooth_app/lib/helpers/analytics_helper.dart b/packages/smooth_app/lib/helpers/analytics_helper.dart index e73429ce3b1..b8b3b994877 100644 --- a/packages/smooth_app/lib/helpers/analytics_helper.dart +++ b/packages/smooth_app/lib/helpers/analytics_helper.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:matomo_tracker/matomo_tracker.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; -import 'package:package_info_plus/package_info_plus.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:smooth_app/data_models/preferences/user_preferences.dart'; import 'package:smooth_app/helpers/global_vars.dart'; @@ -195,19 +194,28 @@ class AnalyticsHelper { static Future initSentry({ required Function()? appRunner, }) async { - final PackageInfo packageInfo = await PackageInfo.fromPlatform(); - await SentryFlutter.init( (SentryOptions options) { - options.dsn = - 'https://22ec5d0489534b91ba455462d3736680@o241488.ingest.sentry.io/5376745'; - options.sentryClientName = - 'sentry.dart.smoothie/${packageInfo.version}'; + options + ..dsn = + 'https://22ec5d0489534b91ba455462d3736680@o241488.ingest.sentry.io/5376745' + ..beforeSend = ( + SentryEvent event, { + Hint? hint, + }) async { + return event.copyWith( + tags: { + 'store': GlobalVars.storeLabel.name, + 'scanner': GlobalVars.scannerLabel.name, + }, + ); + }; // To set a uniform sample rate - options.tracesSampleRate = 1.0; - options.beforeSend = _beforeSend; - options.environment = - '${GlobalVars.storeLabel.name}-${GlobalVars.scannerLabel.name}'; + options + ..tracesSampleRate = 1.0 + ..beforeSend = _beforeSend + ..environment = + '${GlobalVars.storeLabel.name}-${GlobalVars.scannerLabel.name}'; }, appRunner: appRunner, ); diff --git a/packages/smooth_app/lib/main.dart b/packages/smooth_app/lib/main.dart index 6b2a7f6861d..9a533d9a500 100644 --- a/packages/smooth_app/lib/main.dart +++ b/packages/smooth_app/lib/main.dart @@ -249,17 +249,19 @@ class _SmoothAppState extends State { final String? languageCode = context.select((UserPreferences up) => up.appLanguageCode); - return MaterialApp.router( - locale: languageCode != null ? Locale(languageCode) : null, - localizationsDelegates: AppLocalizations.localizationsDelegates, - supportedLocales: AppLocalizations.supportedLocales, - debugShowCheckedModeBanner: !(kReleaseMode || _screenshots), - theme: SmoothTheme.getThemeData( - Brightness.light, themeProvider, colorProvider, textContrastProvider), - darkTheme: SmoothTheme.getThemeData( - Brightness.dark, themeProvider, colorProvider, textContrastProvider), - themeMode: themeProvider.currentThemeMode, - routerConfig: AppNavigator.of(context).router, + return SentryScreenshotWidget( + child: MaterialApp.router( + locale: languageCode != null ? Locale(languageCode) : null, + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + debugShowCheckedModeBanner: !(kReleaseMode || _screenshots), + theme: SmoothTheme.getThemeData(Brightness.light, themeProvider, + colorProvider, textContrastProvider), + darkTheme: SmoothTheme.getThemeData(Brightness.dark, themeProvider, + colorProvider, textContrastProvider), + themeMode: themeProvider.currentThemeMode, + routerConfig: AppNavigator.of(context).router, + ), ); } diff --git a/packages/smooth_app/lib/services/logs/fimber/trees/sentry_fimber_tree.dart b/packages/smooth_app/lib/services/logs/fimber/trees/sentry_fimber_tree.dart index c04590e97fe..2b28138cbb5 100644 --- a/packages/smooth_app/lib/services/logs/fimber/trees/sentry_fimber_tree.dart +++ b/packages/smooth_app/lib/services/logs/fimber/trees/sentry_fimber_tree.dart @@ -21,7 +21,7 @@ class SentryFimberTree extends BaseFimberTree { Sentry.captureException( ex, stackTrace: stacktrace, - hint: tag, + hint: tag != null ? Hint.withMap({'tag': tag}) : null, ); } else { Sentry.addBreadcrumb( @@ -30,7 +30,7 @@ class SentryFimberTree extends BaseFimberTree { timestamp: DateTime.now(), level: _convertLevel(level), ), - hint: tag, + hint: tag != null ? Hint.withMap({'tag': tag}) : null, ); } } diff --git a/packages/smooth_app/macos/Podfile.lock b/packages/smooth_app/macos/Podfile.lock index 9712cc6f4ce..331ec976d71 100644 --- a/packages/smooth_app/macos/Podfile.lock +++ b/packages/smooth_app/macos/Podfile.lock @@ -1,11 +1,14 @@ PODS: - audioplayers_darwin (0.0.1): - FlutterMacOS + - connectivity_plus (0.0.1): + - FlutterMacOS + - ReachabilitySwift - device_info_plus (0.0.1): - FlutterMacOS - file_selector_macos (0.0.1): - FlutterMacOS - - flutter_secure_storage_macos (3.3.1): + - flutter_secure_storage_macos (6.1.1): - FlutterMacOS - FlutterMacOS (1.0.0) - FMDB (2.7.5): @@ -20,13 +23,16 @@ PODS: - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS + - ReachabilitySwift (5.0.0) - rive_common (0.0.1): - FlutterMacOS - - Sentry/HybridSDK (7.31.5) + - Sentry/HybridSDK (8.9.1): + - SentryPrivate (= 8.9.1) - sentry_flutter (0.0.1): - Flutter - FlutterMacOS - - Sentry/HybridSDK (= 7.31.5) + - Sentry/HybridSDK (= 8.9.1) + - SentryPrivate (8.9.1) - share_plus (0.0.1): - FlutterMacOS - shared_preferences_foundation (0.0.1): @@ -40,6 +46,7 @@ PODS: DEPENDENCIES: - audioplayers_darwin (from `Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos`) + - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) - flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`) @@ -58,11 +65,15 @@ DEPENDENCIES: SPEC REPOS: trunk: - FMDB + - ReachabilitySwift - Sentry + - SentryPrivate EXTERNAL SOURCES: audioplayers_darwin: :path: Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos + connectivity_plus: + :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos device_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos file_selector_macos: @@ -94,18 +105,21 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c + connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747 device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9 - flutter_secure_storage_macos: 6ceee8fbc7f484553ad17f79361b556259df89aa + flutter_secure_storage_macos: d56e2d218c1130b262bef8b4a7d64f88d7f9c9ea FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a in_app_review: a850789fad746e89bce03d4aeee8078b45a53fd0 mobile_scanner: ed7618fb749adc6574563e053f3b8e5002c13994 package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 + ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 rive_common: acedcab7802c0ece4b0d838b71d7deb637e1309a - Sentry: 4c9babff9034785067c896fd580b1f7de44da020 - sentry_flutter: 1346a880b24c0240807b53b10cf50ddad40f504e + Sentry: e3203780941722a1fcfee99e351de14244c7f806 + sentry_flutter: 8f0ffd53088e6a4d50c095852c5cad9e4405025c + SentryPrivate: 5e3683390f66611fc7c6215e27645873adb55d13 share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7 shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea diff --git a/packages/smooth_app/pubspec.lock b/packages/smooth_app/pubspec.lock index 1e7ab1593b6..9d3273a60e2 100644 --- a/packages/smooth_app/pubspec.lock +++ b/packages/smooth_app/pubspec.lock @@ -1033,11 +1033,12 @@ packages: mobile_scanner: dependency: transitive description: - name: mobile_scanner - sha256: "9b3d6fb0407f749eb157432b049924277b43ff6948546eeff76260593ad6eca9" - url: "https://pub.dev" - source: hosted - version: "3.4.0" + path: "." + ref: custom_release + resolved-ref: "031ff428687e56e2a1ef94eea8c62a2d43093b56" + url: "https://github.com/openfoodfacts/mobile_scanner.git" + source: git + version: "3.4.1" mockito: dependency: "direct dev" description: @@ -1384,18 +1385,18 @@ packages: dependency: transitive description: name: sentry - sha256: a1529c545fcbc899e5dcc7c94ff1c6ad0c334dfc99a3cda366b1da98af7c5678 + sha256: "39c23342fc96105da449914f7774139a17a0ca8a4e70d9ad5200171f7e47d6ba" url: "https://pub.dev" source: hosted - version: "6.22.0" + version: "7.9.0" sentry_flutter: dependency: "direct main" description: name: sentry_flutter - sha256: cab07e99a8f27af94f399cabceaff6968011660505b30a0e2286728a81bc476c + sha256: ff68ab31918690da004a42e20204242a3ad9ad57da7e2712da8487060ac9767f url: "https://pub.dev" source: hosted - version: "6.22.0" + version: "7.9.0" share_plus: dependency: "direct main" description: diff --git a/packages/smooth_app/pubspec.yaml b/packages/smooth_app/pubspec.yaml index 00241282789..61774a767d3 100644 --- a/packages/smooth_app/pubspec.yaml +++ b/packages/smooth_app/pubspec.yaml @@ -36,7 +36,7 @@ dependencies: photo_view: 0.14.0 uuid: 3.0.7 provider: 6.0.5 - sentry_flutter: 6.22.0 # careful with upgrading cf: https://github.com/openfoodfacts/smooth-app/issues/1300 + sentry_flutter: 7.9.0 sqflite: 2.2.5 url_launcher: 6.1.3 visibility_detector: 0.4.0+2