chore: Display warning when logout without backup

This commit is contained in:
Krille 2023-02-05 10:34:50 +01:00
parent c670dc2700
commit 2ccc30879b
4 changed files with 14 additions and 8 deletions

View File

@ -2516,5 +2516,6 @@
"deviceKeys": "Device keys:", "deviceKeys": "Device keys:",
"letsStart": "Let's start", "letsStart": "Let's start",
"enterInviteLinkOrMatrixId": "Enter invite link or Matrix ID...", "enterInviteLinkOrMatrixId": "Enter invite link or Matrix ID...",
"reopenChat": "Reopen chat" "reopenChat": "Reopen chat",
"noBackupWarning": "Warning! Without enabling chat backup, you will lose access to your encrypted messages. It is highly recommended to enable the chat backup first before logging out."
} }

View File

@ -94,6 +94,11 @@ abstract class FluffyThemes {
), ),
), ),
), ),
dialogTheme: DialogTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
),
),
elevatedButtonTheme: ElevatedButtonThemeData( elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),

View File

@ -58,11 +58,14 @@ class SettingsController extends State<Settings> {
} }
void logoutAction() async { void logoutAction() async {
final noBackup = showChatBackupBanner == true;
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
useRootNavigator: false, useRootNavigator: false,
context: context, context: context,
title: L10n.of(context)!.areYouSureYouWantToLogout, title: L10n.of(context)!.areYouSureYouWantToLogout,
okLabel: L10n.of(context)!.yes, message: L10n.of(context)!.noBackupWarning,
isDestructiveAction: noBackup,
okLabel: L10n.of(context)!.logout,
cancelLabel: L10n.of(context)!.cancel, cancelLabel: L10n.of(context)!.cancel,
) == ) ==
OkCancelResult.cancel) { OkCancelResult.cancel) {

View File

@ -31,12 +31,9 @@ class SettingsChatView extends StatelessWidget {
title: Text(L10n.of(context)!.emoteSettings), title: Text(L10n.of(context)!.emoteSettings),
onTap: () => VRouter.of(context).to('emotes'), onTap: () => VRouter.of(context).to('emotes'),
trailing: const Icon(Icons.chevron_right_outlined), trailing: const Icon(Icons.chevron_right_outlined),
leading: const Padding( leading: const Icon(Icons.emoji_emotions_outlined),
padding: EdgeInsets.all(16.0),
child: Icon(Icons.insert_emoticon_outlined),
), ),
), const Divider(),
const Divider(height: 1),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.renderRichContent, title: L10n.of(context)!.renderRichContent,
onChanged: (b) => AppConfig.renderHtml = b, onChanged: (b) => AppConfig.renderHtml = b,
@ -68,7 +65,7 @@ class SettingsChatView extends StatelessWidget {
storeKey: SettingKeys.autoplayImages, storeKey: SettingKeys.autoplayImages,
defaultValue: AppConfig.autoplayImages, defaultValue: AppConfig.autoplayImages,
), ),
const Divider(height: 1), const Divider(),
SettingsSwitchListTile.adaptive( SettingsSwitchListTile.adaptive(
title: L10n.of(context)!.sendOnEnter, title: L10n.of(context)!.sendOnEnter,
onChanged: (b) => AppConfig.sendOnEnter = b, onChanged: (b) => AppConfig.sendOnEnter = b,