Skip to content

Commit

Permalink
Update Sentry setup (#1142)
Browse files Browse the repository at this point in the history
* added sentry for desktop and updated setup.

* Update Podfile.lock
  • Loading branch information
jigar-f authored Aug 8, 2024
1 parent 4d35c0d commit 8018ee0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 45 deletions.
10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ PODS:
- SDWebImageWebPCoder (0.14.6):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.17)
- Sentry/HybridSDK (8.29.0)
- sentry_flutter (8.3.0):
- Sentry/HybridSDK (8.32.0)
- sentry_flutter (8.6.0):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.29.0)
- Sentry/HybridSDK (= 8.32.0)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
Expand Down Expand Up @@ -291,8 +291,8 @@ SPEC CHECKSUMS:
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
Sentry: 016de45ee5ce5fca2a829996f1bfafeb5e62e8b4
sentry_flutter: 5fb57c5b7e6427a9dc1fedde4269eb65823982d4
Sentry: 96ae1dcdf01a644bc3a3b1dc279cecaf48a833fb
sentry_flutter: 090351ce1ff5f96a4b33ef9455b7e3b28185387d
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Expand Down
28 changes: 12 additions & 16 deletions lib/catcher_setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,13 @@ import 'package:sentry_flutter/sentry_flutter.dart';
final debugOption = Catcher2Options(
SilentReportMode(),
[
// SentryHandler(
// SentryClient(
// SentryOptions(
// dsn: Platform.isAndroid
// ? 'https://4753d78f885f4b79a497435907ce4210@o75725.ingest.sentry.io/5850353'
// : 'https://c14296fdf5a6be272e1ecbdb7cb23f76@o75725.ingest.sentry.io/4506081382694912',
// ),
// ),
// printLogs: true,
// ),
ConsoleHandler(
enableApplicationParameters: true,
enableDeviceParameters: true,
enableCustomParameters: true,
enableStackTrace: true,
),
),
],

);

final releaseOption = Catcher2Options(
Expand All @@ -39,14 +28,11 @@ final releaseOption = Catcher2Options(
SentryHandler(
SentryClient(
SentryOptions(
dsn: Platform.isAndroid
? 'https://4753d78f885f4b79a497435907ce4210@o75725.ingest.sentry.io/5850353'
: 'https://c14296fdf5a6be272e1ecbdb7cb23f76@o75725.ingest.sentry.io/4506081382694912',
dsn: dnsConfig(),
),
),
printLogs: true,
enableApplicationParameters: true,

),
],
);
Expand All @@ -58,3 +44,13 @@ Catcher2 setupCatcherAndRun(Widget root) {
releaseConfig: releaseOption,
);
}

String dnsConfig() {
if (Platform.isAndroid) {
return "https://4753d78f885f4b79a497435907ce4210@o75725.ingest.sentry.io/5850353";
}
if (Platform.isIOS) {
return "https://c14296fdf5a6be272e1ecbdb7cb23f76@o75725.ingest.sentry.io/4506081382694912";
}
return "https://7397d9db6836eb599f41f2c496dee648@o75725.ingest.us.sentry.io/4507734480912384";
}
24 changes: 13 additions & 11 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:lantern/common/common.dart';
import 'package:lantern/common/common_desktop.dart';
import 'package:lantern/core/purchase/app_purchase.dart';
import 'package:lantern/replica/ui/utils.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:window_manager/window_manager.dart';

import 'catcher_setup.dart';
Expand Down Expand Up @@ -63,17 +64,18 @@ Future<void> main() async {
await Localization.ensureInitialized();
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);

//Todo if catcher is not picking up error and exception then we should switch to sentryFlutter
// SentryFlutter.init((options) {
// options.debug = true;
// options.anrEnabled = true;
// options.autoInitializeNativeSdk = true;
// options.attachScreenshot = true;
// options.dsn = Platform.isAndroid
// ? 'https://4753d78f885f4b79a497435907ce4210@o75725.ingest.sentry.io/5850353'
// : 'https://c14296fdf5a6be272e1ecbdb7cb23f76@o75725.ingest.sentry.io/4506081382694912';
// }, appRunner: () => setupCatcherAndRun(LanternApp()));
setupCatcherAndRun(const LanternApp());
SentryFlutter.init((options) {
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
// The sampling rate for profiling is relative to tracesSampleRate
// Setting to 1.0 will profile 100% of sampled transactions:
options.profilesSampleRate = 1.0;
options.dsn = kReleaseMode ? dnsConfig() : "";
options.enableNativeCrashHandling = true;
}, appRunner: () => runApp(const LanternApp()));

// setupCatcherAndRun(const LanternApp());
}

Future<void> _initGoogleMobileAds() async {
Expand Down
12 changes: 6 additions & 6 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ PODS:
- FlutterMacOS
- screen_retriever (0.0.1):
- FlutterMacOS
- Sentry/HybridSDK (8.29.0)
- sentry_flutter (8.3.0):
- Sentry/HybridSDK (8.32.0)
- sentry_flutter (8.6.0):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.29.0)
- Sentry/HybridSDK (= 8.32.0)
- share_plus (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
Expand Down Expand Up @@ -139,8 +139,8 @@ SPEC CHECKSUMS:
package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
Sentry: 016de45ee5ce5fca2a829996f1bfafeb5e62e8b4
sentry_flutter: 5fb57c5b7e6427a9dc1fedde4269eb65823982d4
Sentry: 96ae1dcdf01a644bc3a3b1dc279cecaf48a833fb
sentry_flutter: 090351ce1ff5f96a4b33ef9455b7e3b28185387d
share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Expand All @@ -151,4 +151,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: b026caf428aef5db8f45e6734a110a98281273f6

COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1586,18 +1586,18 @@ packages:
dependency: transitive
description:
name: sentry
sha256: "7342ef4c18932881730ac941a07a6e4cf76fe99cd1ea3bef06e53a6a1402dec0"
sha256: "76ad4fab90ff82427c26939bd79dc4df345a081e2b1cd5954b947e340b9af9a5"
url: "https://pub.dev"
source: hosted
version: "8.3.0"
version: "8.6.0"
sentry_flutter:
dependency: "direct main"
description:
name: sentry_flutter
sha256: "475cf49682e4d1eb48caa2577502721bcfdcbb63f215de57b3b246d52f4f7914"
sha256: a7c92014701093a7c0a373e1a47c54ec428d8468d8bf2b793fee7ea1b085c21b
url: "https://pub.dev"
source: hosted
version: "8.3.0"
version: "8.6.0"
share_plus:
dependency: "direct main"
description:
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ dependencies:
flag: ^7.0.0

#Loogs and crash reporting
catcher_2: ^1.2.4
sentry_flutter: ^8.3.0
catcher_2: ^1.2.6
sentry_flutter: ^8.6.0

badges: ^3.1.1
badges: ^3.1.2
dotted_border: ^2.0.0+3
styled_text: ^8.1.0
emoji_picker_flutter: ^1.6.4
Expand Down

0 comments on commit 8018ee0

Please sign in to comment.