π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][locker] Redesign settings UI
AmanRajSinghMourya60f8d85514a9
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arbindex f287726095..73b4c3e096 100644--- a/mobile/apps/locker/lib/l10n/app_en.arb+++ b/mobile/apps/locker/lib/l10n/app_en.arb@@ -348,16 +348,19 @@"authToChangeLockscreenSetting": "Please authenticate to change lockscreen setting","authToViewPasskey": "Please authenticate to view passkey","theme": "Theme",+ "appearance": "Appearance","lightTheme": "Light","darkTheme": "Dark","systemTheme": "System","settings": "Settings","about": "About",+ "aboutUs": "About us","weAreOpenSource": "We are open source!","privacy": "Privacy","terms": "Terms","termsOfServicesTitle": "Terms","support": "Support",+ "helpAndSupport": "Help and Support","contactSupport": "Contact support","help": "Help","suggestFeatures": "Suggest features",diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dartindex 0cef3b8d0b..a1a4d4298e 100644--- a/mobile/apps/locker/lib/l10n/app_localizations.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart@@ -952,6 +952,12 @@ abstract class AppLocalizations {/// **'Theme'**String get theme;+ /// No description provided for @appearance.+ ///+ /// In en, this message translates to:+ /// **'Appearance'**+ String get appearance;+/// No description provided for @lightTheme.////// In en, this message translates to:@@ -982,6 +988,12 @@ abstract class AppLocalizations {/// **'About'**String get about;+ /// No description provided for @aboutUs.+ ///+ /// In en, this message translates to:+ /// **'About us'**+ String get aboutUs;+/// No description provided for @weAreOpenSource.////// In en, this message translates to:@@ -1012,6 +1024,12 @@ abstract class AppLocalizations {/// **'Support'**String get support;+ /// No description provided for @helpAndSupport.+ ///+ /// In en, this message translates to:+ /// **'Help and Support'**+ String get helpAndSupport;+/// No description provided for @contactSupport.////// In en, this message translates to:diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dartindex 0e1d9a5218..c7949443b9 100644--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart@@ -505,6 +505,9 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get theme => 'Theme';+ @override+ String get appearance => 'Appearance';+@overrideString get lightTheme => 'Light';@@ -520,6 +523,9 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get about => 'About';+ @override+ String get aboutUs => 'About us';+@overrideString get weAreOpenSource => 'We are open source!';@@ -535,6 +541,9 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get support => 'Support';+ @override+ String get helpAndSupport => 'Help and Support';+@overrideString get contactSupport => 'Contact support';diff --git a/mobile/apps/locker/lib/ui/components/expandable_menu_item_widget.dart b/mobile/apps/locker/lib/ui/components/expandable_menu_item_widget.dartdeleted file mode 100644index 45c06f17e1..0000000000--- a/mobile/apps/locker/lib/ui/components/expandable_menu_item_widget.dart+++ /dev/null@@ -1,165 +0,0 @@-import "package:ente_ui/theme/ente_theme.dart";-import "package:expandable/expandable.dart";-import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:locker/ui/drawer/common_settings.dart";--class ExpandableChildItem extends StatelessWidget {- final String title;- final Color? textColor;- final IconData? trailingIcon;- final Color? trailingIconColor;- final VoidCallback? onTap;- final VoidCallback? onLongPress;-- const ExpandableChildItem({- required this.title,- this.textColor,- this.trailingIcon,- this.trailingIconColor,- this.onTap,- this.onLongPress,- super.key,- });-- @override- Widget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);-- return GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: onTap,- onLongPress: onLongPress,- child: SizedBox(- height: 60,- child: Row(- children: [- const SizedBox(width: 60),- const SizedBox(width: 4),- Expanded(- child: Text(- title,- style: textTheme.body.copyWith(- color: textColor,- ),- ),- ),- if (trailingIcon != null)- Padding(- padding: const EdgeInsets.only(right: 12.0),- child: Icon(- trailingIcon,- color: trailingIconColor ?? colorScheme.textMuted,- ),- ),- ],- ),- ),- );- }-}--class ExpandableMenuItemWidget extends StatefulWidget {- final String title;- final Widget selectionOptionsWidget;- final dynamic leadingIcon;- const ExpandableMenuItemWidget({- required this.title,- required this.selectionOptionsWidget,- required this.leadingIcon,- super.key,- });-- @override- State<ExpandableMenuItemWidget> createState() =>- _ExpandableMenuItemWidgetState();-}--class _ExpandableMenuItemWidgetState extends State<ExpandableMenuItemWidget> {- final expandableController = ExpandableController(initialExpanded: false);- @override- void initState() {- expandableController.addListener(() {- setState(() {});- });- super.initState();- }-- @override- void dispose() {- expandableController.removeListener(() {});- super.dispose();- }-- @override- Widget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);- final isExpanded = expandableController.expanded;-- return AnimatedContainer(- curve: Curves.ease,- duration: const Duration(milliseconds: 200),- decoration: BoxDecoration(- color: colorScheme.backdropBase,- borderRadius: BorderRadius.circular(20),- ),- child: ExpandableNotifier(- controller: expandableController,- child: ScrollOnExpand(- child: ExpandablePanel(- header: GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () => expandableController.toggle(),- child: Row(- children: [- SizedBox(- height: 60,- width: 60,- child: Padding(- padding: const EdgeInsets.all(10.0),- child: Container(- decoration: BoxDecoration(- color: colorScheme.fillFaint,- borderRadius: BorderRadius.circular(12),- ),- padding: const EdgeInsets.all(8.0),- child: HugeIcon(- icon: widget.leadingIcon,- color: colorScheme.strokeBase,- ),- ),- ),- ),- const SizedBox(width: 4),- Expanded(- child: Text(- widget.title,- style: textTheme.body,- ),- ),- Padding(- padding: const EdgeInsets.only(right: 12.0),- child: AnimatedRotation(- turns: isExpanded ? -0.25 : 0,- duration: const Duration(milliseconds: 200),- child: Icon(- Icons.chevron_right,- color: colorScheme.textMuted,- ),- ),- ),- ],- ),- ),- collapsed: const SizedBox.shrink(),- expanded: widget.selectionOptionsWidget,- theme: getExpandableTheme(),- controller: expandableController,- ),- ),- ),- );- }-}diff --git a/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart b/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dartindex 3dd54dacce..53eb24c2f2 100644--- a/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart+++ b/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart@@ -14,7 +14,7 @@ class LegacyCollectionsTrashWidget extends StatelessWidget {@overrideWidget build(BuildContext context) {return const Padding(- padding: EdgeInsets.symmetric(vertical: 16.0),+ padding: EdgeInsets.only(top: 16.0),child: Column(children: [_LegacyItem(),@@ -41,37 +41,36 @@ class _CollectionsItem extends StatelessWidget {final textTheme = getEnteTextTheme(context);final borderRadius = BorderRadius.circular(20);- return InkWell(+ return GestureDetector(+ behavior: HitTestBehavior.opaque,onTap: () => _openCollections(context),- borderRadius: borderRadius,child: Container(+ height: 56,decoration: BoxDecoration(color: colorScheme.backdropBase,borderRadius: borderRadius,),- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),+ padding: const EdgeInsets.all(8),child: Row(children: [- Container(- height: 40,+ SizedBox(width: 40,- decoration: BoxDecoration(- color: colorScheme.fillFaint,- borderRadius: BorderRadius.circular(12),- ),- padding: const EdgeInsets.all(8.0),- child: HugeIcon(- icon: HugeIcons.strokeRoundedWallet05,- color: colorScheme.strokeBase,+ height: 40,+ child: Center(+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedWallet05,+ color: colorScheme.strokeBase,+ size: 24,+ ),),),- const SizedBox(width: 12),+ const SizedBox(width: 8),Expanded(child: Text(context.l10n.collections,- style: textTheme.small,+ style: textTheme.body,overflow: TextOverflow.ellipsis,- maxLines: 2,+ maxLines: 1,),),],@@ -94,37 +93,36 @@ class _TrashItem extends StatelessWidget {final textTheme = getEnteTextTheme(context);final borderRadius = BorderRadius.circular(20);- return InkWell(+ return GestureDetector(+ behavior: HitTestBehavior.opaque,onTap: () => _openTrash(context),- borderRadius: borderRadius,child: Container(+ height: 56,decoration: BoxDecoration(color: colorScheme.backdropBase,borderRadius: borderRadius,),- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),+ padding: const EdgeInsets.all(8),child: Row(children: [- Container(- height: 40,+ SizedBox(width: 40,- decoration: BoxDecoration(- color: colorScheme.fillFaint,- borderRadius: BorderRadius.circular(12),- ),- padding: const EdgeInsets.all(8.0),- child: HugeIcon(- icon: HugeIcons.strokeRoundedDelete02,- color: colorScheme.strokeBase,+ height: 40,+ child: Center(+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedDelete02,+ color: colorScheme.strokeBase,+ size: 24,+ ),),),- const SizedBox(width: 12),+ const SizedBox(width: 8),Expanded(child: Text(context.l10n.trash,- style: textTheme.small,+ style: textTheme.body,overflow: TextOverflow.ellipsis,- maxLines: 2,+ maxLines: 1,),),],@@ -149,47 +147,39 @@ class _LegacyItem extends StatelessWidget {final textTheme = getEnteTextTheme(context);final borderRadius = BorderRadius.circular(20);- return InkWell(+ return GestureDetector(+ behavior: HitTestBehavior.opaque,onTap: () => openLegacyPage(context),- borderRadius: borderRadius,child: Container(+ height: 56,decoration: BoxDecoration(color: colorScheme.backdropBase,borderRadius: borderRadius,),+ padding: const EdgeInsets.all(8),child: Row(children: [SizedBox(- height: 60,- width: 60,- child: Padding(- padding: const EdgeInsets.all(10.0),- child: Container(- decoration: BoxDecoration(- color: colorScheme.primary700.withValues(alpha: 0.08),- borderRadius: BorderRadius.circular(12),- ),- padding: const EdgeInsets.all(8.0),- child: Icon(- Icons.favorite_rounded,- color: colorScheme.primary700,- ),+ width: 40,+ height: 40,+ child: Center(+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedFavourite,+ color: colorScheme.primary700,+ size: 24,),),),- const SizedBox(width: 4),+ const SizedBox(width: 8),Expanded(child: Text(context.l10n.legacy,style: textTheme.body,),),- Padding(- padding: const EdgeInsets.only(right: 12.0),- child: Icon(- Icons.chevron_right,- color: colorScheme.textMuted,- ),+ Icon(+ Icons.chevron_right,+ color: colorScheme.textMuted,),],),diff --git a/mobile/apps/locker/lib/ui/drawer/about_section_widget.dart b/mobile/apps/locker/lib/ui/drawer/about_section_widget.dartdeleted file mode 100644index 299aeaa24a..0000000000--- a/mobile/apps/locker/lib/ui/drawer/about_section_widget.dart+++ /dev/null@@ -1,56 +0,0 @@-import "package:ente_utils/platform_util.dart";-import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:locker/l10n/l10n.dart";-import "package:locker/ui/components/expandable_menu_item_widget.dart";-import "package:url_launcher/url_launcher.dart";--class AboutSectionWidget extends StatelessWidget {- const AboutSectionWidget({super.key});-- @override- Widget build(BuildContext context) {- return ExpandableMenuItemWidget(- title: context.l10n.about,- selectionOptionsWidget: _getSectionOptions(context),- leadingIcon: HugeIcons.strokeRoundedInformationCircle,- );- }-- Widget _getSectionOptions(BuildContext context) {- return Column(- children: [- ExpandableChildItem(- title: context.l10n.weAreOpenSource,- trailingIcon: Icons.chevron_right,- onTap: () async {- // ignore: unawaited_futures- launchUrl(Uri.parse("https://github.com/ente-io/ente"));- },- ),- ExpandableChildItem(- title: context.l10n.privacy,- trailingIcon: Icons.chevron_right,- onTap: () async {- await PlatformUtil.openWebView(- context,- context.l10n.privacy,- "https://ente.io/privacy",- );- },- ),- ExpandableChildItem(- title: context.l10n.termsOfServicesTitle,- trailingIcon: Icons.chevron_right,- onTap: () async {- await PlatformUtil.openWebView(- context,- context.l10n.termsOfServicesTitle,- "https://ente.io/terms",- );- },- ),- ],- );- }-}diff --git a/mobile/apps/locker/lib/ui/drawer/account_section_widget.dart b/mobile/apps/locker/lib/ui/drawer/account_section_widget.dartdeleted file mode 100644index 5958d9a3a8..0000000000--- a/mobile/apps/locker/lib/ui/drawer/account_section_widget.dart+++ /dev/null@@ -1,147 +0,0 @@-import "package:ente_accounts/pages/change_email_dialog.dart";-import "package:ente_accounts/pages/delete_account_page.dart";-import "package:ente_accounts/pages/password_entry_page.dart";-import "package:ente_accounts/services/user_service.dart";-import "package:ente_crypto_api/ente_crypto_api.dart";-import "package:ente_lock_screen/local_authentication_service.dart";-import "package:ente_pure_utils/ente_pure_utils.dart";-import "package:ente_ui/components/alert_bottom_sheet.dart";-import "package:ente_ui/components/buttons/gradient_button.dart";-import "package:ente_ui/theme/ente_theme.dart";-import "package:ente_ui/utils/dialog_util.dart";-import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:locker/l10n/l10n.dart";-import "package:locker/services/configuration.dart";-import "package:locker/ui/components/expandable_menu_item_widget.dart";-import "package:locker/ui/components/recovery_key_sheet.dart";-import "package:locker/ui/pages/home_page.dart";--class AccountSectionWidget extends StatelessWidget {- const AccountSectionWidget({super.key});-- @override- Widget build(BuildContext context) {- final l10n = context.l10n;- return ExpandableMenuItemWidget(- title: l10n.account,- selectionOptionsWidget: _getSectionOptions(context),- leadingIcon: HugeIcons.strokeRoundedUser,- );- }-- Column _getSectionOptions(BuildContext context) {- final l10n = context.l10n;- final colorScheme = getEnteColorScheme(context);-- return Column(- children: [- ExpandableChildItem(- title: l10n.changeEmail,- trailingIcon: Icons.chevron_right,- onTap: () async {- final hasAuthenticated = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- l10n.authToChangeYourEmail,- );- if (hasAuthenticated) {- // ignore: unawaited_futures- showChangeEmailDialog(context);- }- },- ),- ExpandableChildItem(- title: l10n.recoveryKey,- trailingIcon: Icons.chevron_right,- onTap: () async {- final hasAuthenticated = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- l10n.authToViewYourRecoveryKey,- );- if (hasAuthenticated) {- String recoveryKey;- try {- recoveryKey =- CryptoUtil.bin2hex(Configuration.instance.getRecoveryKey());- } catch (e) {- // ignore: unawaited_futures- showGenericErrorDialog(- context: context,- error: e,- );- return;- }- await showRecoveryKeySheet(- context,- recoveryKey: recoveryKey,- );- }- },- ),- ExpandableChildItem(- title: l10n.changePassword,- trailingIcon: Icons.chevron_right,- onTap: () async {- final hasAuthenticated = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- l10n.authToChangeYourPassword,- );- if (hasAuthenticated) {- // ignore: unawaited_futures- Navigator.of(context).push(- MaterialPageRoute(- builder: (BuildContext context) {- return PasswordEntryPage(- Configuration.instance,- PasswordEntryMode.update,- const HomePage(),- );- },- ),- );- }- },- ),- ExpandableChildItem(- title: l10n.deleteAccount,- textColor: colorScheme.warning500,- trailingIcon: Icons.chevron_right,- trailingIconColor: colorScheme.warning500,- onTap: () async {- final config = Configuration.instance;- // ignore: unawaited_futures- routeToPage(context, DeleteAccountPage(config));- },- ),- ExpandableChildItem(- title: l10n.logout,- trailingIcon: Icons.chevron_right,- onTap: () async {- _onLogoutTapped(context);- },- ),- ],- );- }-- void _onLogoutTapped(BuildContext context) {- showAlertBottomSheet(- context,- title: context.l10n.warning,- message: context.l10n.areYouSureYouWantToLogout,- assetPath: "assets/warning-grey.png",- buttons: [- GradientButton(- buttonType: GradientButtonType.critical,- text: context.l10n.yesLogout,- onTap: () async {- await UserService.instance.logout(context);- },- ),- ],- );- }-}diff --git a/mobile/apps/locker/lib/ui/drawer/app_version_widget.dart b/mobile/apps/locker/lib/ui/drawer/app_version_widget.dartdeleted file mode 100644index ae78268e40..0000000000--- a/mobile/apps/locker/lib/ui/drawer/app_version_widget.dart+++ /dev/null@@ -1,66 +0,0 @@-import "package:ente_ui/utils/dialog_util.dart";-import 'package:flutter/material.dart';-import 'package:package_info_plus/package_info_plus.dart';--class AppVersionWidget extends StatefulWidget {- const AppVersionWidget({- super.key,- });-- @override- State<AppVersionWidget> createState() => _AppVersionWidgetState();-}--class _AppVersionWidgetState extends State<AppVersionWidget> {- static const kTapThresholdForInspector = 5;- static const kConsecutiveTapTimeWindowInMilliseconds = 2000;- static const kDummyDelayDurationInMilliseconds = 1500;-- int? _lastTap;- int _consecutiveTaps = 0;-- @override- Widget build(BuildContext context) {- return GestureDetector(- behavior: HitTestBehavior.translucent,- onTap: () async {- final int now = DateTime.now().millisecondsSinceEpoch;- if (now - (_lastTap ?? now) < kConsecutiveTapTimeWindowInMilliseconds) {- _consecutiveTaps++;- if (_consecutiveTaps == kTapThresholdForInspector) {- final dialog =- createProgressDialog(context, "Starting network inspector...");- await dialog.show();- await Future.delayed(- const Duration(milliseconds: kDummyDelayDurationInMilliseconds),- );- await dialog.hide();- }- } else {- _consecutiveTaps = 1;- }- _lastTap = now;- },- child: FutureBuilder<String>(- future: _getAppVersion(),- builder: (context, snapshot) {- if (snapshot.hasData) {- return Padding(- padding: const EdgeInsets.all(20),- child: Text(- "Version: ${snapshot.data!}",- style: Theme.of(context).textTheme.bodySmall,- ),- );- }- return Container();- },- ),- );- }-- Future<String> _getAppVersion() async {- final pkgInfo = await PackageInfo.fromPlatform();- return pkgInfo.version;- }-}diff --git a/mobile/apps/locker/lib/ui/drawer/common_settings.dart b/mobile/apps/locker/lib/ui/drawer/common_settings.dartdeleted file mode 100644index 699e5768c1..0000000000--- a/mobile/apps/locker/lib/ui/drawer/common_settings.dart+++ /dev/null@@ -1,14 +0,0 @@-import "package:expandable/expandable.dart";-import "package:flutter/material.dart";--Widget sectionOptionSpacing = const SizedBox(height: 8);--ExpandableThemeData getExpandableTheme() {- return const ExpandableThemeData(- hasIcon: false,- useInkWell: false,- tapBodyToCollapse: true,- tapBodyToExpand: true,- animationDuration: Duration(milliseconds: 400),- );-}diff --git a/mobile/apps/locker/lib/ui/drawer/drawer_page.dart b/mobile/apps/locker/lib/ui/drawer/drawer_page.dartindex f4fe8be56f..e4e96d68ea 100644--- a/mobile/apps/locker/lib/ui/drawer/drawer_page.dart+++ b/mobile/apps/locker/lib/ui/drawer/drawer_page.dart@@ -9,9 +9,8 @@ import "package:locker/events/user_details_refresh_event.dart";import "package:locker/services/configuration.dart";import "package:locker/ui/components/legacy_collections_trash_widget.dart";import "package:locker/ui/components/usage_card_widget.dart";-import "package:locker/ui/drawer/app_version_widget.dart";import "package:locker/ui/drawer/drawer_title_bar_widget.dart";-import "package:locker/ui/drawer/settings_widgets.dart";+import "package:locker/ui/settings/settings_page.dart";class DrawerPage extends StatelessWidget {final ValueNotifier<String?> emailNotifier;@@ -93,8 +92,7 @@ class DrawerPage extends StatelessWidget {}contents.addAll([- SettingsWidgets(hasLoggedIn: hasLoggedIn),- const AppVersionWidget(),+ SettingsWidget(hasLoggedIn: hasLoggedIn),const Padding(padding: EdgeInsets.only(bottom: 60),),diff --git a/mobile/apps/locker/lib/ui/drawer/general_section_widget.dart b/mobile/apps/locker/lib/ui/drawer/general_section_widget.dartdeleted file mode 100644index 644ec63f42..0000000000--- a/mobile/apps/locker/lib/ui/drawer/general_section_widget.dart+++ /dev/null@@ -1,50 +0,0 @@-import "package:ente_pure_utils/ente_pure_utils.dart";-import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:locker/app.dart";-import "package:locker/core/locale.dart";-import "package:locker/l10n/l10n.dart";-import "package:locker/ui/components/expandable_menu_item_widget.dart";-import "package:locker/ui/settings/language_selector_page.dart";--class GeneralSectionWidget extends StatelessWidget {- const GeneralSectionWidget({super.key});-- @override- Widget build(BuildContext context) {- final l10n = context.l10n;- return ExpandableMenuItemWidget(- title: l10n.general,- selectionOptionsWidget: _getSectionOptions(context),- leadingIcon: HugeIcons.strokeRoundedSettings01,- );- }-- Column _getSectionOptions(BuildContext context) {- final l10n = context.l10n;-- return Column(- children: [- ExpandableChildItem(- title: l10n.language,- trailingIcon: Icons.chevron_right,- onTap: () async {- final locale = await getLocale();- // ignore: unawaited_futures- routeToPage(- context,- LanguageSelectorPage(- appSupportedLocales,- (newLocale) async {- await setLocale(newLocale);- App.setLocale(context, newLocale);- },- locale ?? const Locale('en'),- ),- );- },- ),- ],- );- }-}diff --git a/mobile/apps/locker/lib/ui/drawer/security_section_widget.dart b/mobile/apps/locker/lib/ui/drawer/security_section_widget.dartdeleted file mode 100644index d5e9628860..0000000000--- a/mobile/apps/locker/lib/ui/drawer/security_section_widget.dart+++ /dev/null@@ -1,172 +0,0 @@-import "dart:async";-import "dart:typed_data";--import "package:ente_accounts/models/user_details.dart";-import "package:ente_accounts/pages/request_pwd_verification_page.dart";-import "package:ente_accounts/services/passkey_service.dart";-import "package:ente_accounts/services/user_service.dart";-import "package:ente_crypto_api/ente_crypto_api.dart";-import "package:ente_lock_screen/auth_util.dart";-import "package:ente_lock_screen/local_authentication_service.dart";-import "package:ente_lock_screen/lock_screen_settings.dart";-import "package:ente_lock_screen/ui/lock_screen_options.dart";-import "package:ente_pure_utils/ente_pure_utils.dart";-import "package:ente_ui/utils/dialog_util.dart";-import "package:ente_ui/utils/toast_util.dart";-import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:locker/l10n/l10n.dart";-import "package:locker/services/configuration.dart";-import "package:locker/ui/components/expandable_menu_item_widget.dart";-import "package:logging/logging.dart";--class SecuritySectionWidget extends StatefulWidget {- const SecuritySectionWidget({super.key});-- @override- State<SecuritySectionWidget> createState() => _SecuritySectionWidgetState();-}--class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {- final Logger _logger = Logger("SecuritySectionWidget");-- @override- Widget build(BuildContext context) {- final l10n = context.l10n;- return ExpandableMenuItemWidget(- title: l10n.security,- selectionOptionsWidget: _getSectionOptions(context),- leadingIcon: HugeIcons.strokeRoundedSecurityCheck,- );- }-- Widget _getSectionOptions(BuildContext context) {- final l10n = context.l10n;- return Column(- children: [- // TODO: Enable when ready- // ExpandableChildItem(- // title: l10n.emailVerificationToggle,- // trailingWidget: ToggleSwitchWidget(- // value: () => UserService.instance.hasEmailMFAEnabled(),- // onChanged: () async {- // final hasAuthenticated = await LocalAuthenticationService- // .instance- // .requestLocalAuthentication(- // context,- // l10n.authToChangeEmailVerificationSetting,- // );- // final isEmailMFAEnabled =- // UserService.instance.hasEmailMFAEnabled();- // if (hasAuthenticated) {- // await updateEmailMFA(!isEmailMFAEnabled);- // }- // },- // ),- // ),- // TODO: Enable when ready- // ExpandableChildItem(- // title: l10n.passkey,- // trailingIcon: Icons.chevron_right,- // onTap: () async {- // final hasAuthenticated = await LocalAuthenticationService.instance- // .requestLocalAuthentication(- // context,- // l10n.authToViewPasskey,- // );- // if (hasAuthenticated) {- // await onPasskeyClick(context);- // }- // },- // ),- ExpandableChildItem(- title: l10n.appLock,- trailingIcon: Icons.chevron_right,- onTap: () async {- if (await LockScreenSettings.instance.isDeviceSupported()) {- final bool result = await requestAuthentication(- context,- context.l10n.authToChangeLockscreenSetting,- );- if (result) {- await Navigator.of(context).push(- MaterialPageRoute(- builder: (BuildContext context) {- return const LockScreenOptions();- },- ),- );- }- } else {- await showErrorDialog(- context,- context.l10n.noSystemLockFound,- context.l10n.toEnableAppLockPleaseSetupDevicePasscodeOrScreen,- );- }- },- ),- ],- );- }-- Future<void> onPasskeyClick(BuildContext buildContext) async {- try {- final hasAuthenticated =- await LocalAuthenticationService.instance.requestLocalAuthentication(- context,- context.l10n.authenticateGeneric,- refocusWindows: false,- );- if (!hasAuthenticated) {- return;- }- final isPassKeyResetEnabled =- await PasskeyService.instance.isPasskeyRecoveryEnabled();- if (!isPassKeyResetEnabled) {- final Uint8List recoveryKey = Configuration.instance.getRecoveryKey();- final resetKey = CryptoUtil.generateKey();- final resetKeyBase64 = CryptoUtil.bin2base64(resetKey);- final encryptionResult = CryptoUtil.encryptSync(- resetKey,- recoveryKey,- );- await PasskeyService.instance.configurePasskeyRecovery(- resetKeyBase64,- CryptoUtil.bin2base64(encryptionResult.encryptedData!),- CryptoUtil.bin2base64(encryptionResult.nonce!),- );- }- PasskeyService.instance.openPasskeyPage(buildContext).ignore();- } catch (e, s) {- _logger.severe("failed to open passkey page", e, s);- await showGenericErrorDialog(- context: context,- error: e,- );- }- }-- Future<void> updateEmailMFA(bool isEnabled) async {- try {- final UserDetails details =- await UserService.instance.getUserDetailsV2(memoryCount: false);- if ((details.profileData?.canDisableEmailMFA ?? false) == false) {- await routeToPage(- context,- RequestPasswordVerificationPage(- Configuration.instance,- onPasswordVerified: (Uint8List keyEncryptionKey) async {- final Uint8List loginKey =- await CryptoUtil.deriveLoginKey(keyEncryptionKey);- await UserService.instance.registerOrUpdateSrp(loginKey);- },- ),- );- }- await UserService.instance.updateEmailMFA(isEnabled);- } catch (e) {- showToast(context, context.l10n.somethingWentWrong);- }- }-}diff --git a/mobile/apps/locker/lib/ui/drawer/settings_widgets.dart b/mobile/apps/locker/lib/ui/drawer/settings_widgets.dartdeleted file mode 100644index f18308e7cf..0000000000--- a/mobile/apps/locker/lib/ui/drawer/settings_widgets.dart+++ /dev/null@@ -1,78 +0,0 @@-import "dart:io";--import "package:ente_ui/theme/ente_theme.dart";-import "package:flutter/foundation.dart";-import "package:flutter/material.dart";-import "package:locker/l10n/l10n.dart";-import "package:locker/ui/drawer/about_section_widget.dart";-import "package:locker/ui/drawer/account_section_widget.dart";-import "package:locker/ui/drawer/general_section_widget.dart";-import "package:locker/ui/drawer/security_section_widget.dart";-import "package:locker/ui/drawer/social_section_widget.dart";-import "package:locker/ui/drawer/support_section_widget.dart";-import "package:locker/ui/drawer/theme_switch_widget.dart";--class SettingsWidgets extends StatelessWidget {- final bool hasLoggedIn;-- const SettingsWidgets({- super.key,- required this.hasLoggedIn,- });-- @override- Widget build(BuildContext context) {- const sectionSpacing = SizedBox(height: 8);- final List<Widget> contents = [];-- contents.addAll([- Text(- context.l10n.settings,- style: getEnteTextTheme(context).bodyMuted,- textAlign: TextAlign.left,- ),- const SizedBox(height: 12),- ]);-- if (hasLoggedIn) {- contents.addAll([- const AccountSectionWidget(),- sectionSpacing,- ]);-- contents.addAll([- const SecuritySectionWidget(),- sectionSpacing,- ]);-- if (Platform.isAndroid ||- Platform.isWindows ||- Platform.isLinux ||- kDebugMode) {- contents.addAll([- const ThemeSwitchWidget(),- sectionSpacing,- ]);- }- }-- contents.addAll([- const GeneralSectionWidget(),- sectionSpacing,- ]);-- contents.addAll([- const SupportSectionWidget(),- sectionSpacing,- const SocialSectionWidget(),- sectionSpacing,- const AboutSectionWidget(),- ]);-- return Column(- mainAxisSize: MainAxisSize.max,- crossAxisAlignment: CrossAxisAlignment.start,- children: contents,- );- }-}diff --git a/mobile/apps/locker/lib/ui/drawer/social_section_widget.dart b/mobile/apps/locker/lib/ui/drawer/social_section_widget.dartdeleted file mode 100644index 397cb9c274..0000000000--- a/mobile/apps/locker/lib/ui/drawer/social_section_widget.dart+++ /dev/null@@ -1,84 +0,0 @@-import "dart:io";--import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:locker/l10n/l10n.dart";-import "package:locker/ui/components/expandable_menu_item_widget.dart";-import "package:url_launcher/url_launcher_string.dart";--class SocialSectionWidget extends StatelessWidget {- const SocialSectionWidget({super.key});-- @override- Widget build(BuildContext context) {- final l10n = context.l10n;- return ExpandableMenuItemWidget(- title: l10n.social,- selectionOptionsWidget: _getSectionOptions(context),- leadingIcon: HugeIcons.strokeRoundedGlobe,- );- }-- Widget _getSectionOptions(BuildContext context) {- final l10n = context.l10n;-- final List<Widget> options = [- _SocialsChildItem(- l10n.blog,- "https://ente.io/blog",- launchInExternalApp: !Platform.isAndroid,- ),- _SocialsChildItem(- l10n.merchandise,- "https://shop.ente.io",- launchInExternalApp: !Platform.isAndroid,- ),- _SocialsChildItem(- l10n.twitter,- "https://twitter.com/enteio",- ),- _SocialsChildItem(- l10n.mastodon,- "https://fosstodon.org/@ente",- ),- _SocialsChildItem(- l10n.discord,- "https://ente.io/discord",- ),- _SocialsChildItem(- l10n.reddit,- "https://reddit.com/r/enteio",- ),- ];- return Column(children: options);- }-}--class _SocialsChildItem extends StatelessWidget {- final String text;- final String url;- final bool launchInExternalApp;-- const _SocialsChildItem(- this.text,- this.url, {- this.launchInExternalApp = true,- });-- @override- Widget build(BuildContext context) {- return ExpandableChildItem(- title: text,- trailingIcon: Icons.chevron_right,- onTap: () async {- // ignore: unawaited_futures- launchUrlString(- url,- mode: launchInExternalApp- ? LaunchMode.externalApplication- : LaunchMode.platformDefault,- );- },- );- }-}diff --git a/mobile/apps/locker/lib/ui/drawer/support_section_widget.dart b/mobile/apps/locker/lib/ui/drawer/support_section_widget.dartdeleted file mode 100644index 22687ebac4..0000000000--- a/mobile/apps/locker/lib/ui/drawer/support_section_widget.dart+++ /dev/null@@ -1,76 +0,0 @@-import "dart:io";--import "package:ente_utils/email_util.dart";-import "package:ente_utils/platform_util.dart";-import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:locker/core/constants.dart";-import "package:locker/l10n/l10n.dart";-import "package:locker/ui/components/expandable_menu_item_widget.dart";-import "package:url_launcher/url_launcher_string.dart";--class SupportSectionWidget extends StatelessWidget {- const SupportSectionWidget({super.key});-- @override- Widget build(BuildContext context) {- return ExpandableMenuItemWidget(- title: context.l10n.support,- selectionOptionsWidget: _getSectionOptions(context),- leadingIcon: HugeIcons.strokeRoundedHelpCircle,- );- }-- Widget _getSectionOptions(BuildContext context) {- final String bugsEmail =- Platform.isAndroid ? "[email protected]" : "[email protected]";- return Column(- children: [- ExpandableChildItem(- title: context.l10n.contactSupport,- trailingIcon: Icons.chevron_right,- onTap: () async {- await sendEmail(context, to: supportEmail);- },- ),- ExpandableChildItem(- title: context.l10n.help,- trailingIcon: Icons.chevron_right,- onTap: () async {- await PlatformUtil.openWebView(- context,- context.l10n.help,- "https://ente.io/help",- );- },- ),- ExpandableChildItem(- title: context.l10n.suggestFeatures,- trailingIcon: Icons.chevron_right,- onTap: () async {- // ignore: unawaited_futures- launchUrlString(- githubDiscussionsUrl,- mode: LaunchMode.externalApplication,- );- },- ),- ExpandableChildItem(- title: context.l10n.reportABug,- trailingIcon: Icons.chevron_right,- onTap: () async {- await sendLogs(- context,- "[email protected]",- dialogBody: context.l10n.logsDialogBodyLocker,- );- },- onLongPress: () async {- final zipFilePath = await getZippedLogsFile();- await shareLogs(context, bugsEmail, zipFilePath);- },- ),- ],- );- }-}diff --git a/mobile/apps/locker/lib/ui/drawer/theme_switch_widget.dart b/mobile/apps/locker/lib/ui/drawer/theme_switch_widget.dartdeleted file mode 100644index 5737a94ce3..0000000000--- a/mobile/apps/locker/lib/ui/drawer/theme_switch_widget.dart+++ /dev/null@@ -1,82 +0,0 @@-import "package:adaptive_theme/adaptive_theme.dart";-import "package:ente_ui/theme/ente_theme.dart";-import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:locker/l10n/l10n.dart";-import "package:locker/ui/components/expandable_menu_item_widget.dart";--class ThemeSwitchWidget extends StatefulWidget {- const ThemeSwitchWidget({super.key});-- @override- State<ThemeSwitchWidget> createState() => _ThemeSwitchWidgetState();-}--class _ThemeSwitchWidgetState extends State<ThemeSwitchWidget> {- AdaptiveThemeMode? currentThemeMode;-- @override- void initState() {- super.initState();- AdaptiveTheme.getThemeMode().then(- (value) {- currentThemeMode = value ?? AdaptiveThemeMode.system;- debugPrint("theme value $value");- if (mounted) {- setState(() => {});- }- },- );- }-- @override- void dispose() {- super.dispose();- }-- @override- Widget build(BuildContext context) {- return ExpandableMenuItemWidget(- title: context.l10n.theme,- selectionOptionsWidget: _getSectionOptions(context),- leadingIcon: HugeIcons.strokeRoundedSun01,- );- }-- Widget _getSectionOptions(BuildContext context) {- return Column(- children: [- _menuItem(context, AdaptiveThemeMode.system),- _menuItem(context, AdaptiveThemeMode.dark),- _menuItem(context, AdaptiveThemeMode.light),- ],- );- }-- String _name(BuildContext ctx, AdaptiveThemeMode mode) {- switch (mode) {- case AdaptiveThemeMode.light:- return ctx.l10n.lightTheme;- case AdaptiveThemeMode.dark:- return ctx.l10n.darkTheme;- case AdaptiveThemeMode.system:- return ctx.l10n.systemTheme;- }- }-- Widget _menuItem(BuildContext context, AdaptiveThemeMode themeMode) {- final colorScheme = getEnteColorScheme(context);- return ExpandableChildItem(- title: _name(context, themeMode),- trailingIcon: currentThemeMode == themeMode ? Icons.check : null,- trailingIconColor: colorScheme.primary500,- onTap: () async {- AdaptiveTheme.of(context).setThemeMode(themeMode);- currentThemeMode = themeMode;- if (mounted) {- setState(() {});- }- },- );- }-}diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dartindex 986134ccf7..fb6930b61e 100644--- a/mobile/apps/locker/lib/ui/pages/home_page.dart+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart@@ -627,7 +627,7 @@ class _HomePageState extends UploaderPageState<HomePage>backgroundColor: colorScheme.backgroundBase,child: _settingsPage,),- drawerEnableOpenDragGesture: !Platform.isAndroid,+ drawerEnableOpenDragGesture: true,onDrawerChanged: (isOpened) => _isSettingsOpen = isOpened,appBar: CustomLockerAppBar(scaffoldKey: scaffoldKey,diff --git a/mobile/apps/locker/lib/ui/settings/pages/about_page.dart b/mobile/apps/locker/lib/ui/settings/pages/about_page.dartnew file mode 100644index 0000000000..ad98aad169--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/pages/about_page.dart@@ -0,0 +1,80 @@+import "package:ente_ui/components/title_bar_title_widget.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:ente_utils/platform_util.dart";+import "package:flutter/material.dart";+import "package:locker/l10n/l10n.dart";+import "package:locker/ui/settings/widgets/settings_widget.dart";+import "package:url_launcher/url_launcher.dart";++class AboutPage extends StatelessWidget {+ const AboutPage({super.key});++ @override+ Widget build(BuildContext context) {+ final l10n = context.l10n;+ final colorScheme = getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: colorScheme.backgroundBase,+ surfaceTintColor: Colors.transparent,+ toolbarHeight: 48,+ leadingWidth: 48,+ leading: GestureDetector(+ onTap: () => Navigator.pop(context),+ child: const Icon(Icons.arrow_back_outlined),+ ),+ ),+ body: SafeArea(+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ TitleBarTitleWidget(title: l10n.about),+ const SizedBox(height: 24),+ SettingsOptionWidget(+ title: l10n.weAreOpenSource,+ onTap: () => _onOpenSourceTapped(),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.privacy,+ onTap: () => _onPrivacyTapped(context),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.termsOfServicesTitle,+ onTap: () => _onTermsTapped(context),+ ),+ ],+ ),+ ),+ ),+ );+ }++ void _onOpenSourceTapped() {+ // ignore: unawaited_futures+ launchUrl(Uri.parse("https://github.com/ente-io/ente"));+ }++ Future<void> _onPrivacyTapped(BuildContext context) async {+ final l10n = context.l10n;+ await PlatformUtil.openWebView(+ context,+ l10n.privacy,+ "https://ente.io/privacy",+ );+ }++ Future<void> _onTermsTapped(BuildContext context) async {+ final l10n = context.l10n;+ await PlatformUtil.openWebView(+ context,+ l10n.termsOfServicesTitle,+ "https://ente.io/terms",+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/settings/pages/account_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/account_settings_page.dartnew file mode 100644index 0000000000..53c136b348--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/pages/account_settings_page.dart@@ -0,0 +1,140 @@+import "package:ente_accounts/pages/change_email_dialog.dart";+import "package:ente_accounts/pages/delete_account_page.dart";+import "package:ente_accounts/pages/password_entry_page.dart";+import "package:ente_crypto_api/ente_crypto_api.dart";+import "package:ente_lock_screen/local_authentication_service.dart";+import "package:ente_pure_utils/ente_pure_utils.dart";+import "package:ente_ui/components/title_bar_title_widget.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:ente_ui/utils/dialog_util.dart";+import "package:flutter/material.dart";+import "package:locker/l10n/l10n.dart";+import "package:locker/services/configuration.dart";+import "package:locker/ui/components/recovery_key_sheet.dart";+import "package:locker/ui/pages/home_page.dart";+import "package:locker/ui/settings/widgets/settings_widget.dart";++class AccountSettingsPage extends StatelessWidget {+ const AccountSettingsPage({super.key});++ @override+ Widget build(BuildContext context) {+ final l10n = context.l10n;+ final colorScheme = getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: colorScheme.backgroundBase,+ surfaceTintColor: Colors.transparent,+ toolbarHeight: 48,+ leadingWidth: 48,+ leading: GestureDetector(+ onTap: () => Navigator.pop(context),+ child: const Icon(Icons.arrow_back_outlined),+ ),+ ),+ body: SafeArea(+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ TitleBarTitleWidget(title: l10n.account),+ const SizedBox(height: 24),+ SettingsOptionWidget(+ title: l10n.changeEmail,+ onTap: () => _onChangeEmailTapped(context),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.recoveryKey,+ onTap: () => _onRecoveryKeyTapped(context),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.changePassword,+ onTap: () => _onChangePasswordTapped(context),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.deleteAccount,+ textColor: colorScheme.warning500,+ onTap: () => _onDeleteAccountTapped(context),+ ),+ ],+ ),+ ),+ ),+ );+ }++ Future<void> _onChangeEmailTapped(BuildContext context) async {+ final l10n = context.l10n;+ final hasAuthenticated =+ await LocalAuthenticationService.instance.requestLocalAuthentication(+ context,+ l10n.authToChangeYourEmail,+ );+ if (hasAuthenticated) {+ // ignore: unawaited_futures+ showChangeEmailDialog(context);+ }+ }++ Future<void> _onRecoveryKeyTapped(BuildContext context) async {+ final l10n = context.l10n;+ final hasAuthenticated =+ await LocalAuthenticationService.instance.requestLocalAuthentication(+ context,+ l10n.authToViewYourRecoveryKey,+ );+ if (hasAuthenticated) {+ String recoveryKey;+ try {+ recoveryKey =+ CryptoUtil.bin2hex(Configuration.instance.getRecoveryKey());+ } catch (e) {+ // ignore: unawaited_futures+ showGenericErrorDialog(+ context: context,+ error: e,+ );+ return;+ }+ await showRecoveryKeySheet(+ context,+ recoveryKey: recoveryKey,+ );+ }+ }++ Future<void> _onChangePasswordTapped(BuildContext context) async {+ final l10n = context.l10n;+ final hasAuthenticated =+ await LocalAuthenticationService.instance.requestLocalAuthentication(+ context,+ l10n.authToChangeYourPassword,+ );+ if (hasAuthenticated) {+ // ignore: unawaited_futures+ Navigator.of(context).push(+ MaterialPageRoute(+ builder: (BuildContext context) {+ return PasswordEntryPage(+ Configuration.instance,+ PasswordEntryMode.update,+ const HomePage(),+ );+ },+ ),+ );+ }+ }++ void _onDeleteAccountTapped(BuildContext context) {+ final config = Configuration.instance;+ // ignore: unawaited_futures+ routeToPage(context, DeleteAccountPage(config));+ }+}diff --git a/mobile/apps/locker/lib/ui/settings/pages/general_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/general_settings_page.dartnew file mode 100644index 0000000000..ad5caa5dd1--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/pages/general_settings_page.dart@@ -0,0 +1,65 @@+import "package:ente_ui/components/title_bar_title_widget.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";+import "package:locker/app.dart";+import "package:locker/core/locale.dart";+import "package:locker/l10n/l10n.dart";+import "package:locker/ui/settings/language_selector_page.dart";+import "package:locker/ui/settings/widgets/settings_widget.dart";++class GeneralSettingsPage extends StatelessWidget {+ const GeneralSettingsPage({super.key});++ @override+ Widget build(BuildContext context) {+ final l10n = context.l10n;+ final colorScheme = getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: colorScheme.backgroundBase,+ surfaceTintColor: Colors.transparent,+ toolbarHeight: 48,+ leadingWidth: 48,+ leading: GestureDetector(+ onTap: () => Navigator.pop(context),+ child: const Icon(Icons.arrow_back_outlined),+ ),+ ),+ body: SafeArea(+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ TitleBarTitleWidget(title: l10n.general),+ const SizedBox(height: 24),+ SettingsOptionWidget(+ title: l10n.selectLanguage,+ onTap: () => _onLanguageTapped(context),+ ),+ ],+ ),+ ),+ ),+ );+ }++ void _onLanguageTapped(BuildContext context) {+ final currentLocale = Localizations.localeOf(context);+ Navigator.of(context).push(+ MaterialPageRoute(+ builder: (context) => LanguageSelectorPage(+ appSupportedLocales,+ (locale) {+ App.setLocale(context, locale);+ // ignore: unawaited_futures+ setLocale(locale);+ },+ currentLocale,+ ),+ ),+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/settings/pages/security_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/security_settings_page.dartnew file mode 100644index 0000000000..68563aef26--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/pages/security_settings_page.dart@@ -0,0 +1,74 @@+import "package:ente_lock_screen/auth_util.dart";+import "package:ente_lock_screen/lock_screen_settings.dart";+import "package:ente_lock_screen/ui/lock_screen_options.dart";+import "package:ente_ui/components/title_bar_title_widget.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:ente_ui/utils/dialog_util.dart";+import "package:flutter/material.dart";+import "package:locker/l10n/l10n.dart";+import "package:locker/ui/settings/widgets/settings_widget.dart";++class SecuritySettingsPage extends StatelessWidget {+ const SecuritySettingsPage({super.key});++ @override+ Widget build(BuildContext context) {+ final l10n = context.l10n;+ final colorScheme = getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: colorScheme.backgroundBase,+ surfaceTintColor: Colors.transparent,+ toolbarHeight: 48,+ leadingWidth: 48,+ leading: GestureDetector(+ onTap: () => Navigator.pop(context),+ child: const Icon(Icons.arrow_back_outlined),+ ),+ ),+ body: SafeArea(+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ TitleBarTitleWidget(title: l10n.security),+ const SizedBox(height: 24),+ SettingsOptionWidget(+ title: l10n.appLock,+ onTap: () => _onAppLockTapped(context),+ ),+ ],+ ),+ ),+ ),+ );+ }++ Future<void> _onAppLockTapped(BuildContext context) async {+ final l10n = context.l10n;+ if (await LockScreenSettings.instance.isDeviceSupported()) {+ final bool result = await requestAuthentication(+ context,+ l10n.authToChangeLockscreenSetting,+ );+ if (result) {+ await Navigator.of(context).push(+ MaterialPageRoute(+ builder: (BuildContext context) {+ return const LockScreenOptions();+ },+ ),+ );+ }+ } else {+ await showErrorDialog(+ context,+ l10n.noSystemLockFound,+ l10n.toEnableAppLockPleaseSetupDevicePasscodeOrScreen,+ );+ }+ }+}diff --git a/mobile/apps/locker/lib/ui/settings/pages/support_page.dart b/mobile/apps/locker/lib/ui/settings/pages/support_page.dartnew file mode 100644index 0000000000..f6ab1887a7--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/pages/support_page.dart@@ -0,0 +1,94 @@+import "package:ente_ui/components/title_bar_title_widget.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:ente_utils/email_util.dart";+import "package:ente_utils/platform_util.dart";+import "package:flutter/material.dart";+import "package:locker/core/constants.dart";+import "package:locker/l10n/l10n.dart";+import "package:locker/ui/settings/widgets/settings_widget.dart";+import "package:url_launcher/url_launcher_string.dart";++class SupportPage extends StatelessWidget {+ const SupportPage({super.key});++ @override+ Widget build(BuildContext context) {+ final l10n = context.l10n;+ final colorScheme = getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: colorScheme.backgroundBase,+ surfaceTintColor: Colors.transparent,+ toolbarHeight: 48,+ leadingWidth: 48,+ leading: GestureDetector(+ onTap: () => Navigator.pop(context),+ child: const Icon(Icons.arrow_back_outlined),+ ),+ ),+ body: SafeArea(+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ TitleBarTitleWidget(title: l10n.support),+ const SizedBox(height: 24),+ SettingsOptionWidget(+ title: l10n.contactSupport,+ onTap: () => _onContactSupportTapped(context),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.help,+ onTap: () => _onHelpTapped(context),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.suggestFeatures,+ onTap: () => _onSuggestFeaturesTapped(),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.reportABug,+ onTap: () => _onReportBugTapped(context),+ ),+ ],+ ),+ ),+ ),+ );+ }++ Future<void> _onContactSupportTapped(BuildContext context) async {+ await sendEmail(context, to: supportEmail);+ }++ Future<void> _onHelpTapped(BuildContext context) async {+ final l10n = context.l10n;+ await PlatformUtil.openWebView(+ context,+ l10n.help,+ "https://ente.io/help",+ );+ }++ void _onSuggestFeaturesTapped() {+ // ignore: unawaited_futures+ launchUrlString(+ githubDiscussionsUrl,+ mode: LaunchMode.externalApplication,+ );+ }++ Future<void> _onReportBugTapped(BuildContext context) async {+ final l10n = context.l10n;+ await sendLogs(+ context,+ "[email protected]",+ dialogBody: l10n.logsDialogBodyLocker,+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/settings/pages/theme_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/theme_settings_page.dartnew file mode 100644index 0000000000..0486d73322--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/pages/theme_settings_page.dart@@ -0,0 +1,94 @@+import "package:adaptive_theme/adaptive_theme.dart";+import "package:ente_ui/components/title_bar_title_widget.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";+import "package:locker/l10n/l10n.dart";+import "package:locker/ui/settings/widgets/settings_widget.dart";++class ThemeSettingsPage extends StatefulWidget {+ const ThemeSettingsPage({super.key});++ @override+ State<ThemeSettingsPage> createState() => _ThemeSettingsPageState();+}++class _ThemeSettingsPageState extends State<ThemeSettingsPage> {+ AdaptiveThemeMode? currentThemeMode;++ @override+ void initState() {+ super.initState();+ AdaptiveTheme.getThemeMode().then((value) {+ currentThemeMode = value ?? AdaptiveThemeMode.system;+ if (mounted) {+ setState(() {});+ }+ });+ }++ @override+ Widget build(BuildContext context) {+ final l10n = context.l10n;+ final colorScheme = getEnteColorScheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: colorScheme.backgroundBase,+ surfaceTintColor: Colors.transparent,+ toolbarHeight: 48,+ leadingWidth: 48,+ leading: GestureDetector(+ onTap: () => Navigator.pop(context),+ child: const Icon(Icons.arrow_back_outlined),+ ),+ ),+ body: SafeArea(+ child: Padding(+ padding: const EdgeInsets.all(16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ TitleBarTitleWidget(title: l10n.theme),+ const SizedBox(height: 24),+ SettingsOptionWidget(+ title: l10n.systemTheme,+ showChevron: false,+ trailing: currentThemeMode == AdaptiveThemeMode.system+ ? Icon(Icons.check, color: colorScheme.primary700)+ : null,+ onTap: () => _setTheme(AdaptiveThemeMode.system),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.lightTheme,+ showChevron: false,+ trailing: currentThemeMode == AdaptiveThemeMode.light+ ? Icon(Icons.check, color: colorScheme.primary700)+ : null,+ onTap: () => _setTheme(AdaptiveThemeMode.light),+ ),+ const SizedBox(height: 8),+ SettingsOptionWidget(+ title: l10n.darkTheme,+ showChevron: false,+ trailing: currentThemeMode == AdaptiveThemeMode.dark+ ? Icon(Icons.check, color: colorScheme.primary700)+ : null,+ onTap: () => _setTheme(AdaptiveThemeMode.dark),+ ),+ ],+ ),+ ),+ ),+ );+ }++ Future<void> _setTheme(AdaptiveThemeMode themeMode) async {+ AdaptiveTheme.of(context).setThemeMode(themeMode);+ currentThemeMode = themeMode;+ if (mounted) {+ setState(() {});+ }+ }+}diff --git a/mobile/apps/locker/lib/ui/settings/settings_page.dart b/mobile/apps/locker/lib/ui/settings/settings_page.dartnew file mode 100644index 0000000000..bc3f552e3b--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/settings_page.dart@@ -0,0 +1,169 @@+import "package:ente_accounts/services/user_service.dart";+import "package:ente_ui/components/alert_bottom_sheet.dart";+import "package:ente_ui/components/buttons/gradient_button.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:locker/l10n/l10n.dart";+import "package:locker/ui/settings/pages/about_page.dart";+import "package:locker/ui/settings/pages/account_settings_page.dart";+import "package:locker/ui/settings/pages/general_settings_page.dart";+import "package:locker/ui/settings/pages/security_settings_page.dart";+import "package:locker/ui/settings/pages/support_page.dart";+import "package:locker/ui/settings/pages/theme_settings_page.dart";+import "package:locker/ui/settings/widgets/app_version_widget.dart";+import "package:locker/ui/settings/widgets/settings_widget.dart";+import "package:locker/ui/settings/widgets/social_icons_row.dart";++class SettingsWidget extends StatelessWidget {+ final bool hasLoggedIn;++ const SettingsWidget({+ required this.hasLoggedIn,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final l10n = context.l10n;+ const groupSpacing = SizedBox(height: 8);++ final List<Widget> contents = [];++ if (hasLoggedIn) {+ contents.add(+ SettingsGroup(+ children: [+ SettingsItem(+ icon: HugeIcons.strokeRoundedUser,+ title: l10n.account,+ onTap: () => _navigateTo(context, const AccountSettingsPage()),+ ),+ ],+ ),+ );+ contents.add(groupSpacing);++ contents.add(+ SettingsGroup(+ children: [+ SettingsItem(+ icon: HugeIcons.strokeRoundedSecurityCheck,+ title: l10n.security,+ onTap: () => _navigateTo(context, const SecuritySettingsPage()),+ ),+ ],+ ),+ );+ contents.add(groupSpacing);++ contents.add(+ SettingsGroup(+ children: [+ SettingsItem(+ icon: HugeIcons.strokeRoundedSun03,+ title: l10n.appearance,+ onTap: () => _navigateTo(context, const ThemeSettingsPage()),+ ),+ ],+ ),+ );+ contents.add(groupSpacing);+ }++ contents.add(+ SettingsGroup(+ children: [+ SettingsItem(+ icon: HugeIcons.strokeRoundedSettings01,+ title: l10n.general,+ onTap: () => _onGeneralTapped(context),+ ),+ ],+ ),+ );+ contents.add(groupSpacing);++ contents.add(+ SettingsGroup(+ children: [+ SettingsItem(+ icon: HugeIcons.strokeRoundedHelpCircle,+ title: l10n.helpAndSupport,+ onTap: () => _navigateTo(context, const SupportPage()),+ ),+ ],+ ),+ );+ contents.add(groupSpacing);++ contents.add(+ SettingsGroup(+ children: [+ SettingsItem(+ icon: HugeIcons.strokeRoundedInformationCircle,+ title: l10n.aboutUs,+ onTap: () => _navigateTo(context, const AboutPage()),+ ),+ ],+ ),+ );++ if (hasLoggedIn) {+ contents.add(groupSpacing);+ contents.add(+ SettingsGroup(+ children: [+ SettingsItem(+ icon: HugeIcons.strokeRoundedLogout05,+ title: l10n.logout,+ iconColor: getEnteColorScheme(context).warning400,+ textColor: getEnteColorScheme(context).warning400,+ onTap: () => _onLogoutTapped(context),+ ),+ ],+ ),+ );+ }++ contents.addAll([+ const SizedBox(height: 24),+ const SocialIconsRow(),+ const AppVersionWidget(),+ ]);++ return Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: contents,+ );+ }++ void _navigateTo(BuildContext context, Widget page) {+ Navigator.of(context).push(+ MaterialPageRoute(builder: (context) => page),+ );+ }++ void _onGeneralTapped(BuildContext context) {+ _navigateTo(context, const GeneralSettingsPage());+ }++ void _onLogoutTapped(BuildContext context) {+ showAlertBottomSheet(+ context,+ title: context.l10n.warning,+ message: context.l10n.areYouSureYouWantToLogout,+ assetPath: "assets/warning-grey.png",+ buttons: [+ GradientButton(+ buttonType: GradientButtonType.critical,+ text: context.l10n.yesLogout,+ onTap: () async {+ await UserService.instance.logout(context);+ },+ ),+ ],+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/settings/widgets/app_version_widget.dart b/mobile/apps/locker/lib/ui/settings/widgets/app_version_widget.dartnew file mode 100644index 0000000000..d285a66ade--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/widgets/app_version_widget.dart@@ -0,0 +1,77 @@+import "package:ente_ui/theme/ente_theme.dart";+import "package:ente_ui/utils/dialog_util.dart";+import "package:flutter/material.dart";+import "package:package_info_plus/package_info_plus.dart";++/// Widget that displays the app version centered at the bottom+/// with an easter egg for tapping multiple times+class AppVersionWidget extends StatefulWidget {+ const AppVersionWidget({super.key});++ @override+ State<AppVersionWidget> createState() => _AppVersionWidgetState();+}++class _AppVersionWidgetState extends State<AppVersionWidget> {+ static const _kTapThresholdForInspector = 5;+ static const _kConsecutiveTapTimeWindowInMilliseconds = 2000;+ static const _kDummyDelayDurationInMilliseconds = 1500;++ int? _lastTap;+ int _consecutiveTaps = 0;++ @override+ Widget build(BuildContext context) {+ final textTheme = getEnteTextTheme(context);+ final colorScheme = getEnteColorScheme(context);++ return GestureDetector(+ behavior: HitTestBehavior.translucent,+ onTap: () async {+ final int now = DateTime.now().millisecondsSinceEpoch;+ if (now - (_lastTap ?? now) <+ _kConsecutiveTapTimeWindowInMilliseconds) {+ _consecutiveTaps++;+ if (_consecutiveTaps == _kTapThresholdForInspector) {+ final dialog = createProgressDialog(+ context,+ "Starting network inspector...",+ );+ await dialog.show();+ await Future.delayed(+ const Duration(milliseconds: _kDummyDelayDurationInMilliseconds),+ );+ await dialog.hide();+ }+ } else {+ _consecutiveTaps = 1;+ }+ _lastTap = now;+ },+ child: FutureBuilder<String>(+ future: _getAppVersion(),+ builder: (context, snapshot) {+ if (snapshot.hasData) {+ return Padding(+ padding: const EdgeInsets.symmetric(vertical: 20),+ child: Center(+ child: Text(+ "Version ${snapshot.data!}",+ style: textTheme.mini.copyWith(+ color: colorScheme.textMuted,+ ),+ ),+ ),+ );+ }+ return const SizedBox.shrink();+ },+ ),+ );+ }++ Future<String> _getAppVersion() async {+ final pkgInfo = await PackageInfo.fromPlatform();+ return pkgInfo.version;+ }+}diff --git a/mobile/apps/locker/lib/ui/settings/widgets/settings_widget.dart b/mobile/apps/locker/lib/ui/settings/widgets/settings_widget.dartnew file mode 100644index 0000000000..2a1a82d536--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/widgets/settings_widget.dart@@ -0,0 +1,169 @@+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";++class SettingsGroup extends StatelessWidget {+ final List<Widget> children;++ const SettingsGroup({+ required this.children,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);++ return Container(+ height: 56,+ decoration: BoxDecoration(+ color: colorScheme.backdropBase,+ borderRadius: BorderRadius.circular(20),+ ),+ padding: const EdgeInsets.all(8),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.center,+ children: _buildChildrenWithSpacing(),+ ),+ );+ }++ List<Widget> _buildChildrenWithSpacing() {+ if (children.isEmpty) return [];+ if (children.length == 1) return children;++ final List<Widget> result = [];+ for (int i = 0; i < children.length; i++) {+ result.add(children[i]);+ if (i < children.length - 1) {+ result.add(const SizedBox(height: 12));+ }+ }+ return result;+ }+}++class SettingsOptionWidget extends StatelessWidget {+ final String title;+ final VoidCallback? onTap;+ final Widget? trailing;+ final Color? textColor;+ final bool showChevron;++ const SettingsOptionWidget({+ required this.title,+ this.onTap,+ this.trailing,+ this.textColor,+ this.showChevron = true,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ final borderRadius = BorderRadius.circular(20);++ return GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: onTap,+ child: Container(+ height: 64,+ decoration: BoxDecoration(+ color: colorScheme.backdropBase,+ borderRadius: borderRadius,+ ),+ padding: const EdgeInsets.all(16),+ child: Row(+ children: [+ Expanded(+ child: Text(+ title,+ style: textTheme.body.copyWith(+ color: textColor ?? colorScheme.textBase,+ ),+ ),+ ),+ if (trailing != null) trailing!,+ if (trailing == null && showChevron)+ Icon(+ Icons.chevron_right,+ color: colorScheme.textMuted,+ ),+ ],+ ),+ ),+ );+ }+}++class SettingsItem extends StatelessWidget {+ final dynamic icon;+ final String title;+ final VoidCallback? onTap;+ final Widget? trailing;+ final Color? textColor;+ final Color? iconColor;+ final bool showChevron;++ const SettingsItem({+ required this.icon,+ required this.title,+ this.onTap,+ this.trailing,+ this.textColor,+ this.iconColor,+ this.showChevron = true,+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);++ return GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: onTap,+ child: SizedBox(+ height: 40,+ child: Row(+ children: [+ Container(+ width: 40,+ height: 40,+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(12),+ ),+ child: Center(+ child: HugeIcon(+ icon: icon,+ color: iconColor ?? colorScheme.strokeBase,+ size: 24,+ ),+ ),+ ),+ const SizedBox(width: 8),+ Expanded(+ child: Text(+ title,+ style: textTheme.body.copyWith(+ color: textColor ?? colorScheme.textBase,+ ),+ ),+ ),+ if (trailing != null) trailing!,+ if (trailing == null && showChevron)+ Icon(+ Icons.chevron_right,+ color: colorScheme.textMuted,+ ),+ ],+ ),+ ),+ );+ }+}+diff --git a/mobile/apps/locker/lib/ui/settings/widgets/social_icons_row.dart b/mobile/apps/locker/lib/ui/settings/widgets/social_icons_row.dartnew file mode 100644index 0000000000..aeec900ea1--- /dev/null+++ b/mobile/apps/locker/lib/ui/settings/widgets/social_icons_row.dart@@ -0,0 +1,93 @@+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:url_launcher/url_launcher_string.dart";++/// A row of social media icon buttons+class SocialIconsRow extends StatelessWidget {+ const SocialIconsRow({super.key});++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);++ return Row(+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ _SocialIconButton(+ icon: HugeIcons.strokeRoundedDiscord,+ url: "https://ente.io/discord",+ color: colorScheme.textMuted,+ ),+ const SizedBox(width: 8),+ _SocialIconButton(+ icon: HugeIcons.strokeRoundedYoutube,+ url: "https://youtube.com/@enteio",+ color: colorScheme.textMuted,+ ),+ const SizedBox(width: 8),+ _SocialIconButton(+ icon: HugeIcons.strokeRoundedGithub,+ url: "https://github.com/ente-io",+ color: colorScheme.textMuted,+ ),+ const SizedBox(width: 8),+ _SocialIconButton(+ icon: HugeIcons.strokeRoundedNewTwitter,+ url: "https://twitter.com/enteio",+ color: colorScheme.textMuted,+ ),+ const SizedBox(width: 8),+ _SocialIconButton(+ icon: HugeIcons.strokeRoundedMastodon,+ url: "https://fosstodon.org/@ente",+ color: colorScheme.textMuted,+ ),+ const SizedBox(width: 8),+ _SocialIconButton(+ icon: HugeIcons.strokeRoundedReddit,+ url: "https://reddit.com/r/enteio",+ color: colorScheme.textMuted,+ ),+ ],+ );+ }+}++class _SocialIconButton extends StatelessWidget {+ final dynamic icon;+ final String url;+ final Color color;++ const _SocialIconButton({+ required this.icon,+ required this.url,+ required this.color,+ });++ @override+ Widget build(BuildContext context) {+ return GestureDetector(+ onTap: () {+ launchUrlString(+ url,+ mode: LaunchMode.externalApplication,+ );+ },+ child: Container(+ width: 32,+ height: 32,+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(8),+ ),+ child: Center(+ child: HugeIcon(+ icon: icon,+ color: color,+ size: 20,+ ),+ ),+ ),+ );+ }+}