π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][auth] Auto lock duration added to the app_lock file
Aman Raj Singh Mouryad06586eb1c62
diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart b/auth/lib/ui/settings/lock_screen/lock_screen_options.dartindex 27c3b1f513..18a967b515 100644--- a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart+++ b/auth/lib/ui/settings/lock_screen/lock_screen_options.dart@@ -29,10 +29,15 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {late bool appLock;bool isPinEnabled = false;bool isPasswordEnabled = false;-+ late String autoLockTime;@overridevoid initState() {super.initState();+ autoLockTime = _formatTime(+ Duration(+ milliseconds: _lockscreenSetting.getAutoLockTime(),+ ),+ );_initializeSettings();appLock = isPinEnabled ||isPasswordEnabled ||@@ -100,7 +105,20 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {}Future<void> _onAutoLock() async {- routeToPage(context, LockScreenAutoLock());+ await routeToPage(+ context,+ const LockScreenAutoLock(),+ ).then(+ (value) {+ setState(() {+ autoLockTime = _formatTime(+ Duration(+ milliseconds: _lockscreenSetting.getAutoLockTime(),+ ),+ );+ });+ },+ );}String _formatTime(Duration duration) {@@ -226,6 +244,19 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {trailingIconColor: colorTheme.textBase,onTap: () => _passwordLock(),),+ const SizedBox(+ height: 24,+ ),+ MenuItemWidget(+ captionedTextWidget: CaptionedTextWidget(+ title: "Auto-lock",+ subTitle: autoLockTime,+ ),+ singleBorderRadius: 8,+ alignCaptionedTextToLeft: true,+ menuItemColor: colorTheme.fillFaint,+ onTap: () => _onAutoLock(),+ ),],): Container(),diff --git a/auth/lib/ui/tools/app_lock.dart b/auth/lib/ui/tools/app_lock.dartindex df55f81164..b4bad2d1ff 100644--- a/auth/lib/ui/tools/app_lock.dart+++ b/auth/lib/ui/tools/app_lock.dart@@ -1,6 +1,7 @@import 'dart:async';import 'package:ente_auth/locale.dart';+import 'package:ente_auth/utils/lock_screen_settings.dart';import 'package:flutter/material.dart';import 'package:flutter_gen/gen_l10n/app_localizations.dart';@@ -83,8 +84,12 @@ class _AppLockState extends State<AppLock> with WidgetsBindingObserver {if (state == AppLifecycleState.paused &&(!this._isLocked && this._didUnlockForAppLaunch)) {- this._backgroundLockLatencyTimer =- Timer(this.widget.backgroundLockLatency, () => this.showLockScreen());+ this._backgroundLockLatencyTimer = Timer(+ Duration(+ milliseconds: LockScreenSettings.instance.getAutoLockTime(),+ ),+ () => this.showLockScreen(),+ );}if (state == AppLifecycleState.resumed) {