π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Removed App lock subtitle in Settings
Aman Raj Singh Mouryaab9c097a32eb
diff --git a/mobile/lib/events/app_lock_update_event.dart b/mobile/lib/events/app_lock_update_event.dartdeleted file mode 100644index 48383344fa..0000000000--- a/mobile/lib/events/app_lock_update_event.dart+++ /dev/null@@ -1,14 +0,0 @@-import "package:photos/events/event.dart";--enum AppLockUpdateType {- none,- device,- pin,- password,-}--class AppLockUpdateEvent extends Event {- final AppLockUpdateType type;-- AppLockUpdateEvent(this.type);-}diff --git a/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_options.dartindex 0084c263ef..755b64932d 100644--- a/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart@@ -1,7 +1,5 @@import "package:flutter/material.dart";import "package:photos/core/configuration.dart";-import "package:photos/core/event_bus.dart";-import "package:photos/events/app_lock_update_event.dart";import "package:photos/generated/l10n.dart";import "package:photos/theme/ente_theme.dart";import "package:photos/ui/components/captioned_text_widget.dart";@@ -53,12 +51,6 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {Future<void> _deviceLock() async {await _lockscreenSetting.removePinAndPassword();await _initializeSettings();- await _lockscreenSetting.setAppLockType(AppLockUpdateType.device);- Bus.instance.fire(- AppLockUpdateEvent(- AppLockUpdateType.device,- ),- );}Future<void> _pinLock() async {@@ -72,12 +64,6 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {setState(() {_initializeSettings();if (result) {- Bus.instance.fire(- AppLockUpdateEvent(- AppLockUpdateType.pin,- ),- );- _lockscreenSetting.setAppLockType(AppLockUpdateType.pin);appLock = isPinEnabled ||isPasswordEnabled ||_configuration.shouldShowSystemLockScreen();@@ -96,12 +82,6 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {setState(() {_initializeSettings();if (result) {- Bus.instance.fire(- AppLockUpdateEvent(- AppLockUpdateType.password,- ),- );- _lockscreenSetting.setAppLockType(AppLockUpdateType.password);appLock = isPinEnabled ||isPasswordEnabled ||_configuration.shouldShowSystemLockScreen();@@ -124,14 +104,6 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {AppLock.of(context)!.setEnabled(!appLock);await _configuration.setSystemLockScreen(!appLock);await _lockscreenSetting.removePinAndPassword();- await _lockscreenSetting.setAppLockType(- appLock ? AppLockUpdateType.none : AppLockUpdateType.device,- );- Bus.instance.fire(- AppLockUpdateEvent(- appLock ? AppLockUpdateType.none : AppLockUpdateType.device,- ),- );setState(() {_initializeSettings();appLock = !appLock;@@ -150,6 +122,16 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {}}+ String _getAppLockType() {+ if (isPinEnabled) {+ return "Pin";+ } else if (isPasswordEnabled) {+ return "Password";+ } else {+ return "Device lock";+ }+ }+@overrideWidget build(BuildContext context) {final colorTheme = getEnteColorScheme(context);@@ -287,7 +269,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {right: 12,),child: Text(- "Require ${_lockscreenSetting.getAppLockType()} if away for some time .",+ "Require ${_getAppLockType()} if away for some time .",style: textTheme.miniFaint,textAlign: TextAlign.left,),diff --git a/mobile/lib/ui/settings/security_section_widget.dart b/mobile/lib/ui/settings/security_section_widget.dartindex dc8a5cac62..4e51799a1a 100644--- a/mobile/lib/ui/settings/security_section_widget.dart+++ b/mobile/lib/ui/settings/security_section_widget.dart@@ -7,7 +7,6 @@ import "package:logging/logging.dart";import 'package:photos/core/configuration.dart';import 'package:photos/core/event_bus.dart';import 'package:photos/ente_theme_data.dart';-import "package:photos/events/app_lock_update_event.dart";import 'package:photos/events/two_factor_status_change_event.dart';import "package:photos/generated/l10n.dart";import "package:photos/l10n/l10n.dart";@@ -27,7 +26,6 @@ import "package:photos/ui/settings/lock_screen/lock_screen_options.dart";import "package:photos/utils/auth_util.dart";import "package:photos/utils/crypto_util.dart";import "package:photos/utils/dialog_util.dart";-import "package:photos/utils/lock_screen_settings.dart";import "package:photos/utils/navigation_util.dart";import "package:photos/utils/toast_util.dart";@@ -40,23 +38,12 @@ class SecuritySectionWidget extends StatefulWidget {class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {final _config = Configuration.instance;- late String appLockSubtitle;late StreamSubscription<TwoFactorStatusChangeEvent>_twoFactorStatusChangeEvent;- late StreamSubscription<AppLockUpdateEvent> _appLockUpdateEventSubscription;final Logger _logger = Logger('SecuritySectionWidget');@overridevoid initState() {super.initState();- appLockSubtitle = LockScreenSettings.instance.getAppLockType();- _appLockUpdateEventSubscription =- Bus.instance.on<AppLockUpdateEvent>().listen((event) {- if (mounted) {- setState(() {- appLockSubtitle = LockScreenSettings.instance.getAppLockType();- });- }- });_twoFactorStatusChangeEvent =Bus.instance.on<TwoFactorStatusChangeEvent>().listen((event) async {if (mounted) {@@ -67,7 +54,6 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {@overridevoid dispose() {- _appLockUpdateEventSubscription.cancel();_twoFactorStatusChangeEvent.cancel();super.dispose();}@@ -156,7 +142,6 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {MenuItemWidget(captionedTextWidget: CaptionedTextWidget(title: S.of(context).appLock,- subTitle: appLockSubtitle,),trailingIcon: Icons.chevron_right_outlined,trailingIconIsMuted: true,diff --git a/mobile/lib/utils/lock_screen_settings.dart b/mobile/lib/utils/lock_screen_settings.dartindex e975321d7f..db3524a894 100644--- a/mobile/lib/utils/lock_screen_settings.dart+++ b/mobile/lib/utils/lock_screen_settings.dart@@ -3,7 +3,6 @@ import "dart:convert";import "package:flutter/foundation.dart";import "package:flutter_secure_storage/flutter_secure_storage.dart";import "package:flutter_sodium/flutter_sodium.dart";-import "package:photos/events/app_lock_update_event.dart";import "package:photos/utils/crypto_util.dart";import "package:shared_preferences/shared_preferences.dart";@@ -18,7 +17,7 @@ class LockScreenSettings {static const keyInvalidAttempts = "ls_invalid_attempts";static const lastInvalidAttemptTime = "ls_last_invalid_attempt_time";static const autoLockTime = "ls_auto_lock_time";- static const appLockType = "ls_app_lock_type";+late FlutterSecureStorage _secureStorage;late SharedPreferences _preferences;static const List<Duration> autoLockDurations = [@@ -35,26 +34,6 @@ class LockScreenSettings {_preferences = prefs;}- Future<void> setAppLockType(AppLockUpdateType lockType) async {- switch (lockType) {- case AppLockUpdateType.device:- await _preferences.setString(appLockType, "Device lock");- break;- case AppLockUpdateType.pin:- await _preferences.setString(appLockType, "Pin");- break;- case AppLockUpdateType.password:- await _preferences.setString(appLockType, "Password");- default:- await _preferences.setString(appLockType, "None");- break;- }- }-- String getAppLockType() {- return _preferences.getString(appLockType) ?? "None";- }-Future<void> setAutoLockTime(Duration duration) async {await _preferences.setInt(autoLockTime, duration.inMilliseconds);}