mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-16 17:09:31 +01:00
b6d2ddaf7d
BREAKING CHANGE: This introduces that it might require up to 2 compiles for locals to work. Also only arb files shall be checked into git. Took 19 minutes
27 lines
958 B
Dart
27 lines
958 B
Dart
import 'package:bot_toast/bot_toast.dart';
|
|
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
import 'package:localstorage/localstorage.dart';
|
|
|
|
abstract class SentryController {
|
|
static LocalStorage storage = LocalStorage('LocalStorage');
|
|
static Future<void> toggleSentryAction(BuildContext context) async {
|
|
final enableSentry = await SimpleDialogs(context).askConfirmation(
|
|
titleText: L10n.of(context).sendBugReports,
|
|
contentText: L10n.of(context).sentryInfo,
|
|
confirmText: L10n.of(context).ok,
|
|
cancelText: L10n.of(context).no,
|
|
);
|
|
await storage.ready;
|
|
await storage.setItem('sentry', enableSentry);
|
|
BotToast.showText(text: L10n.of(context).changesHaveBeenSaved);
|
|
return;
|
|
}
|
|
|
|
static Future<bool> getSentryStatus() async {
|
|
await storage.ready;
|
|
return storage.getItem('sentry') as bool;
|
|
}
|
|
}
|