chore: Remove error logging with sentry
parent
c4ec6ebb3f
commit
84ad3b88d4
@ -1,37 +0,0 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:matrix/matrix.dart';
|
|
||||||
import 'package:sentry/sentry.dart';
|
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
|
||||||
import '../config/setting_keys.dart';
|
|
||||||
import 'famedlysdk_store.dart';
|
|
||||||
|
|
||||||
abstract class SentryController {
|
|
||||||
static Future<void> toggleSentryAction(
|
|
||||||
BuildContext context, bool enableSentry) async {
|
|
||||||
if (!AppConfig.enableSentry) return;
|
|
||||||
final storage = Store();
|
|
||||||
await storage.setItemBool(SettingKeys.sentry, enableSentry);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future<bool> getSentryStatus() async {
|
|
||||||
if (!AppConfig.enableSentry) return false;
|
|
||||||
final storage = Store();
|
|
||||||
return await storage.getItemBool(SettingKeys.sentry);
|
|
||||||
}
|
|
||||||
|
|
||||||
static final sentry = SentryClient(SentryOptions(dsn: AppConfig.sentryDns));
|
|
||||||
|
|
||||||
static void captureException(error, stackTrace) async {
|
|
||||||
Logs().e('Capture exception', error, stackTrace);
|
|
||||||
if (!kDebugMode && await getSentryStatus()) {
|
|
||||||
await sentry.captureException(
|
|
||||||
error,
|
|
||||||
stackTrace: stackTrace,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:fluffychat/utils/sentry_controller.dart';
|
|
||||||
|
|
||||||
class SentrySwitchListTile extends StatefulWidget {
|
|
||||||
final String label;
|
|
||||||
|
|
||||||
const SentrySwitchListTile.adaptive({Key? key, required this.label})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_SentrySwitchListTileState createState() => _SentrySwitchListTileState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SentrySwitchListTileState extends State<SentrySwitchListTile> {
|
|
||||||
bool _enabled = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return FutureBuilder<bool>(
|
|
||||||
future: SentryController.getSentryStatus(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
_enabled = snapshot.data ?? false;
|
|
||||||
return SwitchListTile.adaptive(
|
|
||||||
title: Text(widget.label),
|
|
||||||
value: _enabled,
|
|
||||||
onChanged: (b) =>
|
|
||||||
SentryController.toggleSentryAction(context, b).then(
|
|
||||||
(_) => setState(() {}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue