From a73d5548a031872d9a74229e2beb7d5cf5d9cde8 Mon Sep 17 00:00:00 2001 From: AmanRajSinghMourya Date: Thu, 4 Sep 2025 15:58:17 +0530 Subject: [PATCH 1/4] Fix: local_auth requires the use of a FragmentActivity instead of an Activity --- .../app/src/main/kotlin/io/ente/locker/MainActivity.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mobile/apps/locker/android/app/src/main/kotlin/io/ente/locker/MainActivity.kt b/mobile/apps/locker/android/app/src/main/kotlin/io/ente/locker/MainActivity.kt index 8cf01b258d..11a477bc8f 100644 --- a/mobile/apps/locker/android/app/src/main/kotlin/io/ente/locker/MainActivity.kt +++ b/mobile/apps/locker/android/app/src/main/kotlin/io/ente/locker/MainActivity.kt @@ -1,5 +1,6 @@ package io.ente.locker -import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.android.FlutterFragmentActivity -class MainActivity: FlutterActivity() +class MainActivity: FlutterFragmentActivity() { +} From d6508867491582187126059d53e8b785c2b85b8a Mon Sep 17 00:00:00 2001 From: AmanRajSinghMourya Date: Thu, 4 Sep 2025 15:58:49 +0530 Subject: [PATCH 2/4] Check if isDeviceSupported for lockscreen --- .../lib/ui/settings/security_section_widget.dart | 16 +++++++--------- .../lock_screen/lib/lock_screen_settings.dart | 5 +++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mobile/apps/locker/lib/ui/settings/security_section_widget.dart b/mobile/apps/locker/lib/ui/settings/security_section_widget.dart index 6d25cb3004..8831bffe82 100644 --- a/mobile/apps/locker/lib/ui/settings/security_section_widget.dart +++ b/mobile/apps/locker/lib/ui/settings/security_section_widget.dart @@ -13,7 +13,7 @@ import "package:ente_lock_screen/ui/lock_screen_options.dart"; import "package:ente_ui/components/captioned_text_widget.dart"; import "package:ente_ui/components/menu_item_widget.dart"; import "package:ente_ui/components/toggle_switch_widget.dart"; -import "package:ente_ui/theme/ente_theme.dart"; +import "package:ente_ui/theme/ente_theme.dart"; import "package:ente_ui/utils/dialog_util.dart"; import "package:ente_ui/utils/toast_util.dart"; import "package:ente_utils/navigation_util.dart"; @@ -122,7 +122,7 @@ class _SecuritySectionWidgetState extends State { trailingIcon: Icons.chevron_right_outlined, trailingIconIsMuted: true, onTap: () async { - if (await LockScreenSettings.instance.shouldShowLockScreen()) { + if (await LockScreenSettings.instance.isDeviceSupported()) { final bool result = await requestAuthentication( context, context.l10n.authToChangeLockscreenSetting, @@ -137,19 +137,17 @@ class _SecuritySectionWidgetState extends State { ); } } else { - await Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) { - return const LockScreenOptions(); - }, - ), + await showErrorDialog( + context, + context.l10n.noSystemLockFound, + context.l10n.toEnableAppLockPleaseSetupDevicePasscodeOrScreen, ); } }, ), sectionOptionSpacing, ]); - + return Column( children: children, ); diff --git a/mobile/packages/lock_screen/lib/lock_screen_settings.dart b/mobile/packages/lock_screen/lib/lock_screen_settings.dart index 33e230cfc0..dda7f90dbb 100644 --- a/mobile/packages/lock_screen/lib/lock_screen_settings.dart +++ b/mobile/packages/lock_screen/lib/lock_screen_settings.dart @@ -9,6 +9,7 @@ import "package:ente_events/models/signed_out_event.dart"; import "package:ente_utils/platform_util.dart"; import "package:flutter/material.dart"; import "package:flutter_secure_storage/flutter_secure_storage.dart"; +import "package:local_auth/local_auth.dart"; import "package:privacy_screen/privacy_screen.dart"; import "package:shared_preferences/shared_preferences.dart"; @@ -246,4 +247,8 @@ class LockScreenSettings { await _secureStorage.delete(key: saltKey); } } + + Future isDeviceSupported() async{ + return await LocalAuthentication().isDeviceSupported(); + } } From dcc36d2d35f6f72500b96c8407976890cc2a142e Mon Sep 17 00:00:00 2001 From: AmanRajSinghMourya Date: Thu, 4 Sep 2025 15:59:16 +0530 Subject: [PATCH 3/4] Extract strings --- mobile/apps/locker/lib/l10n/app_en.arb | 4 +++- mobile/apps/locker/lib/l10n/app_localizations.dart | 12 ++++++++++++ .../apps/locker/lib/l10n/app_localizations_en.dart | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arb index 4cb86d4026..97bc555e1f 100644 --- a/mobile/apps/locker/lib/l10n/app_en.arb +++ b/mobile/apps/locker/lib/l10n/app_en.arb @@ -502,5 +502,7 @@ }, "leaveCollection": "Leave collection", "filesAddedByYouWillBeRemovedFromTheCollection": "Files added by you will be removed from the collection", - "leaveSharedCollection": "Leave shared collection?" + "leaveSharedCollection": "Leave shared collection?", + "noSystemLockFound": "No system lock found", + "toEnableAppLockPleaseSetupDevicePasscodeOrScreen": "To enable app lock, please setup device passcode or screen lock in your system settings." } diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dart index 0dfaaefd87..98f165ad44 100644 --- a/mobile/apps/locker/lib/l10n/app_localizations.dart +++ b/mobile/apps/locker/lib/l10n/app_localizations.dart @@ -1575,6 +1575,18 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Leave shared collection?'** String get leaveSharedCollection; + + /// No description provided for @noSystemLockFound. + /// + /// In en, this message translates to: + /// **'No system lock found'** + String get noSystemLockFound; + + /// No description provided for @toEnableAppLockPleaseSetupDevicePasscodeOrScreen. + /// + /// In en, this message translates to: + /// **'To enable app lock, please setup device passcode or screen lock in your system settings.'** + String get toEnableAppLockPleaseSetupDevicePasscodeOrScreen; } class _AppLocalizationsDelegate diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dart index 58e7ab5bde..51842c3df3 100644 --- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart +++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart @@ -896,4 +896,11 @@ class AppLocalizationsEn extends AppLocalizations { @override String get leaveSharedCollection => 'Leave shared collection?'; + + @override + String get noSystemLockFound => 'No system lock found'; + + @override + String get toEnableAppLockPleaseSetupDevicePasscodeOrScreen => + 'To enable app lock, please setup device passcode or screen lock in your system settings.'; } From bcc2a30105a1852cf69d21bebf96ea57d9f12298 Mon Sep 17 00:00:00 2001 From: AmanRajSinghMourya Date: Thu, 4 Sep 2025 16:01:33 +0530 Subject: [PATCH 4/4] Add USE_BIOMETRIC permission to AndroidManifest.xml --- mobile/apps/locker/android/app/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/mobile/apps/locker/android/app/src/main/AndroidManifest.xml b/mobile/apps/locker/android/app/src/main/AndroidManifest.xml index e0f3bafb01..de20b5e259 100644 --- a/mobile/apps/locker/android/app/src/main/AndroidManifest.xml +++ b/mobile/apps/locker/android/app/src/main/AndroidManifest.xml @@ -54,4 +54,5 @@ +