Update Sentry package
This commit is contained in:
parent
fbff144739
commit
28c4a1048e
|
|
@ -43,6 +43,7 @@ android {
|
|||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
@ -62,4 +63,5 @@ dependencies {
|
|||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
implementation 'com.google.guava:guava:27.0.1-android' // https://stackoverflow.com/a/56639924/497368
|
||||
implementation 'androidx.multidex:multidex:2.0.1' // https://stackoverflow.com/a/55592039/497368
|
||||
}
|
||||
|
|
@ -47,6 +47,7 @@ android {
|
|||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
|
@ -78,7 +79,7 @@ dependencies {
|
|||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
implementation 'com.google.firebase:firebase-core:17.2.0'
|
||||
implementation 'com.google.guava:guava:27.0.1-android' // https://stackoverflow.com/a/56639924/497368
|
||||
|
||||
implementation 'androidx.multidex:multidex:2.0.1' // https://stackoverflow.com/a/55592039/497368
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
|
@ -31,10 +31,9 @@ import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_middleware.dart';
|
|||
import 'package:invoiceninja_flutter/redux/ui/pref_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/user/user_middleware.dart';
|
||||
import 'package:invoiceninja_flutter/redux/vendor/vendor_middleware.dart';
|
||||
import 'package:invoiceninja_flutter/utils/sentry.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:redux_logging/redux_logging.dart';
|
||||
import 'package:sentry/sentry.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
||||
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
|
||||
|
|
@ -50,12 +49,6 @@ import 'package:invoiceninja_flutter/redux/payment_term/payment_term_middleware.
|
|||
void main({bool isTesting = false}) async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
final SentryClient _sentry = Config.SENTRY_DNS.isEmpty
|
||||
? null
|
||||
: SentryClient(
|
||||
dsn: Config.SENTRY_DNS,
|
||||
environmentAttributes: await getSentryEvent());
|
||||
|
||||
final store = Store<AppState>(appReducer,
|
||||
initialState: await _initialState(isTesting),
|
||||
middleware: []
|
||||
|
|
@ -95,32 +88,27 @@ void main({bool isTesting = false}) async {
|
|||
),
|
||||
]));
|
||||
|
||||
if (_sentry == null) {
|
||||
if (kIsWeb || !kReleaseMode || Config.SENTRY_DNS.isEmpty) {
|
||||
runApp(InvoiceNinjaApp(store: store));
|
||||
} else {
|
||||
runZonedGuarded(() {
|
||||
runApp(InvoiceNinjaApp(store: store));
|
||||
}, (Object error, StackTrace stackTrace) async {
|
||||
if (kDebugMode || kIsWeb) {
|
||||
print(stackTrace);
|
||||
} else if (store.state.reportErrors) {
|
||||
final event = await getSentryEvent(
|
||||
state: store.state,
|
||||
exception: error,
|
||||
stackTrace: stackTrace,
|
||||
await SentryFlutter.init(
|
||||
(options) {
|
||||
options.dsn = Config.SENTRY_DNS;
|
||||
options.release = kClientVersion;
|
||||
options.beforeSend = (SentryEvent event, {dynamic hint}) {
|
||||
final state = store.state;
|
||||
event = event.copyWith(
|
||||
environment: '${state.environment}'.split('.').last,
|
||||
extra: <String, dynamic>{
|
||||
'server_version': state.account?.currentVersion ?? 'Unknown',
|
||||
},
|
||||
);
|
||||
_sentry.capture(event: event);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
FlutterError.onError = (FlutterErrorDetails details) {
|
||||
if (kDebugMode || kIsWeb) {
|
||||
FlutterError.dumpErrorToConsole(details);
|
||||
} else if (store.state.reportErrors) {
|
||||
Zone.current.handleUncaughtError(details.exception, details.stack);
|
||||
}
|
||||
return event;
|
||||
};
|
||||
},
|
||||
appRunner: () => runApp(InvoiceNinjaApp(store: store)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<AppState> _initialState(bool isTesting) async {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ import 'package:invoiceninja_flutter/ui/token/view/token_view_vm.dart';
|
|||
import 'package:invoiceninja_flutter/ui/token/token_screen_vm.dart';
|
||||
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
||||
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
class InvoiceNinjaApp extends StatefulWidget {
|
||||
const InvoiceNinjaApp({Key key, this.store}) : super(key: key);
|
||||
|
|
@ -191,6 +192,9 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
|||
.toList(),
|
||||
//debugShowCheckedModeBanner: false,
|
||||
//showPerformanceOverlay: true,
|
||||
navigatorObservers: [
|
||||
SentryNavigatorObserver(),
|
||||
],
|
||||
localizationsDelegates: [
|
||||
const AppLocalizationsDelegate(),
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
|
|
|
|||
|
|
@ -412,28 +412,28 @@ class DashboardPanels extends StatelessWidget {
|
|||
_InvoiceChart(
|
||||
viewModel: viewModel,
|
||||
context: context,
|
||||
onDateSelected: (entityIds) => viewModel.onSelectionChanged(
|
||||
EntityType.invoice, entityIds)),
|
||||
onDateSelected: (entityIds) => viewModel
|
||||
.onSelectionChanged(EntityType.invoice, entityIds)),
|
||||
if (company.isModuleEnabled(EntityType.invoice))
|
||||
_paymentChart(
|
||||
context: context,
|
||||
onDateSelected: (entityIds) => viewModel.onSelectionChanged(
|
||||
EntityType.payment, entityIds)),
|
||||
onDateSelected: (entityIds) => viewModel
|
||||
.onSelectionChanged(EntityType.payment, entityIds)),
|
||||
if (company.isModuleEnabled(EntityType.quote))
|
||||
_quoteChart(
|
||||
context: context,
|
||||
onDateSelected: (entityIds) => viewModel.onSelectionChanged(
|
||||
EntityType.quote, entityIds)),
|
||||
onDateSelected: (entityIds) => viewModel
|
||||
.onSelectionChanged(EntityType.quote, entityIds)),
|
||||
if (company.isModuleEnabled(EntityType.task))
|
||||
_taskChart(
|
||||
context: context,
|
||||
onDateSelected: (entityIds) =>
|
||||
viewModel.onSelectionChanged(EntityType.task, entityIds)),
|
||||
onDateSelected: (entityIds) => viewModel
|
||||
.onSelectionChanged(EntityType.task, entityIds)),
|
||||
if (company.isModuleEnabled(EntityType.expense))
|
||||
_expenseChart(
|
||||
context: context,
|
||||
onDateSelected: (entityIds) => viewModel.onSelectionChanged(
|
||||
EntityType.expense, entityIds)),
|
||||
onDateSelected: (entityIds) => viewModel
|
||||
.onSelectionChanged(EntityType.expense, entityIds)),
|
||||
SizedBox(
|
||||
height: 500,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:sentry/sentry.dart';
|
||||
|
||||
Future<Event> getSentryEvent(
|
||||
{AppState state, dynamic exception, dynamic stackTrace}) async {
|
||||
OperatingSystem os;
|
||||
Device device;
|
||||
|
||||
if (kIsWeb) {
|
||||
// TODO track web info
|
||||
os = OperatingSystem(
|
||||
name: 'Web',
|
||||
);
|
||||
} else {
|
||||
//final packageInfo = await PackageInfo.fromPlatform();
|
||||
final deviceInfo = DeviceInfoPlugin();
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
final androidInfo = await deviceInfo.androidInfo;
|
||||
os = OperatingSystem(
|
||||
name: 'Android',
|
||||
version: androidInfo.version.release,
|
||||
);
|
||||
device = Device(
|
||||
model: androidInfo.model,
|
||||
manufacturer: androidInfo.manufacturer,
|
||||
modelId: androidInfo.product,
|
||||
);
|
||||
} else if (Platform.isIOS) {
|
||||
final iosInfo = await deviceInfo.iosInfo;
|
||||
os = OperatingSystem(
|
||||
name: iosInfo.systemName,
|
||||
version: iosInfo.systemVersion,
|
||||
);
|
||||
device = Device(
|
||||
model: iosInfo.utsname.machine,
|
||||
manufacturer: 'Apple',
|
||||
family: iosInfo.model,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String environment = 'Unknown';
|
||||
if (state != null) {
|
||||
environment = '${state.environment}'.split('.').last;
|
||||
}
|
||||
|
||||
return Event(
|
||||
release: kClientVersion,
|
||||
//release: packageInfo.version,
|
||||
environment: environment,
|
||||
stackTrace: stackTrace,
|
||||
exception: exception,
|
||||
extra: <String, dynamic>{
|
||||
'server_version': state?.account?.currentVersion ?? 'Unknown',
|
||||
},
|
||||
contexts: Contexts(
|
||||
operatingSystem: os,
|
||||
device: device,
|
||||
app: App(
|
||||
//version: kClientVersion,
|
||||
//name: packageInfo.appName,
|
||||
//version: packageInfo.version,
|
||||
//build: packageInfo.buildNumber,
|
||||
)),
|
||||
);
|
||||
}
|
||||
20
pubspec.lock
20
pubspec.lock
|
|
@ -219,7 +219,7 @@ packages:
|
|||
source: hosted
|
||||
version: "1.3.6"
|
||||
device_info:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_info
|
||||
url: "https://pub.dartlang.org"
|
||||
|
|
@ -860,12 +860,19 @@ packages:
|
|||
source: hosted
|
||||
version: "0.24.1"
|
||||
sentry:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sentry
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "4.0.1"
|
||||
sentry_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: sentry_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.1"
|
||||
share:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1123,13 +1130,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+3"
|
||||
usage:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: usage
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.4.2"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ dependencies:
|
|||
#firebase_auth: ^0.18.4+1
|
||||
google_sign_in: ^4.5.1
|
||||
local_auth: ^0.6.1+3
|
||||
sentry: ^3.0.1
|
||||
sentry_flutter: ^4.0.1
|
||||
image_picker: ^0.6.3+4
|
||||
flutter_colorpicker: ^0.3.2
|
||||
flutter_json_widget: ^1.0.2
|
||||
|
|
@ -52,7 +52,6 @@ dependencies:
|
|||
url: git://github.com/hillelcoren/flutter_typeahead.git
|
||||
flutter_share: ^1.0.2+1
|
||||
package_info: ^0.4.0+16
|
||||
device_info: ^0.4.2+1
|
||||
rounded_loading_button: ^1.0.0
|
||||
# quick_actions: ^0.2.1
|
||||
version: ^1.0.0
|
||||
|
|
|
|||
Loading…
Reference in New Issue