add sentry.
This commit is contained in:
+23
-1
@@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
import 'package:flutter_acrylic/flutter_acrylic.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
import 'package:zbar_scan_plugin/zbar_scan_plugin.dart' as zbar;
|
import 'package:zbar_scan_plugin/zbar_scan_plugin.dart' as zbar;
|
||||||
@@ -35,7 +36,19 @@ Future main() async {
|
|||||||
await windowManager.focus();
|
await windowManager.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
runApp(const MyApp());
|
await SentryFlutter.init(
|
||||||
|
(options) {
|
||||||
|
options.dsn = 'https://6b0c6212196241fa88df20dfcc495c4a@o644838.ingest.sentry.io/4505045898166272';
|
||||||
|
options.tracesSampleRate = 1.0;
|
||||||
|
options.reportPackages = false;
|
||||||
|
Sentry.configureScope(
|
||||||
|
(scope) => scope.setUser(
|
||||||
|
SentryUser(username: Platform.environment['USER']),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
appRunner: () => runApp(const MyApp()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
@@ -100,6 +113,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
status = codes.isEmpty ? Status.notFound : Status.found;
|
status = codes.isEmpty ? Status.notFound : Status.found;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Sentry.captureMessage(
|
||||||
|
'Found ${result.length} codes.',
|
||||||
|
withScope: (scope) {
|
||||||
|
SentryUser(username: Platform.environment['USER']);
|
||||||
|
},
|
||||||
|
);
|
||||||
Future.delayed(const Duration(seconds: 3), () {
|
Future.delayed(const Duration(seconds: 3), () {
|
||||||
if (status == Status.notFound) {
|
if (status == Status.notFound) {
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -125,6 +144,9 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
if (MediaQuery.of(context).size.shortestSide < 10) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if ([
|
if ([
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <flutter_acrylic/flutter_acrylic_plugin.h>
|
#include <flutter_acrylic/flutter_acrylic_plugin.h>
|
||||||
#include <screen_retriever/screen_retriever_plugin.h>
|
#include <screen_retriever/screen_retriever_plugin.h>
|
||||||
|
#include <sentry_flutter/sentry_flutter_plugin.h>
|
||||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||||
#include <window_manager/window_manager_plugin.h>
|
#include <window_manager/window_manager_plugin.h>
|
||||||
|
|
||||||
@@ -18,6 +19,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
|||||||
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
|
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
|
||||||
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
|
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
|
||||||
|
g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
|
||||||
|
sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
|
||||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
flutter_acrylic
|
flutter_acrylic
|
||||||
screen_retriever
|
screen_retriever
|
||||||
|
sentry_flutter
|
||||||
url_launcher_linux
|
url_launcher_linux
|
||||||
window_manager
|
window_manager
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ dependencies:
|
|||||||
zbar_scan_plugin:
|
zbar_scan_plugin:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/debuggerx01/zbar_scan_plugin.git
|
url: https://github.com/debuggerx01/zbar_scan_plugin.git
|
||||||
|
sentry_flutter: ^7.4.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user