Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][auth] Removed app lock subtitle from the setting_section_widget

Aman Raj Singh Mouryae0beb414f9c7
diff --git a/auth/lib/events/app_lock_update_event.dart b/auth/lib/events/app_lock_update_event.dart
deleted file mode 100644
index 3c83cde08b..0000000000
--- a/auth/lib/events/app_lock_update_event.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-import "package:ente_auth/events/event.dart";
-
-enum AppLockUpdateType {
- none,
- device,
- pin,
- password,
-}
-
-class AppLockUpdateEvent extends Event {
- final AppLockUpdateType type;
-
- AppLockUpdateEvent(this.type);
-}
diff --git a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart b/auth/lib/ui/settings/lock_screen/lock_screen_options.dart
index e0ec3dd63e..685cc384db 100644
--- a/auth/lib/ui/settings/lock_screen/lock_screen_options.dart
+++ b/auth/lib/ui/settings/lock_screen/lock_screen_options.dart
@@ -1,8 +1,6 @@
import "dart:async";
import "package:ente_auth/core/configuration.dart";
-import "package:ente_auth/core/event_bus.dart";
-import "package:ente_auth/events/app_lock_update_event.dart";
import "package:ente_auth/theme/ente_theme.dart";
import "package:ente_auth/ui/components/captioned_text_widget.dart";
import "package:ente_auth/ui/components/divider_widget.dart";
@@ -18,7 +16,6 @@ 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:flutter/material.dart";
-import "package:flutter/widgets.dart";
class LockScreenOptions extends StatefulWidget {
const LockScreenOptions({super.key});
@@ -62,12 +59,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 {
@@ -81,12 +72,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();
@@ -105,12 +90,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();
@@ -125,14 +104,6 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
if (appLock == true) {
await _lockscreenSetting.shouldShowAppContent(showAppContent: true);
}
- await _lockscreenSetting.setAppLockType(
- appLock ? AppLockUpdateType.none : AppLockUpdateType.device,
- );
- Bus.instance.fire(
- AppLockUpdateEvent(
- appLock ? AppLockUpdateType.none : AppLockUpdateType.device,
- ),
- );
setState(() {
_initializeSettings();
appLock = !appLock;
diff --git a/auth/lib/ui/settings/security_section_widget.dart b/auth/lib/ui/settings/security_section_widget.dart
index af45dab4b0..8fa3249bf5 100644
--- a/auth/lib/ui/settings/security_section_widget.dart
+++ b/auth/lib/ui/settings/security_section_widget.dart
@@ -2,8 +2,6 @@ import 'dart:async';
import 'dart:typed_data';
import 'package:ente_auth/core/configuration.dart';
-import 'package:ente_auth/core/event_bus.dart';
-import 'package:ente_auth/events/app_lock_update_event.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/user_details.dart';
import 'package:ente_auth/services/local_authentication_service.dart';
@@ -20,7 +18,6 @@ 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';
@@ -40,25 +37,15 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
final _config = Configuration.instance;
late bool _hasLoggedIn;
final Logger _logger = Logger('SecuritySectionWidget');
- late String appLockSubtitle;
- late StreamSubscription<AppLockUpdateEvent> _appLockUpdateEvent;
+
@override
void initState() {
_hasLoggedIn = _config.hasConfiguredAccount();
- appLockSubtitle = LockScreenSettings.instance.getAppLockType();
- _appLockUpdateEvent = Bus.instance.on<AppLockUpdateEvent>().listen((event) {
- if (mounted) {
- setState(() {
- appLockSubtitle = LockScreenSettings.instance.getAppLockType();
- });
- }
- });
super.initState();
}
@override
void dispose() {
- _appLockUpdateEvent.cancel();
super.dispose();
}
@@ -150,9 +137,8 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
}
children.addAll([
MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
+ captionedTextWidget: const CaptionedTextWidget(
title: "App lock",
- subTitle: appLockSubtitle,
),
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
diff --git a/auth/lib/utils/lock_screen_settings.dart b/auth/lib/utils/lock_screen_settings.dart
index 071887c0b6..2f0e464288 100644
--- a/auth/lib/utils/lock_screen_settings.dart
+++ b/auth/lib/utils/lock_screen_settings.dart
@@ -1,8 +1,6 @@
import "dart:convert";
import "dart:typed_data";
-import "dart:ui";
-import "package:ente_auth/events/app_lock_update_event.dart";
import "package:ente_crypto_dart/ente_crypto_dart.dart";
import "package:flutter/material.dart";
import "package:flutter/scheduler.dart";
@@ -21,7 +19,6 @@ 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";
static const keyShowAppContent = "ls_show_app_content";
final List<Duration> autoLockDurations = const [
Duration(seconds: 0),
@@ -63,27 +60,6 @@ class LockScreenSettings {
return _preferences.getBool(keyShowAppContent) ?? true;
}
- 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");
- break;
- 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);
}