mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 23:09:35 +01:00
hotfix: Capture Exception
This commit is contained in:
parent
c8d3c9d614
commit
028b1e4ed8
@ -15,6 +15,7 @@ import 'package:localstorage/localstorage.dart';
|
|||||||
import 'package:universal_html/prefer_universal/html.dart' as html;
|
import 'package:universal_html/prefer_universal/html.dart' as html;
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
import '../main.dart';
|
||||||
import '../utils/app_route.dart';
|
import '../utils/app_route.dart';
|
||||||
import '../utils/beautify_string_extension.dart';
|
import '../utils/beautify_string_extension.dart';
|
||||||
import '../utils/famedlysdk_store.dart';
|
import '../utils/famedlysdk_store.dart';
|
||||||
@ -83,15 +84,20 @@ class MatrixState extends State<Matrix> {
|
|||||||
|
|
||||||
void _initWithStore() async {
|
void _initWithStore() async {
|
||||||
var initLoginState = client.onLoginStateChanged.stream.first;
|
var initLoginState = client.onLoginStateChanged.stream.first;
|
||||||
client.database = await getDatabase(client);
|
try {
|
||||||
client.connect();
|
client.database = await getDatabase(client);
|
||||||
if (await initLoginState == LoginState.logged && PlatformInfos.isMobile) {
|
client.connect();
|
||||||
await FirebaseController.setupFirebase(
|
if (await initLoginState == LoginState.logged && PlatformInfos.isMobile) {
|
||||||
this,
|
await FirebaseController.setupFirebase(
|
||||||
widget.clientName,
|
this,
|
||||||
);
|
widget.clientName,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
_cleanUpUserStatus(userStatuses);
|
||||||
|
} catch (e, s) {
|
||||||
|
client.onLoginStateChanged.sink.addError(e, s);
|
||||||
|
captureException(e, s);
|
||||||
}
|
}
|
||||||
_cleanUpUserStatus(userStatuses);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> getAuthByPassword(String password, [String session]) => {
|
Map<String, dynamic> getAuthByPassword(String password, [String session]) => {
|
||||||
|
@ -18,23 +18,25 @@ import 'views/chat_list.dart';
|
|||||||
|
|
||||||
final sentry = SentryClient(dsn: '8591d0d863b646feb4f3dda7e5dcab38');
|
final sentry = SentryClient(dsn: '8591d0d863b646feb4f3dda7e5dcab38');
|
||||||
|
|
||||||
|
void captureException(error, stackTrace) async {
|
||||||
|
final storage = LocalStorage('LocalStorage');
|
||||||
|
await storage.ready;
|
||||||
|
debugPrint(error.toString());
|
||||||
|
debugPrint(stackTrace.toString());
|
||||||
|
if (storage.getItem('sentry') == true) {
|
||||||
|
await sentry.captureException(
|
||||||
|
exception: error,
|
||||||
|
stackTrace: stackTrace,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
SystemChrome.setSystemUIOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
|
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
|
||||||
runZonedGuarded(
|
runZonedGuarded(
|
||||||
() => runApp(App()),
|
() => runApp(App()),
|
||||||
(error, stackTrace) async {
|
captureException,
|
||||||
final storage = LocalStorage('LocalStorage');
|
|
||||||
await storage.ready;
|
|
||||||
debugPrint(error.toString());
|
|
||||||
debugPrint(stackTrace.toString());
|
|
||||||
if (storage.getItem('sentry') == true) {
|
|
||||||
await sentry.captureException(
|
|
||||||
exception: error,
|
|
||||||
stackTrace: stackTrace,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,6 @@ Future<Database> getDatabase(Client client) async {
|
|||||||
await store.setItem('database-password', password);
|
await store.setItem('database-password', password);
|
||||||
}
|
}
|
||||||
return _db;
|
return _db;
|
||||||
} catch (_) {
|
|
||||||
rethrow;
|
|
||||||
} finally {
|
} finally {
|
||||||
_generateDatabaseLock = false;
|
_generateDatabaseLock = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user