Add sentry provider observer
This commit is contained in:
@@ -64,6 +64,7 @@ Future<void> lazyBootstrap(
|
|||||||
options.enableNdkScopeSync = true;
|
options.enableNdkScopeSync = true;
|
||||||
options.attachThreads = true;
|
options.attachThreads = true;
|
||||||
options.tracesSampleRate = 0.25;
|
options.tracesSampleRate = 0.25;
|
||||||
|
options.enableUserInteractionTracing = true;
|
||||||
options.addIntegration(sentryLogger);
|
options.addIntegration(sentryLogger);
|
||||||
},
|
},
|
||||||
appRunner: () => _lazyBootstrap(widgetsBinding, container, env),
|
appRunner: () => _lazyBootstrap(widgetsBinding, container, env),
|
||||||
@@ -100,6 +101,7 @@ Future<void> _lazyBootstrap(
|
|||||||
runApp(
|
runApp(
|
||||||
ProviderScope(
|
ProviderScope(
|
||||||
parent: container,
|
parent: container,
|
||||||
|
observers: [SentryRiverpodObserver()],
|
||||||
child: SentryUserInteractionWidget(
|
child: SentryUserInteractionWidget(
|
||||||
child: const AppView(),
|
child: const AppView(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ class _ConnectionButton extends StatelessWidget {
|
|||||||
width: 148,
|
width: 148,
|
||||||
height: 148,
|
height: 148,
|
||||||
child: Material(
|
child: Material(
|
||||||
|
key: const ValueKey("home_connection_button"),
|
||||||
shape: const CircleBorder(),
|
shape: const CircleBorder(),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ class AddProfileModal extends HookConsumerWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
_Button(
|
_Button(
|
||||||
|
key: const ValueKey("add_from_clipboard_button"),
|
||||||
label: t.profile.add.fromClipboard,
|
label: t.profile.add.fromClipboard,
|
||||||
icon: Icons.content_paste,
|
icon: Icons.content_paste,
|
||||||
size: buttonWidth,
|
size: buttonWidth,
|
||||||
@@ -124,6 +125,7 @@ class AddProfileModal extends HookConsumerWidget {
|
|||||||
const Gap(buttonsGap),
|
const Gap(buttonsGap),
|
||||||
if (!PlatformUtils.isDesktop)
|
if (!PlatformUtils.isDesktop)
|
||||||
_Button(
|
_Button(
|
||||||
|
key: const ValueKey("add_by_qr_code_button"),
|
||||||
label: t.profile.add.scanQr,
|
label: t.profile.add.scanQr,
|
||||||
icon: Icons.qr_code_scanner,
|
icon: Icons.qr_code_scanner,
|
||||||
size: buttonWidth,
|
size: buttonWidth,
|
||||||
@@ -154,6 +156,7 @@ class AddProfileModal extends HookConsumerWidget {
|
|||||||
)
|
)
|
||||||
else
|
else
|
||||||
_Button(
|
_Button(
|
||||||
|
key: const ValueKey("add_manually_button"),
|
||||||
label: t.profile.add.manually,
|
label: t.profile.add.manually,
|
||||||
icon: Icons.add,
|
icon: Icons.add,
|
||||||
size: buttonWidth,
|
size: buttonWidth,
|
||||||
@@ -176,6 +179,7 @@ class AddProfileModal extends HookConsumerWidget {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 36,
|
height: 36,
|
||||||
child: Material(
|
child: Material(
|
||||||
|
key: const ValueKey("add_manually_button"),
|
||||||
elevation: 8,
|
elevation: 8,
|
||||||
color: theme.colorScheme.surface,
|
color: theme.colorScheme.surface,
|
||||||
surfaceTintColor: theme.colorScheme.surfaceTint,
|
surfaceTintColor: theme.colorScheme.surfaceTint,
|
||||||
@@ -225,6 +229,7 @@ class AddProfileModal extends HookConsumerWidget {
|
|||||||
|
|
||||||
class _Button extends StatelessWidget {
|
class _Button extends StatelessWidget {
|
||||||
const _Button({
|
const _Button({
|
||||||
|
super.key,
|
||||||
required this.label,
|
required this.label,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
required this.size,
|
required this.size,
|
||||||
|
|||||||
44
lib/utils/sentry_riverpod_observer.dart
Normal file
44
lib/utils/sentry_riverpod_observer.dart
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
|
||||||
|
class SentryRiverpodObserver extends ProviderObserver {
|
||||||
|
void addBreadcrumb(String message, {Map<String, dynamic>? data}) {
|
||||||
|
Sentry.addBreadcrumb(
|
||||||
|
Breadcrumb(
|
||||||
|
category: "Provider",
|
||||||
|
message: message,
|
||||||
|
data: data,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didAddProvider(
|
||||||
|
ProviderBase<Object?> provider,
|
||||||
|
Object? value,
|
||||||
|
ProviderContainer container,
|
||||||
|
) {
|
||||||
|
super.didAddProvider(provider, value, container);
|
||||||
|
addBreadcrumb(
|
||||||
|
'Provider [${provider.name ?? provider.runtimeType}] was ADDED',
|
||||||
|
data: value != null ? {"initial-value": value} : null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didUpdateProvider(
|
||||||
|
ProviderBase<Object?> provider,
|
||||||
|
Object? previousValue,
|
||||||
|
Object? newValue,
|
||||||
|
ProviderContainer container,
|
||||||
|
) {
|
||||||
|
super.didUpdateProvider(provider, previousValue, newValue, container);
|
||||||
|
addBreadcrumb(
|
||||||
|
'Provider [${provider.name ?? provider.runtimeType}] was UPDATED',
|
||||||
|
data: {
|
||||||
|
"new-value": newValue,
|
||||||
|
"old-value": previousValue,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ export 'number_formatters.dart';
|
|||||||
export 'placeholders.dart';
|
export 'placeholders.dart';
|
||||||
export 'platform_utils.dart';
|
export 'platform_utils.dart';
|
||||||
export 'sentry_loggy_integration.dart';
|
export 'sentry_loggy_integration.dart';
|
||||||
|
export 'sentry_riverpod_observer.dart';
|
||||||
export 'text_utils.dart';
|
export 'text_utils.dart';
|
||||||
export 'uri_utils.dart';
|
export 'uri_utils.dart';
|
||||||
export 'validators.dart';
|
export 'validators.dart';
|
||||||
|
|||||||
Reference in New Issue
Block a user