Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] show error dialog on no device lock enabled

Aman Raj Singh Mourya39a3a48fd309
diff --git a/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart b/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
index a274944996..fc21c252d6 100644
--- a/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
+++ b/mobile/lib/ui/settings/lock_screen/lock_screen_options.dart
@@ -125,14 +125,27 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
title: 'App lock',
),
alignCaptionedTextToLeft: true,
- isTopBorderRadiusRemoved: false,
- isBottomBorderRadiusRemoved: false,
+ singleBorderRadius: 8,
menuItemColor: colorTheme.fillFaint,
trailingWidget: ToggleSwitchWidget(
value: () => appLock,
onChanged: () => _onToggleSwitch(),
),
),
+ !appLock
+ ? Padding(
+ padding: const EdgeInsets.only(
+ top: 14,
+ left: 14,
+ right: 12,
+ ),
+ child: Text(
+ 'Choose between your device\'s default lock screen and a custom lock screen with a PIN or password.',
+ style: textTheme.miniFaint,
+ textAlign: TextAlign.left,
+ ),
+ )
+ : const SizedBox(),
const Padding(
padding: EdgeInsets.only(top: 24),
),
@@ -195,17 +208,7 @@ class _LockScreenOptionsState extends State<LockScreenOptions> {
),
],
)
- : Padding(
- padding: const EdgeInsets.only(
- left: 14,
- right: 12,
- ),
- child: Text(
- 'Choose between your device\'s default lock screen and a custom lock screen with a PIN or password.',
- style: textTheme.miniFaint,
- textAlign: TextAlign.left,
- ),
- ),
+ : Container(),
],
),
),
diff --git a/mobile/lib/ui/settings/security_section_widget.dart b/mobile/lib/ui/settings/security_section_widget.dart
index 490dacb3fc..61d302b6a5 100644
--- a/mobile/lib/ui/settings/security_section_widget.dart
+++ b/mobile/lib/ui/settings/security_section_widget.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import "dart:typed_data";
import 'package:flutter/material.dart';
+import "package:local_auth/local_auth.dart";
import "package:logging/logging.dart";
import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
@@ -146,17 +147,25 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
- final bool result = await requestAuthentication(
- context,
- S.of(context).authToChangeLockscreenSetting,
- );
- if (result) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (BuildContext context) {
- return const LockScreenOptions();
- },
- ),
+ if (await LocalAuthentication().isDeviceSupported()) {
+ final bool result = await requestAuthentication(
+ context,
+ S.of(context).authToChangeLockscreenSetting,
+ );
+ if (result) {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return const LockScreenOptions();
+ },
+ ),
+ );
+ }
+ } else {
+ await showErrorDialog(
+ context,
+ "",
+ "To enable app lock, please setup device passcode or screen lock in your system settings.",
);
}
},