From 2ccc30879b1a779976095d4fb00fcc7b3cd9fd55 Mon Sep 17 00:00:00 2001 From: Krille Date: Sun, 5 Feb 2023 10:34:50 +0100 Subject: [PATCH] chore: Display warning when logout without backup --- assets/l10n/intl_en.arb | 3 ++- lib/config/themes.dart | 5 +++++ lib/pages/settings/settings.dart | 5 ++++- lib/pages/settings_chat/settings_chat_view.dart | 9 +++------ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index c7c3496c..3ac86d80 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -2516,5 +2516,6 @@ "deviceKeys": "Device keys:", "letsStart": "Let's start", "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." } \ No newline at end of file diff --git a/lib/config/themes.dart b/lib/config/themes.dart index a217595a..e202a927 100644 --- a/lib/config/themes.dart +++ b/lib/config/themes.dart @@ -94,6 +94,11 @@ abstract class FluffyThemes { ), ), ), + dialogTheme: DialogTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(AppConfig.borderRadius), + ), + ), elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( padding: const EdgeInsets.all(16), diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index e7f83701..97b4dc63 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -58,11 +58,14 @@ class SettingsController extends State { } void logoutAction() async { + final noBackup = showChatBackupBanner == true; if (await showOkCancelAlertDialog( useRootNavigator: false, context: context, 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, ) == OkCancelResult.cancel) { diff --git a/lib/pages/settings_chat/settings_chat_view.dart b/lib/pages/settings_chat/settings_chat_view.dart index 6437c689..cf4c0906 100644 --- a/lib/pages/settings_chat/settings_chat_view.dart +++ b/lib/pages/settings_chat/settings_chat_view.dart @@ -31,12 +31,9 @@ class SettingsChatView extends StatelessWidget { title: Text(L10n.of(context)!.emoteSettings), onTap: () => VRouter.of(context).to('emotes'), trailing: const Icon(Icons.chevron_right_outlined), - leading: const Padding( - padding: EdgeInsets.all(16.0), - child: Icon(Icons.insert_emoticon_outlined), - ), + leading: const Icon(Icons.emoji_emotions_outlined), ), - const Divider(height: 1), + const Divider(), SettingsSwitchListTile.adaptive( title: L10n.of(context)!.renderRichContent, onChanged: (b) => AppConfig.renderHtml = b, @@ -68,7 +65,7 @@ class SettingsChatView extends StatelessWidget { storeKey: SettingKeys.autoplayImages, defaultValue: AppConfig.autoplayImages, ), - const Divider(height: 1), + const Divider(), SettingsSwitchListTile.adaptive( title: L10n.of(context)!.sendOnEnter, onChanged: (b) => AppConfig.sendOnEnter = b,