Ver Fonte

Merge branch 'master' of github.com:ente-io/frame

Neeraj Gupta há 4 anos atrás
pai
commit
7826eb1fcb

+ 13 - 0
ios/Podfile.lock

@@ -73,6 +73,13 @@ PODS:
   - SDWebImageWebPCoder (0.6.1):
     - libwebp (~> 1.0)
     - SDWebImage/Core (~> 5.7)
+  - Sentry (7.1.3):
+    - Sentry/Core (= 7.1.3)
+  - Sentry/Core (7.1.3)
+  - sentry_flutter (0.0.1):
+    - Flutter
+    - FlutterMacOS
+    - Sentry (~> 7.1.3)
   - share (0.0.1):
     - Flutter
   - shared_preferences (0.0.1):
@@ -113,6 +120,7 @@ DEPENDENCIES:
   - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
   - path_provider (from `.symlinks/plugins/path_provider/ios`)
   - photo_manager (from `.symlinks/plugins/photo_manager/ios`)
+  - sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
   - share (from `.symlinks/plugins/share/ios`)
   - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
   - sqflite (from `.symlinks/plugins/sqflite/ios`)
@@ -130,6 +138,7 @@ SPEC REPOS:
     - Reachability
     - SDWebImage
     - SDWebImageWebPCoder
+    - Sentry
     - Toast
 
 EXTERNAL SOURCES:
@@ -177,6 +186,8 @@ EXTERNAL SOURCES:
     :path: ".symlinks/plugins/path_provider/ios"
   photo_manager:
     :path: ".symlinks/plugins/photo_manager/ios"
+  sentry_flutter:
+    :path: ".symlinks/plugins/sentry_flutter/ios"
   share:
     :path: ".symlinks/plugins/share/ios"
   shared_preferences:
@@ -222,6 +233,8 @@ SPEC CHECKSUMS:
   Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
   SDWebImage: 97351f6582ceca541ea294ba66a1fcb342a331c2
   SDWebImageWebPCoder: d0dac55073088d24b2ac1b191a71a8f8d0adac21
+  Sentry: 6d963d64804dd06d96e778be729613f481394312
+  sentry_flutter: f20d4f199442900fbdab2b8496f1d2091d8b94d9
   share: 0b2c3e82132f5888bccca3351c504d0003b3b410
   shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
   sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904

+ 4 - 0
ios/Runner.xcodeproj/project.pbxproj

@@ -252,6 +252,7 @@
 				"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
 				"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
 				"${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder/SDWebImageWebPCoder.framework",
+				"${BUILT_PRODUCTS_DIR}/Sentry/Sentry.framework",
 				"${BUILT_PRODUCTS_DIR}/Toast/Toast.framework",
 				"${BUILT_PRODUCTS_DIR}/background_fetch/background_fetch.framework",
 				"${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework",
@@ -275,6 +276,7 @@
 				"${BUILT_PRODUCTS_DIR}/package_info_plus/package_info_plus.framework",
 				"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
 				"${BUILT_PRODUCTS_DIR}/photo_manager/photo_manager.framework",
+				"${BUILT_PRODUCTS_DIR}/sentry_flutter/sentry_flutter.framework",
 				"${BUILT_PRODUCTS_DIR}/share/share.framework",
 				"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
 				"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
@@ -291,6 +293,7 @@
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework",
+				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sentry.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Toast.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/background_fetch.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity.framework",
@@ -314,6 +317,7 @@
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info_plus.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/photo_manager.framework",
+				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sentry_flutter.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",

+ 2 - 0
lib/core/configuration.dart

@@ -23,6 +23,7 @@ import 'package:photos/services/memories_service.dart';
 import 'package:photos/services/sync_service.dart';
 import 'package:photos/utils/crypto_util.dart';
 import 'package:shared_preferences/shared_preferences.dart';
+import 'package:super_logging/super_logging.dart';
 
 class Configuration {
   Configuration._privateConstructor();
@@ -101,6 +102,7 @@ class Configuration {
         iOptions: _secureStorageOptionsIOS,
       );
       await _migrateSecurityStorageToFirstUnlock();
+      SuperLogging.setUserID(getUserID());
     }
   }
 

+ 2 - 2
lib/core/constants.dart

@@ -4,9 +4,9 @@ const int kThumbnailLargeSize = 512;
 const int kCompressedThumbnailResolution = 1080;
 const int kThumbnailDataLimit = 100 * 1024;
 const String kSentryDSN =
-    "https://93b8ea6f54f442dc8408ebccdff6fe7a@errors.ente.io/2";
+    "https://2235e5c99219488ea93da34b9ac1cb68@sentry.ente.io/4";
 const String kSentryDebugDSN =
-    "https://b31c8af8384a4ce980509b8f592a67eb@errors.ente.io/3";
+    "https://ca5e686dd7f149d9bf94e620564cceba@sentry.ente.io/3";
 const String kRoadmapURL = "https://roadmap.ente.io";
 const int kMicroSecondsInDay = 86400000000;
 const int kAndroid11SDKINT = 30;

+ 1 - 1
lib/main.dart

@@ -217,7 +217,7 @@ Future<void> _killBGTask(String taskId) async {
 }
 
 class EnteApp extends StatelessWidget with WidgetsBindingObserver {
-  static const _homeWidget = const HomeWidget();
+  static const _homeWidget = HomeWidget();
 
   @override
   Widget build(BuildContext context) {

+ 8 - 1
pubspec.lock

@@ -766,7 +766,14 @@ packages:
       name: sentry
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "5.0.0"
+    version: "5.1.0"
+  sentry_flutter:
+    dependency: transitive
+    description:
+      name: sentry_flutter
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "5.1.0"
   share:
     dependency: "direct main"
     description:

+ 17 - 21
thirdparty/super_logging/lib/super_logging.dart

@@ -1,8 +1,8 @@
 library super_logging;
 
 import 'dart:async';
-import 'dart:io';
 import 'dart:collection';
+import 'dart:io';
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/widgets.dart';
@@ -11,7 +11,7 @@ import 'package:logging/logging.dart';
 import 'package:package_info_plus/package_info_plus.dart';
 import 'package:path/path.dart';
 import 'package:path_provider/path_provider.dart';
-import 'package:sentry/sentry.dart';
+import 'package:sentry_flutter/sentry_flutter.dart';
 
 typedef FutureOr<void> FutureOrVoidCallback();
 
@@ -136,8 +136,6 @@ class SuperLogging {
   /// The current super logging configuration
   static LogConfig config;
 
-  static SentryClient sentryClient;
-
   static Future<void> main([LogConfig config]) async {
     config ??= LogConfig();
     SuperLogging.config = config;
@@ -153,7 +151,7 @@ class SuperLogging {
     if (fileIsEnabled) {
       await setupLogDir();
     }
-    if (sentryIsEnabled && sentryClient == null) {
+    if (sentryIsEnabled) {
       setupSentry();
     }
 
@@ -173,26 +171,25 @@ class SuperLogging {
     if (config.body == null) return;
 
     if (enable) {
-      FlutterError.onError = (details) {
-        $.fine(
-          "uncaught error from FlutterError.onError()",
-          details.exception,
-          details.stack,
-        );
-        FlutterError.dumpErrorToConsole(details, forceReport: true);
-        _sendErrorToSentry(details.exception, details.stack);
-      };
-      await runZonedGuarded(config.body, (e, trace) {
-        $.fine("uncaught error from runZoned()", e, trace);
-      });
+      await SentryFlutter.init(
+        (options) {
+          options.dsn = config.sentryDsn;
+        },
+        appRunner: () => config.body(),
+      );
     } else {
       await config.body();
     }
   }
 
-  static void _sendErrorToSentry(Object error, StackTrace stack) {
+  static void setUserID(int userID) {
+    Sentry.configureScope(
+        (scope) => scope.user = SentryUser(id: userID.toString()));
+  }
+
+  static Future<void> _sendErrorToSentry(Object error, StackTrace stack) async {
     try {
-      sentryClient.captureException(
+      await Sentry.captureException(
         error,
         stackTrace: stack,
       );
@@ -263,10 +260,9 @@ class SuperLogging {
   static bool sentryIsEnabled;
 
   static Future<void> setupSentry() async {
-    sentryClient = SentryClient(SentryOptions(dsn: config.sentryDsn));
     await for (final error in sentryQueueControl.stream) {
       try {
-        sentryClient.captureException(
+        Sentry.captureException(
           error,
         );
       } catch (e) {

+ 1 - 1
thirdparty/super_logging/pubspec.yaml

@@ -14,10 +14,10 @@ dependencies:
   package_info_plus: ^1.0.1
   device_info: ^2.0.2
   logging: ^1.0.1
-  sentry: ^5.0.0
   intl: ^0.17.0
   path: ^1.6.4
   path_provider: ^2.0.1
+  sentry_flutter: ^5.1.0
 
 dev_dependencies:
   flutter_test: