Compare commits

..

4 Commits

3 changed files with 23 additions and 9 deletions
+2 -6
View File
@@ -42,9 +42,7 @@ Future main() async {
options.tracesSampleRate = 1.0; options.tracesSampleRate = 1.0;
options.reportPackages = false; options.reportPackages = false;
Sentry.configureScope( Sentry.configureScope(
(scope) => scope.setUser( setSentryScope,
SentryUser(username: Platform.environment['USER']),
),
); );
}, },
appRunner: () => runApp(const MyApp()), appRunner: () => runApp(const MyApp()),
@@ -116,9 +114,7 @@ class _MyHomePageState extends State<MyHomePage> {
} }
Sentry.captureMessage( Sentry.captureMessage(
'Found ${result.length} codes.', 'Found ${result.length} codes.',
withScope: (scope) { withScope: setSentryScope,
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) {
+19 -1
View File
@@ -1,4 +1,7 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:zbar_scan_plugin/zbar_scan_plugin.dart'; import 'package:zbar_scan_plugin/zbar_scan_plugin.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'dart:math'; import 'dart:math';
@@ -32,5 +35,20 @@ CenterAndSize getCenterAndSizeOfPoints(List<PointInfo> points) {
center: center, center: center,
size: size * 1.2, size: size * 1.2,
); );
}
setSentryScope(Scope scope) {
var infoLines = File('/etc/os-release').readAsStringSync().split('\n').where((line) => line.contains('='));
Map<String, dynamic> data = {};
for (var info in infoLines) {
var parts = info.split('=');
data['OS_${parts.first}'] = parts.sublist(1).join('=');
}
return scope.setUser(
SentryUser(
id: File('/etc/machine-id').readAsStringSync(),
username: Platform.environment['USER'],
data: data,
),
);
} }
+2 -2
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1 version: 1.0.1+1
environment: environment:
sdk: '>=2.19.6 <3.0.0' sdk: '>=2.19.6 <3.0.0'
@@ -65,7 +65,7 @@ flutter:
# The following line ensures that the Material Icons font is # The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in # included with your application, so that you can use the icons in
# the material Icons class. # the material Icons class.
uses-material-design: true uses-material-design: false
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets: