π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
lock option screen added
Aman Raj Singh Mourya5b89ef972f0f
diff --git a/mobile/lib/generated/l10n.dart b/mobile/lib/generated/l10n.dartindex 00a00e4c2a..7060b5a2ac 100644--- a/mobile/lib/generated/l10n.dart+++ b/mobile/lib/generated/l10n.dart@@ -60,6 +60,56 @@ class S {);}+ /// `Device Lock`+ String get deviceLock {+ return Intl.message(+ 'Device lock',+ name: 'deviceLock',+ desc: '',+ args: [],+ );+ }++ /// `PIN Lock`+ String get pinLock {+ return Intl.message(+ 'PIN lock',+ name: 'pinLock',+ desc: '',+ args: [],+ );+ }++ /// `Enter the pin to lock the app`+ String get enterThePinToLockTheApp {+ return Intl.message(+ 'Enter the pin to lock the app',+ name: 'enterThePinToLockTheApp',+ desc: '',+ args: [],+ );+ }++ /// `When a pin is set , you need to enter password\n whenever you open the app .`+ String get whenPinIsSetYouNeedToEnterPassword {+ return Intl.message(+ 'When a pin is set , you need to enter password\n whenever you open the app .',+ name: 'whenPinIsSetYouNeedToEnterPassword',+ desc: '',+ args: [],+ );+ }++ /// `Enable PIN`+ String get enablePin {+ return Intl.message(+ 'Enable PIN',+ name: 'enablePin',+ desc: '',+ args: [],+ );+ }+/// `Welcome back!`String get accountWelcomeBack {return Intl.message(diff --git a/mobile/lib/services/local_authentication_service.dart b/mobile/lib/services/local_authentication_service.dartindex 4260977f62..7531088d92 100644--- a/mobile/lib/services/local_authentication_service.dart+++ b/mobile/lib/services/local_authentication_service.dart@@ -3,6 +3,7 @@ import "dart:async";import 'package:flutter/material.dart';import 'package:local_auth/local_auth.dart';import 'package:photos/core/configuration.dart';+import "package:photos/ui/settings/TEMP/lock_screen_option.dart";import 'package:photos/ui/tools/app_lock.dart';import 'package:photos/utils/auth_util.dart';import 'package:photos/utils/dialog_util.dart';@@ -50,6 +51,15 @@ class LocalAuthenticationService {AppLock.of(context)!.setEnabled(shouldEnableLockScreen);await Configuration.instance.setShouldShowLockScreen(shouldEnableLockScreen);+ if (shouldEnableLockScreen) {+ await Navigator.of(context).push(+ MaterialPageRoute(+ builder: (BuildContext context) {+ return const LockScreenOption();+ },+ ),+ );+ }return true;} else {AppLock.of(context)!diff --git a/mobile/lib/ui/settings/TEMP/lock_screen_option.dart b/mobile/lib/ui/settings/TEMP/lock_screen_option.dartnew file mode 100644index 0000000000..7eb9f698c4--- /dev/null+++ b/mobile/lib/ui/settings/TEMP/lock_screen_option.dart@@ -0,0 +1,115 @@+import "package:flutter/material.dart";+import "package:photos/generated/l10n.dart";+import "package:photos/theme/ente_theme.dart";+import "package:photos/ui/components/captioned_text_widget.dart";+import "package:photos/ui/components/divider_widget.dart";+import "package:photos/ui/components/menu_item_widget/menu_item_widget.dart";+import "package:photos/ui/components/title_bar_title_widget.dart";+import "package:photos/ui/components/title_bar_widget.dart";+import "package:photos/ui/settings/TEMP/lock_screen_option_pin.dart";++class LockScreenOption extends StatelessWidget {+ const LockScreenOption({super.key});++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ return Scaffold(+ body: CustomScrollView(+ primary: false,+ slivers: <Widget>[+ TitleBarWidget(+ flexibleSpaceTitle: TitleBarTitleWidget(+ title: S.of(context).lockscreen,+ ),+ ),+ SliverList(+ delegate: SliverChildBuilderDelegate(+ (context, index) {+ return Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: Padding(+ padding: const EdgeInsets.symmetric(vertical: 20),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Column(+ children: [+ MenuItemWidget(+ captionedTextWidget: CaptionedTextWidget(+ title: S.of(context).noDeviceLimit,+ ),+ alignCaptionedTextToLeft: true,+ isTopBorderRadiusRemoved: false,+ isBottomBorderRadiusRemoved: true,+ menuItemColor: colorScheme.fillFaint,+ trailingIconIsMuted: true,+ trailingIcon: Icons.chevron_right_outlined,+ ),+ DividerWidget(+ dividerType: DividerType.menuNoIcon,+ bgColor: colorScheme.fillFaint,+ ),+ MenuItemWidget(+ captionedTextWidget: CaptionedTextWidget(+ title: S.of(context).deviceLock,+ ),+ alignCaptionedTextToLeft: true,+ isTopBorderRadiusRemoved: true,+ isBottomBorderRadiusRemoved: true,+ menuItemColor: colorScheme.fillFaint,+ trailingIconIsMuted: true,+ trailingIcon: Icons.chevron_right_outlined,+ ),+ DividerWidget(+ dividerType: DividerType.menuNoIcon,+ bgColor: colorScheme.fillFaint,+ ),+ MenuItemWidget(+ captionedTextWidget: CaptionedTextWidget(+ title: S.of(context).pinLock,+ ),+ alignCaptionedTextToLeft: true,+ isTopBorderRadiusRemoved: true,+ isBottomBorderRadiusRemoved: true,+ menuItemColor: colorScheme.fillFaint,+ trailingIconIsMuted: true,+ trailingIcon: Icons.chevron_right_outlined,+ onTap: () => Navigator.of(context).push(+ MaterialPageRoute(+ builder: (BuildContext context) {+ return const LockScreenOptionPin();+ },+ ),+ ),+ ),+ DividerWidget(+ dividerType: DividerType.menuNoIcon,+ bgColor: colorScheme.fillFaint,+ ),+ MenuItemWidget(+ captionedTextWidget: CaptionedTextWidget(+ title: S.of(context).passwordLock,+ ),+ alignCaptionedTextToLeft: true,+ isTopBorderRadiusRemoved: true,+ isBottomBorderRadiusRemoved: false,+ menuItemColor: colorScheme.fillFaint,+ trailingIconIsMuted: true,+ trailingIcon: Icons.chevron_right_outlined,+ ),+ ],+ ),+ ],+ ),+ ),+ );+ },+ childCount: 1,+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/mobile/lib/ui/settings/TEMP/lock_screen_option_pin.dart b/mobile/lib/ui/settings/TEMP/lock_screen_option_pin.dartnew file mode 100644index 0000000000..81334e9348--- /dev/null+++ b/mobile/lib/ui/settings/TEMP/lock_screen_option_pin.dart@@ -0,0 +1,200 @@+import "package:flutter/material.dart";+import "package:photos/generated/l10n.dart";+import "package:photos/theme/ente_theme.dart";+import "package:photos/ui/components/buttons/button_widget.dart";+import "package:photos/ui/components/buttons/icon_button_widget.dart";+import "package:photos/ui/components/models/button_type.dart";++class LockScreenOptionPin extends StatelessWidget {+ const LockScreenOptionPin({super.key});+ @override+ Widget build(BuildContext context) {+ final ValueNotifier<bool> isPinEnabled = ValueNotifier<bool>(false);+ final colorTheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ return Scaffold(+ body: SafeArea(+ child: Center(+ child: Column(+ mainAxisAlignment: MainAxisAlignment.center,+ crossAxisAlignment: CrossAxisAlignment.center,+ children: [+ Container(+ height: 80,+ width: 80,+ child: IconButtonWidget(+ icon: Icons.lock_outline,+ iconButtonType: IconButtonType.primary,+ iconColor: colorTheme.tabIcon,+ onTap: () {},+ ),+ ),+ Text(+ S.of(context).enterThePinToLockTheApp,+ style: textTheme.bodyBold,+ ),+ if (isPinEnabled.value == false)+ Padding(+ padding:+ const EdgeInsets.symmetric(horizontal: 16, vertical: 8),+ child: Text(+ textAlign: TextAlign.center,+ S.of(context).whenPinIsSetYouNeedToEnterPassword,+ style: textTheme.smallFaint,+ ),+ ),+ // ValueListenableBuilder(+ // valueListenable: isPinEnabled,+ // builder: (context, value, _) {+ // return Padding(+ // padding: const EdgeInsets.all(16.0),+ // child: isPinEnabled.value+ // ? ButtonWidget(+ // labelText: S.of(context).enablePin,+ // buttonType: ButtonType.neutral,+ // buttonSize: ButtonSize.large,+ // shouldStickToDarkTheme: true,+ // isInAlert: true,+ // )+ // : ButtonWidget(+ // labelText: S.of(context).yes,+ // buttonType: ButtonType.neutral,+ // buttonSize: ButtonSize.large,+ // shouldStickToDarkTheme: true,+ // isInAlert: true,+ // ),+ // );+ // },+ // ),+ Padding(+ padding: const EdgeInsets.all(16.0),+ child: isPinEnabled.value+ ? ButtonWidget(+ labelText: S.of(context).enablePin,+ buttonType: ButtonType.neutral,+ buttonSize: ButtonSize.large,+ shouldStickToDarkTheme: true,+ isInAlert: true,+ )+ : ButtonWidget(+ labelText: S.of(context).yes,+ buttonType: ButtonType.neutral,+ buttonSize: ButtonSize.large,+ shouldStickToDarkTheme: true,+ isInAlert: true,+ ),+ ),+ ],+ ),+ ),+ ),+ );+ }+}+// import 'package:flutter/material.dart';+// import 'package:photos/generated/l10n.dart';+// import 'package:photos/theme/ente_theme.dart';+// import 'package:photos/ui/components/buttons/button_widget.dart';+// import 'package:photos/ui/components/buttons/icon_button_widget.dart';+// import 'package:photos/ui/components/models/button_type.dart';++// class LockScreenOptionPin extends StatelessWidget {+// final ValueNotifier<bool> isPinEnabled = ValueNotifier<bool>(false);++// @override+// Widget build(BuildContext context) {+// final colorTheme = getEnteColorScheme(context);+// final textTheme = getEnteTextTheme(context);++// return Scaffold(+// body: SafeArea(+// child: Center(+// child: ValueListenableBuilder<bool>(+// valueListenable: isPinEnabled,+// builder: (context, isPinEnabled, _) {+// return Column(+// mainAxisAlignment: MainAxisAlignment.center,+// crossAxisAlignment: CrossAxisAlignment.center,+// children: [+// SizedBox(+// height: 80,+// width: 80,+// child: IconButtonWidget(+// icon: Icons.lock_outline,+// iconButtonType: IconButtonType.primary,+// iconColor: colorTheme.tabIcon,+// onTap: () {},+// ),+// ),+// Text(+// isPinEnabled+// ? S.of(context).enterThePinToLockTheApp+// : S.of(context).enterThePinToLockTheApp,+// style: textTheme.bodyBold,+// ),+// if(isPinEnabled == false)++// Padding(+// padding: const EdgeInsets.symmetric(+// horizontal: 16,+// vertical: 8,+// ),+// child: Text(+// S.of(context).whenPinIsSetYouNeedToEnterPassword,+// textAlign: TextAlign.center,+// style: textTheme.smallFaint,+// ),+// ),+// if (!isPinEnabled)+// Padding(+// padding: const EdgeInsets.all(16.0),+// child: ButtonWidget(+// labelText: S.of(context).enablePin,+// buttonType: ButtonType.neutral,+// buttonSize: ButtonSize.large,+// shouldStickToDarkTheme: true,+// isInAlert: true,+// onTap: () {+// isPinEnabled.value = true;+// return Future<void>.value();+// },+// ),+// ),+// if (isPinEnabled)+// Padding(+// padding: const EdgeInsets.all(16.0),+// child: Column(+// children: [+// Row(+// mainAxisAlignment: MainAxisAlignment.spaceEvenly,+// children: List.generate(4, (index) {+// return Container(+// width: 50,+// height: 50,+// decoration: BoxDecoration(+// border: Border.all(color: colorTheme.tabIcon),+// borderRadius: BorderRadius.circular(8),+// ),+// );+// }),+// ),+// const SizedBox(height: 20),+// ButtonWidget(+// labelText: S.of(context).yes,+// buttonType: ButtonType.neutral,+// buttonSize: ButtonSize.large,+// shouldStickToDarkTheme: true,+// isInAlert: true,+// ),+// ],+// ),+// ),+// ],+// );+// },+// ),+// ),+// ),+// );+// }+// }diff --git a/mobile/lib/ui/settings/security_section_widget.dart b/mobile/lib/ui/settings/security_section_widget.dartindex eb93d85f62..bad5306942 100644--- a/mobile/lib/ui/settings/security_section_widget.dart+++ b/mobile/lib/ui/settings/security_section_widget.dart@@ -153,6 +153,8 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {S.of(context).authToChangeLockscreenSetting,S.of(context).lockScreenEnablePreSteps,);++ ///try here also once about the material page route},),),