π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[auth] Lock icon to manually lock app on desktop
Aman Raj Singh Mouryad139d23c21bc
diff --git a/auth/lib/ui/home_page.dart b/auth/lib/ui/home_page.dartindex f9c6410d9d..1c47c17ae8 100644--- a/auth/lib/ui/home_page.dart+++ b/auth/lib/ui/home_page.dart@@ -22,11 +22,16 @@ import 'package:ente_auth/ui/account/logout_dialog.dart';import 'package:ente_auth/ui/code_error_widget.dart';import 'package:ente_auth/ui/code_widget.dart';import 'package:ente_auth/ui/common/loading_widget.dart';+import 'package:ente_auth/ui/components/buttons/button_widget.dart';+import 'package:ente_auth/ui/components/dialog_widget.dart';+import 'package:ente_auth/ui/components/models/button_type.dart';import 'package:ente_auth/ui/home/coach_mark_widget.dart';import 'package:ente_auth/ui/home/home_empty_state.dart';import 'package:ente_auth/ui/home/speed_dial_label_widget.dart';import 'package:ente_auth/ui/scanner_page.dart';import 'package:ente_auth/ui/settings_page.dart';+import 'package:ente_auth/ui/tools/app_lock.dart';+// import 'package:ente_auth/ui/tools/lock_screen.dart';import 'package:ente_auth/utils/dialog_util.dart';import 'package:ente_auth/utils/platform_util.dart';import 'package:ente_auth/utils/totp_util.dart';@@ -199,6 +204,28 @@ class _HomePageState extends State<HomePage> {}}+ Future<void> navigateToLockScreen() async {+ final bool shouldShowLockScreen =+ await Configuration.instance.shouldShowLockScreen();+ if (shouldShowLockScreen) {+ await AppLock.of(context)!.showLockScreen();+ } else {+ await showDialogWidget(+ context: context,+ title: "No app lock enabled",+ body: "Please enable app lock from Security > App Lock",+ isDismissible: true,+ buttons: const [+ ButtonWidget(+ buttonType: ButtonType.secondary,+ labelText: "OK",+ isInAlert: true,+ ),+ ],+ );+ }+ }+@overrideWidget build(BuildContext context) {final l10n = context.l10n;@@ -279,6 +306,15 @@ class _HomePageState extends State<HomePage> {);},),+ PlatformUtil.isDesktop()+ ? IconButton(+ icon: const Icon(Icons.lock),+ tooltip: l10n.appLock,+ onPressed: () async {+ await navigateToLockScreen();+ },+ )+ : const SizedBox.shrink(),],),floatingActionButton: !_hasLoaded ||diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart b/auth/lib/ui/settings/lock_screen/lock_screen_options.dartindex b055a94f1d..9f53f10248 100644--- a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart+++ b/auth/lib/ui/settings/lock_screen/lock_screen_options.dart@@ -5,9 +5,12 @@ import "package:ente_auth/core/configuration.dart";import "package:ente_auth/l10n/l10n.dart";import "package:ente_auth/services/local_authentication_service.dart";import "package:ente_auth/theme/ente_theme.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/dialog_widget.dart";import "package:ente_auth/ui/components/divider_widget.dart";import "package:ente_auth/ui/components/menu_item_widget.dart";+import "package:ente_auth/ui/components/models/button_type.dart";import "package:ente_auth/ui/components/title_bar_title_widget.dart";import "package:ente_auth/ui/components/title_bar_widget.dart";import "package:ente_auth/ui/components/toggle_switch_widget.dart";@@ -15,7 +18,6 @@ import "package:ente_auth/ui/settings/lock_screen/lock_screen_auto_lock.dart";import "package:ente_auth/ui/settings/lock_screen/lock_screen_password.dart";import "package:ente_auth/ui/settings/lock_screen/lock_screen_pin.dart";import "package:ente_auth/ui/tools/app_lock.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";@@ -67,10 +69,18 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {await _lockscreenSetting.removePinAndPassword();await _configuration.setSystemLockScreen(!isSystemLockEnabled);} else {- await showErrorDialog(- context,- context.l10n.noSystemLockFound,- context.l10n.deviceLockEnablePreSteps,+ await showDialogWidget(+ context: context,+ title: context.l10n.noSystemLockFound,+ body: context.l10n.deviceLockEnablePreSteps,+ isDismissible: true,+ buttons: const [+ ButtonWidget(+ buttonType: ButtonType.secondary,+ labelText: "OK",+ isInAlert: true,+ ),+ ],);}await _initializeSettings();