Added sentry to prod build
This commit is contained in:
parent
609cf8422a
commit
8301e6a40e
2 changed files with 27 additions and 5 deletions
|
|
@ -5,9 +5,11 @@ import 'package:fires_flutter/models/yourLocationPersist.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_simple_dependency_injection/injector.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:sentry/sentry.dart';
|
||||
|
||||
import 'firebaseMessagingConf.dart';
|
||||
import 'firesApp.dart';
|
||||
import 'globals.dart' as globals;
|
||||
import 'models/appState.dart';
|
||||
import 'models/firesApi.dart';
|
||||
import 'redux/fetchDataMiddleware.dart';
|
||||
|
|
@ -33,12 +35,20 @@ void mainCommon(List<Middleware<AppState>> otherMiddleware) {
|
|||
injector.map(String, (i) => store.state.firesApiKey, key: "firesApiKey");
|
||||
injector.map(String, (i) => store.state.gmapKey, key: "gmapKey");
|
||||
|
||||
VoidCallback mainFn = () {
|
||||
loadYourLocations().then((yl) {
|
||||
firebaseConfig(store);
|
||||
|
||||
// Run baby run!
|
||||
runApp(new FiresApp(store));
|
||||
});
|
||||
};
|
||||
|
||||
if (!globals.isDevelopment)
|
||||
// Run in production with sentry catch
|
||||
main(mainFn, secrets['sentryDSN']);
|
||||
else
|
||||
mainFn();
|
||||
|
||||
// Listen to store changes, and re-render when the state is updated
|
||||
store.onChange.listen((state) {
|
||||
|
|
@ -46,3 +56,14 @@ void mainCommon(List<Middleware<AppState>> otherMiddleware) {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
main(mainFn, key) async {
|
||||
SentryClient sentry = new SentryClient(dsn: key);
|
||||
mainFn();
|
||||
try {} catch (error, stackTrace) {
|
||||
await sentry.captureException(
|
||||
exception: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ dependencies:
|
|||
simple_moment: "^0.0.3"
|
||||
just_debounce_it: "^1.0.4"
|
||||
flutter_simple_dependency_injection: "^0.0.2"
|
||||
sentry: "^2.0.2"
|
||||
|
||||
# net
|
||||
http: "^0.11.3+16"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue