Update Sentry package
This commit is contained in:
parent
fbff144739
commit
28c4a1048e
|
|
@ -43,6 +43,7 @@ android {
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|
@ -62,4 +63,5 @@ dependencies {
|
||||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.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 '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()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
|
@ -78,7 +79,7 @@ dependencies {
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||||
implementation 'com.google.firebase:firebase-core:17.2.0'
|
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 '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'
|
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/ui/pref_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/user/user_middleware.dart';
|
import 'package:invoiceninja_flutter/redux/user/user_middleware.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/vendor/vendor_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/redux.dart';
|
||||||
import 'package:redux_logging/redux_logging.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:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
||||||
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.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 {
|
void main({bool isTesting = false}) async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
final SentryClient _sentry = Config.SENTRY_DNS.isEmpty
|
|
||||||
? null
|
|
||||||
: SentryClient(
|
|
||||||
dsn: Config.SENTRY_DNS,
|
|
||||||
environmentAttributes: await getSentryEvent());
|
|
||||||
|
|
||||||
final store = Store<AppState>(appReducer,
|
final store = Store<AppState>(appReducer,
|
||||||
initialState: await _initialState(isTesting),
|
initialState: await _initialState(isTesting),
|
||||||
middleware: []
|
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));
|
runApp(InvoiceNinjaApp(store: store));
|
||||||
} else {
|
} else {
|
||||||
runZonedGuarded(() {
|
await SentryFlutter.init(
|
||||||
runApp(InvoiceNinjaApp(store: store));
|
(options) {
|
||||||
}, (Object error, StackTrace stackTrace) async {
|
options.dsn = Config.SENTRY_DNS;
|
||||||
if (kDebugMode || kIsWeb) {
|
options.release = kClientVersion;
|
||||||
print(stackTrace);
|
options.beforeSend = (SentryEvent event, {dynamic hint}) {
|
||||||
} else if (store.state.reportErrors) {
|
final state = store.state;
|
||||||
final event = await getSentryEvent(
|
event = event.copyWith(
|
||||||
state: store.state,
|
environment: '${state.environment}'.split('.').last,
|
||||||
exception: error,
|
extra: <String, dynamic>{
|
||||||
stackTrace: stackTrace,
|
'server_version': state.account?.currentVersion ?? 'Unknown',
|
||||||
);
|
},
|
||||||
_sentry.capture(event: event);
|
);
|
||||||
}
|
return event;
|
||||||
});
|
};
|
||||||
|
},
|
||||||
|
appRunner: () => runApp(InvoiceNinjaApp(store: store)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
FlutterError.onError = (FlutterErrorDetails details) {
|
|
||||||
if (kDebugMode || kIsWeb) {
|
|
||||||
FlutterError.dumpErrorToConsole(details);
|
|
||||||
} else if (store.state.reportErrors) {
|
|
||||||
Zone.current.handleUncaughtError(details.exception, details.stack);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AppState> _initialState(bool isTesting) async {
|
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/ui/token/token_screen_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
import 'package:invoiceninja_flutter/utils/web_stub.dart'
|
||||||
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
|
if (dart.library.html) 'package:invoiceninja_flutter/utils/web.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
|
||||||
class InvoiceNinjaApp extends StatefulWidget {
|
class InvoiceNinjaApp extends StatefulWidget {
|
||||||
const InvoiceNinjaApp({Key key, this.store}) : super(key: key);
|
const InvoiceNinjaApp({Key key, this.store}) : super(key: key);
|
||||||
|
|
@ -191,6 +192,9 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
||||||
.toList(),
|
.toList(),
|
||||||
//debugShowCheckedModeBanner: false,
|
//debugShowCheckedModeBanner: false,
|
||||||
//showPerformanceOverlay: true,
|
//showPerformanceOverlay: true,
|
||||||
|
navigatorObservers: [
|
||||||
|
SentryNavigatorObserver(),
|
||||||
|
],
|
||||||
localizationsDelegates: [
|
localizationsDelegates: [
|
||||||
const AppLocalizationsDelegate(),
|
const AppLocalizationsDelegate(),
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
|
|
||||||
|
|
@ -412,28 +412,28 @@ class DashboardPanels extends StatelessWidget {
|
||||||
_InvoiceChart(
|
_InvoiceChart(
|
||||||
viewModel: viewModel,
|
viewModel: viewModel,
|
||||||
context: context,
|
context: context,
|
||||||
onDateSelected: (entityIds) => viewModel.onSelectionChanged(
|
onDateSelected: (entityIds) => viewModel
|
||||||
EntityType.invoice, entityIds)),
|
.onSelectionChanged(EntityType.invoice, entityIds)),
|
||||||
if (company.isModuleEnabled(EntityType.invoice))
|
if (company.isModuleEnabled(EntityType.invoice))
|
||||||
_paymentChart(
|
_paymentChart(
|
||||||
context: context,
|
context: context,
|
||||||
onDateSelected: (entityIds) => viewModel.onSelectionChanged(
|
onDateSelected: (entityIds) => viewModel
|
||||||
EntityType.payment, entityIds)),
|
.onSelectionChanged(EntityType.payment, entityIds)),
|
||||||
if (company.isModuleEnabled(EntityType.quote))
|
if (company.isModuleEnabled(EntityType.quote))
|
||||||
_quoteChart(
|
_quoteChart(
|
||||||
context: context,
|
context: context,
|
||||||
onDateSelected: (entityIds) => viewModel.onSelectionChanged(
|
onDateSelected: (entityIds) => viewModel
|
||||||
EntityType.quote, entityIds)),
|
.onSelectionChanged(EntityType.quote, entityIds)),
|
||||||
if (company.isModuleEnabled(EntityType.task))
|
if (company.isModuleEnabled(EntityType.task))
|
||||||
_taskChart(
|
_taskChart(
|
||||||
context: context,
|
context: context,
|
||||||
onDateSelected: (entityIds) =>
|
onDateSelected: (entityIds) => viewModel
|
||||||
viewModel.onSelectionChanged(EntityType.task, entityIds)),
|
.onSelectionChanged(EntityType.task, entityIds)),
|
||||||
if (company.isModuleEnabled(EntityType.expense))
|
if (company.isModuleEnabled(EntityType.expense))
|
||||||
_expenseChart(
|
_expenseChart(
|
||||||
context: context,
|
context: context,
|
||||||
onDateSelected: (entityIds) => viewModel.onSelectionChanged(
|
onDateSelected: (entityIds) => viewModel
|
||||||
EntityType.expense, entityIds)),
|
.onSelectionChanged(EntityType.expense, entityIds)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 500,
|
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
|
source: hosted
|
||||||
version: "1.3.6"
|
version: "1.3.6"
|
||||||
device_info:
|
device_info:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: device_info
|
name: device_info
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
|
|
@ -860,12 +860,19 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.24.1"
|
version: "0.24.1"
|
||||||
sentry:
|
sentry:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: sentry
|
name: sentry
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
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:
|
share:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -1123,13 +1130,6 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.1+3"
|
version: "0.0.1+3"
|
||||||
usage:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: usage
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "3.4.2"
|
|
||||||
uuid:
|
uuid:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ dependencies:
|
||||||
#firebase_auth: ^0.18.4+1
|
#firebase_auth: ^0.18.4+1
|
||||||
google_sign_in: ^4.5.1
|
google_sign_in: ^4.5.1
|
||||||
local_auth: ^0.6.1+3
|
local_auth: ^0.6.1+3
|
||||||
sentry: ^3.0.1
|
sentry_flutter: ^4.0.1
|
||||||
image_picker: ^0.6.3+4
|
image_picker: ^0.6.3+4
|
||||||
flutter_colorpicker: ^0.3.2
|
flutter_colorpicker: ^0.3.2
|
||||||
flutter_json_widget: ^1.0.2
|
flutter_json_widget: ^1.0.2
|
||||||
|
|
@ -52,7 +52,6 @@ dependencies:
|
||||||
url: git://github.com/hillelcoren/flutter_typeahead.git
|
url: git://github.com/hillelcoren/flutter_typeahead.git
|
||||||
flutter_share: ^1.0.2+1
|
flutter_share: ^1.0.2+1
|
||||||
package_info: ^0.4.0+16
|
package_info: ^0.4.0+16
|
||||||
device_info: ^0.4.2+1
|
|
||||||
rounded_loading_button: ^1.0.0
|
rounded_loading_button: ^1.0.0
|
||||||
# quick_actions: ^0.2.1
|
# quick_actions: ^0.2.1
|
||||||
version: ^1.0.0
|
version: ^1.0.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue