chore: Remove error logging with sentry

This commit is contained in:
Christian Pauly 2022-08-14 16:18:18 +02:00
commit 84ad3b88d4
13 changed files with 9 additions and 119 deletions

View file

@ -8,7 +8,6 @@ import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/widgets/sentry_switch_list_tile.dart';
import '../config/app_config.dart';
abstract class PlatformInfos {
@ -62,7 +61,6 @@ abstract class PlatformInfos {
onPressed: () => VRouter.of(context).to('logs'),
child: const Text('Logs'),
),
SentrySwitchListTile.adaptive(label: L10n.of(context)!.sendBugReports),
],
applicationIcon: Image.asset('assets/logo.png', width: 64, height: 64),
applicationName: AppConfig.applicationName,

View file

@ -8,7 +8,6 @@ import 'package:path_provider/path_provider.dart';
import 'package:video_compress/video_compress.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/sentry_controller.dart';
extension ResizeImage on MatrixFile {
static const int max = 1200;
@ -23,7 +22,7 @@ extension ResizeImage on MatrixFile {
// will throw an error e.g. on Android SDK < 18
mediaInfo = await VideoCompress.compressVideo(tmpFile.path);
} catch (e, s) {
SentryController.captureException(e, s);
Logs().w('Error while compressing video', e, s);
}
return MatrixVideoFile(
bytes: (await mediaInfo?.file?.readAsBytes()) ?? bytes,
@ -50,7 +49,7 @@ extension ResizeImage on MatrixFile {
name: name,
);
} catch (e, s) {
SentryController.captureException(e, s);
Logs().w('Error while compressing video', e, s);
}
return null;
}

View file

@ -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,
);
}
}
}