From ea5fa5b252448637211a26b30d21267c59c9ff8e Mon Sep 17 00:00:00 2001 From: Aman Raj Singh Mourya Date: Tue, 1 Oct 2024 00:47:13 +0530 Subject: [PATCH] [auth] warning dialog --- .../ui/settings/security_section_widget.dart | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/auth/lib/ui/settings/security_section_widget.dart b/auth/lib/ui/settings/security_section_widget.dart index 7cc6e870b8..256079ca7a 100644 --- a/auth/lib/ui/settings/security_section_widget.dart +++ b/auth/lib/ui/settings/security_section_widget.dart @@ -10,14 +10,17 @@ import 'package:ente_auth/services/user_service.dart'; import 'package:ente_auth/theme/ente_theme.dart'; import 'package:ente_auth/ui/account/request_pwd_verification_page.dart'; import 'package:ente_auth/ui/account/sessions_page.dart'; +import 'package:ente_auth/ui/components/buttons/button_widget.dart'; import 'package:ente_auth/ui/components/captioned_text_widget.dart'; import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart'; import 'package:ente_auth/ui/components/menu_item_widget.dart'; +import 'package:ente_auth/ui/components/models/button_result.dart'; import 'package:ente_auth/ui/components/toggle_switch_widget.dart'; import 'package:ente_auth/ui/settings/common_settings.dart'; import 'package:ente_auth/ui/settings/lock_screen/lock_screen_options.dart'; import 'package:ente_auth/utils/auth_util.dart'; import 'package:ente_auth/utils/dialog_util.dart'; +import 'package:ente_auth/utils/lock_screen_settings.dart'; import 'package:ente_auth/utils/navigation_util.dart'; import 'package:ente_auth/utils/platform_util.dart'; import 'package:ente_auth/utils/toast_util.dart'; @@ -146,6 +149,24 @@ class _SecuritySectionWidgetState extends State { trailingIcon: Icons.chevron_right_outlined, trailingIconIsMuted: true, onTap: () async { + ButtonResult? result; + if (_config.hasOptedForOfflineMode() && + !LockScreenSettings.instance.getOfflineModeWarningStatus()) { + result = await showChoiceActionSheet( + context, + title: context.l10n.warning, + body: + "You have chosen to proceed without backups. If you forget the applock, all data will be lost, and you'll need to reinstall the app.", + secondButtonLabel: context.l10n.cancel, + firstButtonLabel: context.l10n.ok, + ); + if (result?.action == ButtonAction.first) { + await LockScreenSettings.instance + .setOfflineModeWarningStatus(true); + } else { + return; + } + } if (await Configuration.instance.shouldShowLockScreen()) { final bool result = await requestAuthentication( context,