Skip to content

armgit / ente

Public Imported from GitHub
0

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

Check if isDeviceSupported for lockscreen

AmanRajSinghMouryad65088674915
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<SecuritySectionWidget> {
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<SecuritySectionWidget> {
);
}
} 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<bool> isDeviceSupported() async{
+ return await LocalAuthentication().isDeviceSupported();
+ }
}