π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add Auth What's new and settings search
AmanRajSinghMouryaafd19f341c98
diff --git a/mobile/apps/auth/assets/2.0x/whats_new_illustration.png b/mobile/apps/auth/assets/2.0x/whats_new_illustration.pngnew file mode 100644index 0000000000..0625a4f0e8Binary files /dev/null and b/mobile/apps/auth/assets/2.0x/whats_new_illustration.png differdiff --git a/mobile/apps/auth/assets/3.0x/whats_new_illustration.png b/mobile/apps/auth/assets/3.0x/whats_new_illustration.pngnew file mode 100644index 0000000000..14f65b7e10Binary files /dev/null and b/mobile/apps/auth/assets/3.0x/whats_new_illustration.png differdiff --git a/mobile/apps/auth/assets/whats_new_illustration.png b/mobile/apps/auth/assets/whats_new_illustration.pngnew file mode 100644index 0000000000..6c009e0f9dBinary files /dev/null and b/mobile/apps/auth/assets/whats_new_illustration.png differdiff --git a/mobile/apps/auth/changes/whats-new-settings.md b/mobile/apps/auth/changes/whats-new-settings.mdnew file mode 100644index 0000000000..bc7152024a--- /dev/null+++ b/mobile/apps/auth/changes/whats-new-settings.md@@ -0,0 +1 @@+- Added What's new to the version number, About, and settings search.diff --git a/mobile/apps/auth/lib/ui/settings/about_settings_page.dart b/mobile/apps/auth/lib/ui/settings/about_settings_page.dartindex 837f217622..6c55a4a5c4 100644--- a/mobile/apps/auth/lib/ui/settings/about_settings_page.dart+++ b/mobile/apps/auth/lib/ui/settings/about_settings_page.dart@@ -1,10 +1,13 @@import 'package:ente_auth/services/update_service.dart';import 'package:ente_auth/ui/settings/app_update_sheet.dart';import 'package:ente_auth/ui/settings/components/auth_settings_page_scaffold.dart';+import 'package:ente_auth/ui/settings/widgets/change_log_sheet.dart';import 'package:ente_auth/utils/toast_util.dart';+import 'package:ente_components/ente_components.dart';import 'package:ente_strings/ente_strings.dart';import 'package:ente_ui/components/settings/about_settings_section.dart';import 'package:flutter/material.dart';+import 'package:hugeicons/hugeicons.dart';class AboutSettingsPage extends StatelessWidget {const AboutSettingsPage({super.key});@@ -15,6 +18,13 @@ class AboutSettingsPage extends StatelessWidget {return AuthSettingsPageScaffold(title: l10n.about,children: [+ SettingsItem(+ title: l10n.whatsNew,+ icon: HugeIcons.strokeRoundedParty,+ showOnlyLoadingState: false,+ onTap: () => showChangeLogSheet(context),+ ),+ const SizedBox(height: Spacing.sm),AboutSettingsSection(onCheckForUpdates: UpdateService.instance.supportsInAppUpdates()? () => _checkForUpdates(context)diff --git a/mobile/apps/auth/lib/ui/settings/components/auth_settings_page_scaffold.dart b/mobile/apps/auth/lib/ui/settings/components/auth_settings_page_scaffold.dartindex cfdae88301..eefdaabf01 100644--- a/mobile/apps/auth/lib/ui/settings/components/auth_settings_page_scaffold.dart+++ b/mobile/apps/auth/lib/ui/settings/components/auth_settings_page_scaffold.dart@@ -10,11 +10,15 @@ class AuthSettingsPageScaffold extends StatelessWidget {required this.children,this.subtitle,this.backButton,+ this.actions = const [],});+ static const double maxContentWidth = 720;+final String title;final String? subtitle;final Widget? backButton;+ final List<Widget> actions;final List<Widget> children;@override@@ -23,13 +27,14 @@ class AuthSettingsPageScaffold extends StatelessWidget {builder: (context, constraints) {final rightPadding = math.max(Spacing.lg,- constraints.maxWidth - Spacing.lg - _maxContentWidth,+ constraints.maxWidth - Spacing.lg - maxContentWidth,);return SettingsPageScaffold(title: title,subtitle: subtitle,backButton: backButton,+ actions: actions,padding: EdgeInsets.fromLTRB(Spacing.lg, 0, rightPadding, Spacing.lg),children: children,);@@ -37,5 +42,3 @@ class AuthSettingsPageScaffold extends StatelessWidget {);}}--const double _maxContentWidth = 720;diff --git a/mobile/apps/auth/lib/ui/settings/search/settings_search_registry.dart b/mobile/apps/auth/lib/ui/settings/search/settings_search_registry.dartnew file mode 100644index 0000000000..24bafe42f9--- /dev/null+++ b/mobile/apps/auth/lib/ui/settings/search/settings_search_registry.dart@@ -0,0 +1,93 @@+import 'dart:io';++import 'package:ente_auth/core/configuration.dart';+import 'package:ente_auth/ui/settings/about_settings_page.dart';+import 'package:ente_auth/ui/settings/account_settings_page.dart';+import 'package:ente_auth/ui/settings/data/data_settings_page.dart';+import 'package:ente_auth/ui/settings/general_settings_page.dart';+import 'package:ente_auth/ui/settings/security_settings_page.dart';+import 'package:ente_auth/ui/settings/support_settings_page.dart';+import 'package:ente_auth/ui/settings/theme_settings_page.dart';+import 'package:ente_strings/ente_strings.dart';+import 'package:ente_ui/models/settings_search_item.dart';+import 'package:flutter/foundation.dart';+import 'package:flutter/material.dart';+import 'package:hugeicons/hugeicons.dart';++class SettingsSearchRegistry {+ static List<SettingsSearchItem> getSearchableItems(BuildContext context) {+ final l10n = context.strings;+ return [+ if (Configuration.instance.hasConfiguredAccount())+ SettingsSearchItem(+ title: l10n.account,+ sectionPath: l10n.account,+ icon: HugeIcons.strokeRoundedUser,+ routeBuilder: (_) => const AccountSettingsPage(),+ ),+ SettingsSearchItem(+ title: l10n.data,+ sectionPath: l10n.data,+ icon: HugeIcons.strokeRoundedDatabase01,+ routeBuilder: (_) => const DataSettingsPage(),+ ),+ SettingsSearchItem(+ title: l10n.security,+ sectionPath: l10n.security,+ icon: HugeIcons.strokeRoundedSecurityCheck,+ routeBuilder: (_) => const SecuritySettingsPage(),+ ),+ if (Platform.isAndroid ||+ Platform.isWindows ||+ Platform.isLinux ||+ kDebugMode)+ SettingsSearchItem(+ title: l10n.theme,+ sectionPath: l10n.theme,+ icon: HugeIcons.strokeRoundedSun03,+ routeBuilder: (_) => const ThemeSettingsPage(),+ ),+ SettingsSearchItem(+ title: l10n.general,+ sectionPath: l10n.general,+ icon: HugeIcons.strokeRoundedSettings01,+ routeBuilder: (_) => const GeneralSettingsPage(),+ ),+ SettingsSearchItem(+ title: l10n.support,+ sectionPath: l10n.support,+ icon: HugeIcons.strokeRoundedHelpCircle,+ routeBuilder: (_) => const SupportSettingsPage(),+ ),+ SettingsSearchItem(+ title: l10n.about,+ sectionPath: l10n.about,+ icon: HugeIcons.strokeRoundedInformationCircle,+ routeBuilder: (_) => const AboutSettingsPage(),+ ),+ SettingsSearchItem(+ title: l10n.whatsNew,+ sectionPath: l10n.about,+ icon: HugeIcons.strokeRoundedParty,+ routeBuilder: (_) => const AboutSettingsPage(),+ keywords: ['changelog', 'release notes', 'updates'],+ ),+ ];+ }++ static List<SettingsSearchSuggestion> getSuggestions(+ BuildContext context,+ List<SettingsSearchItem> items,+ ) {+ final l10n = context.strings;+ final titles = {l10n.data, l10n.security, l10n.whatsNew};+ return [+ for (final item in items)+ if (titles.contains(item.title))+ SettingsSearchSuggestion(+ title: item.title,+ routeBuilder: item.routeBuilder,+ ),+ ];+ }+}diff --git a/mobile/apps/auth/lib/ui/settings/widgets/change_log_sheet.dart b/mobile/apps/auth/lib/ui/settings/widgets/change_log_sheet.dartnew file mode 100644index 0000000000..cd2a9e771b--- /dev/null+++ b/mobile/apps/auth/lib/ui/settings/widgets/change_log_sheet.dart@@ -0,0 +1,149 @@+import "package:ente_auth/ui/settings/widgets/change_log_strings.dart";+import "package:ente_components/ente_components.dart";+import "package:ente_strings/ente_strings.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";++Future<void> showChangeLogSheet(BuildContext context) {+ final strings = ChangeLogStrings.forLocale(Localizations.localeOf(context));+ return showBottomSheetComponent<void>(+ context: context,+ builder: (_) => _ChangeLogSheet(strings: strings),+ );+}++class _ChangeLogSheet extends StatefulWidget {+ final ChangeLogStrings strings;++ const _ChangeLogSheet({required this.strings});++ @override+ State<_ChangeLogSheet> createState() => _ChangeLogSheetState();+}++class _ChangeLogSheetState extends State<_ChangeLogSheet> {+ final ScrollController _scrollController = ScrollController();++ @override+ void dispose() {+ _scrollController.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return BottomSheetComponent(+ header: _ChangeLogHeader(title: context.strings.whatsNew),+ crossAxisAlignment: CrossAxisAlignment.stretch,+ actionsTopSpacing: Spacing.lg,+ content: Flexible(+ child: ScrollbarTheme(+ data: ScrollbarTheme.of(context).copyWith(+ thumbColor: WidgetStatePropertyAll(colors.fillDarkest),+ trackColor: WidgetStatePropertyAll(colors.fillDark),+ trackBorderColor: const WidgetStatePropertyAll(Colors.transparent),+ ),+ child: Scrollbar(+ controller: _scrollController,+ thumbVisibility: true,+ trackVisibility: true,+ thickness: 5,+ radius: const Radius.circular(39),+ child: ListView.separated(+ controller: _scrollController,+ shrinkWrap: true,+ physics: const BouncingScrollPhysics(),+ padding: const EdgeInsets.only(right: Spacing.lg),+ itemBuilder: (context, index) => _ChangeLogEntryTile(+ title: widget.strings.entries[index].title,+ description: widget.strings.entries[index].description,+ ),+ separatorBuilder: (_, _) => const SizedBox(height: Spacing.lg),+ itemCount: widget.strings.entries.length,+ ),+ ),+ ),+ ),+ actions: [+ ButtonComponent(+ variant: ButtonComponentVariant.primary,+ size: ButtonComponentSize.large,+ label: context.strings.continueLabel,+ shouldSurfaceExecutionStates: false,+ onTap: () => Navigator.of(context).pop(),+ ),+ ],+ );+ }+}++class _ChangeLogEntryTile extends StatelessWidget {+ final String title;+ final String description;++ const _ChangeLogEntryTile({required this.title, required this.description});++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;++ return Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ title,+ textAlign: TextAlign.left,+ style: TextStyles.large.copyWith(color: colors.textBase),+ ),+ const SizedBox(height: Spacing.md),+ Text(+ description,+ textAlign: TextAlign.left,+ style: TextStyles.body.copyWith(color: colors.textLight),+ ),+ ],+ );+ }+}++class _ChangeLogHeader extends StatelessWidget {+ const _ChangeLogHeader({required this.title});++ final String title;++ @override+ Widget build(BuildContext context) {+ final colors = context.componentColors;+ return Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Align(+ alignment: Alignment.centerRight,+ child: IconButtonComponent(+ tooltip: context.strings.close,+ variant: IconButtonComponentVariant.circular,+ shouldSurfaceExecutionStates: false,+ icon: const HugeIcon(+ icon: HugeIcons.strokeRoundedCancel01,+ size: IconSizes.small,+ ),+ onTap: () => Navigator.of(context).pop(),+ ),+ ),+ const SizedBox(height: Spacing.xs),+ Image.asset(+ "assets/whats_new_illustration.png",+ width: 115,+ height: 108,+ ),+ const SizedBox(height: Spacing.sm),+ Text(+ title,+ textAlign: TextAlign.center,+ style: TextStyles.display2.copyWith(color: colors.textBase),+ ),+ ],+ );+ }+}diff --git a/mobile/apps/auth/lib/ui/settings/widgets/change_log_strings.dart b/mobile/apps/auth/lib/ui/settings/widgets/change_log_strings.dartnew file mode 100644index 0000000000..73780c74d1--- /dev/null+++ b/mobile/apps/auth/lib/ui/settings/widgets/change_log_strings.dart@@ -0,0 +1,40 @@+import 'dart:ui';++class ChangeLogStrings {+ final List<ChangeLogEntryStrings> entries;++ const ChangeLogStrings({required this.entries});++ static ChangeLogStrings forLocale(Locale locale) {+ final key = locale.countryCode != null && locale.countryCode!.isNotEmpty+ ? '${locale.languageCode}_${locale.countryCode}'+ : locale.languageCode;++ return _translations[key] ??+ _translations[locale.languageCode] ??+ _translations['en']!;+ }++ static const Map<String, ChangeLogStrings> _translations = {+ 'en': ChangeLogStrings(+ entries: [+ ChangeLogEntryStrings(+ title: 'Newest first',+ description: 'Show your most recently added codes first.',+ ),+ ChangeLogEntryStrings(+ title: 'Import from Open Authenticator',+ description:+ 'Bring your codes into Ente Auth from an Open Authenticator backup.',+ ),+ ],+ ),+ };+}++class ChangeLogEntryStrings {+ final String title;+ final String description;++ const ChangeLogEntryStrings({required this.title, required this.description});+}diff --git a/mobile/apps/auth/lib/ui/settings_page.dart b/mobile/apps/auth/lib/ui/settings_page.dartindex 2830ad02d0..8895d120fd 100644--- a/mobile/apps/auth/lib/ui/settings_page.dart+++ b/mobile/apps/auth/lib/ui/settings_page.dart@@ -15,9 +15,11 @@ import 'package:ente_auth/ui/settings/developer_settings_widget.dart';import 'package:ente_auth/ui/settings/general_settings_page.dart';import 'package:ente_auth/ui/settings/more_from_ente_section.dart';import 'package:ente_auth/ui/settings/notification_banner_widget.dart';+import 'package:ente_auth/ui/settings/search/settings_search_registry.dart';import 'package:ente_auth/ui/settings/security_settings_page.dart';import 'package:ente_auth/ui/settings/support_settings_page.dart';import 'package:ente_auth/ui/settings/theme_settings_page.dart';+import 'package:ente_auth/ui/settings/widgets/change_log_sheet.dart';import 'package:ente_auth/utils/dialog_util.dart';import 'package:ente_components/ente_components.dart';import 'package:ente_lock_screen/local_authentication_service.dart';@@ -26,6 +28,7 @@ import 'package:ente_ui/components/buttons/button_widget.dart';import 'package:ente_ui/components/settings/app_engagement_section.dart';import 'package:ente_ui/components/settings/app_version_widget.dart';import 'package:ente_ui/components/settings/social_icons_row.dart';+import 'package:ente_ui/pages/settings_search_page.dart';import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:hugeicons/hugeicons.dart';@@ -184,7 +187,7 @@ class SettingsPage extends StatelessWidget {const SizedBox(height: 40),const SocialIconsRow(),const SizedBox(height: Spacing.md),- const AppVersionWidget(),+ AppVersionWidget(onTap: () => showChangeLogSheet(context)),const SizedBox(height: Spacing.xxl),const DeveloperSettingsWidget(),const NotificationBannerWidget(),@@ -195,10 +198,63 @@ class SettingsPage extends StatelessWidget {title: l10n.settings,subtitle: email,backButton: _closeButton(context),+ actions: [+ IconButtonComponent(+ tooltip: l10n.searchSettings,+ variant: IconButtonComponentVariant.primary,+ shouldSurfaceExecutionStates: false,+ icon: const HugeIcon(+ icon: HugeIcons.strokeRoundedSearch01,+ size: IconSizes.small,+ ),+ onTap: () => _openSearch(context),+ ),+ ],children: contents,);}+ Future<void> _openSearch(BuildContext context) async {+ final completed = await pushAuthSettingsPage<bool>(+ context,+ Builder(+ builder: (context) {+ final items = SettingsSearchRegistry.getSearchableItems(context);+ return ColoredBox(+ color: context.componentColors.backgroundBase,+ child: Align(+ alignment: Alignment.topLeft,+ child: SizedBox(+ width:+ AuthSettingsPageScaffold.maxContentWidth + 2 * Spacing.lg,+ child: SettingsSearchPage(+ key: ValueKey(Localizations.localeOf(context)),+ items: items,+ suggestions: SettingsSearchRegistry.getSuggestions(+ context,+ items,+ ),+ onNavigate: (context, routeBuilder) async {+ final completed = await pushAuthSettingsPage<bool>(+ context,+ routeBuilder(context),+ );+ if (completed == true && context.mounted) {+ Navigator.of(context).pop(true);+ }+ },+ ),+ ),+ ),+ );+ },+ ),+ );+ if (completed == true) {+ scaffoldKey.currentState?.closeDrawer();+ }+ }+Widget _closeButton(BuildContext context) {return Semantics(identifier: 'auth_settings_close',diff --git a/mobile/apps/auth/test/ui/settings/whats_new_test.dart b/mobile/apps/auth/test/ui/settings/whats_new_test.dartnew file mode 100644index 0000000000..1fa98b6c33--- /dev/null+++ b/mobile/apps/auth/test/ui/settings/whats_new_test.dart@@ -0,0 +1,396 @@+import 'dart:io';++import 'package:dio/dio.dart';+import 'package:ente_auth/core/configuration.dart';+import 'package:ente_auth/services/preference_service.dart';+import 'package:ente_auth/ui/settings/about_settings_page.dart';+import 'package:ente_auth/ui/settings/data/data_settings_page.dart';+import 'package:ente_auth/ui/settings_page.dart';+import 'package:ente_components/ente_components.dart';+import 'package:ente_network/network.dart';+import 'package:ente_strings/ente_strings.dart';+import 'package:ente_ui/pages/settings_search_page.dart';+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_secure_storage/flutter_secure_storage.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:package_info_plus/package_info_plus.dart';+import 'package:shared_preferences/shared_preferences.dart';++void main() {+ TestWidgetsFlutterBinding.ensureInitialized();+ late Directory directory;++ setUpAll(() async {+ directory = await Directory.systemTemp.createTemp('auth_whats_new_');+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger+ .setMockMethodCallHandler(+ const MethodChannel('plugins.flutter.io/path_provider'),+ (_) async => directory.path,+ );+ FlutterSecureStorage.setMockInitialValues({});+ SharedPreferences.setMockInitialValues({});+ PackageInfo.setMockInitialValues(+ appName: 'Ente Auth',+ packageName: 'io.ente.auth',+ version: '4.4.27',+ buildNumber: '1007',+ buildSignature: '',+ );+ await Configuration.instance.init([]);+ await PreferenceService.instance.init();+ await Network.instance.init(Configuration.instance);+ // Settings already refreshes account details. Simulate no connectivity.+ Network.instance.enteDio.interceptors.add(+ InterceptorsWrapper(+ onRequest: (options, handler) => handler.reject(+ DioException(+ requestOptions: options,+ type: DioExceptionType.connectionError,+ ),+ ),+ ),+ );+ });++ tearDownAll(() async {+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger+ .setMockMethodCallHandler(+ const MethodChannel('plugins.flutter.io/path_provider'),+ null,+ );+ await directory.delete(recursive: true);+ });++ for (final signedIn in [false, true]) {+ group(signedIn ? 'signed in without internet' : 'offline mode', () {+ setUp(() async {+ await Configuration.instance.logout();+ if (signedIn) {+ await Configuration.instance.setKey('dGVzdA==');+ await Configuration.instance.setToken('test-token');+ }+ expect(Configuration.instance.hasConfiguredAccount(), signedIn);+ });++ testWidgets('version opens the changelog and can reopen it', (+ tester,+ ) async {+ await _pumpSettings(tester);+ await tester.scrollUntilVisible(find.text('Version 4.4.27'), 350);+ await tester.tap(find.text('Version 4.4.27'));+ await tester.pumpAndSettle();+ _expectChangeLog();+ await tester.tap(find.text('Continue'));+ await tester.pumpAndSettle();+ expect(find.text('Newest first'), findsNothing);+ await tester.tap(find.text('Version 4.4.27'));+ await tester.pumpAndSettle();+ _expectChangeLog();+ });++ testWidgets('About opens the changelog without a loading animation', (+ tester,+ ) async {+ await _pumpSettings(tester);+ await tester.scrollUntilVisible(find.text('About'), 250);+ await tester.tap(find.text('About'));+ await tester.pumpAndSettle();+ final row = tester.widget<SettingsItem>(+ find.widgetWithText(SettingsItem, "What's new"),+ );+ expect(row.showOnlyLoadingState, isFalse);+ await tester.tap(find.text("What's new"));+ await tester.pump(const Duration(milliseconds: 350));+ expect(find.byType(CircularProgressIndicator), findsNothing);+ await tester.pumpAndSettle();+ _expectChangeLog();+ await tester.tap(find.byTooltip('Close'));+ await tester.pumpAndSettle();+ expect(find.byType(AboutSettingsPage), findsOneWidget);+ expect(find.text('Newest first'), findsNothing);+ });++ testWidgets('search finds release notes and respects account mode', (+ tester,+ ) async {+ await _pumpSettings(tester);+ await tester.tap(find.byTooltip('Search settings'));+ await tester.pumpAndSettle();+ for (final query in [+ "What's new",+ 'changelog',+ 'release notes',+ 'updates',+ ' RELEASE NOTES ',+ ]) {+ await tester.enterText(find.byType(TextField), query);+ await tester.pumpAndSettle();+ expect(+ find.widgetWithText(MenuComponent, "What's new"),+ findsOneWidget,+ );+ }+ await tester.tap(find.text("What's new"));+ await tester.pumpAndSettle();+ expect(find.byType(AboutSettingsPage), findsOneWidget);+ await tester.tap(find.text("What's new"));+ await tester.pumpAndSettle();+ _expectChangeLog();+ await tester.tap(find.text('Continue'));+ await tester.pumpAndSettle();+ await tester.tap(find.byIcon(Icons.arrow_back));+ await tester.pumpAndSettle();+ await tester.enterText(find.byType(TextField), 'Account');+ await tester.pumpAndSettle();+ expect(+ find.widgetWithText(MenuComponent, 'Account'),+ signedIn ? findsOneWidget : findsNothing,+ );+ await tester.enterText(find.byType(TextField), 'no matching setting');+ await tester.pumpAndSettle();+ expect(find.text('No results found'), findsOneWidget);+ expect(find.text("What's new"), findsNothing);++ for (final section in [+ 'Data',+ 'Security',+ 'Theme',+ 'General',+ 'Support',+ 'About',+ ]) {+ await tester.enterText(find.byType(TextField), section);+ await tester.pumpAndSettle();+ expect(find.widgetWithText(SettingsItem, section), findsWidgets);+ }+ await tester.enterText(find.byType(TextField), '');+ await tester.pumpAndSettle();+ expect(find.text('Suggestions'), findsOneWidget);+ await tester.tap(find.text("What's new"));+ await tester.pumpAndSettle();+ expect(find.byType(AboutSettingsPage), findsOneWidget);+ });+ });+ }++ for (final completed in [false, true]) {+ testWidgets('search closes the drawer only after completion: $completed', (+ tester,+ ) async {+ final scaffoldKey = GlobalKey<ScaffoldState>();+ final emailNotifier = ValueNotifier<String?>(null);+ addTearDown(emailNotifier.dispose);+ await tester.pumpWidget(+ MaterialApp(+ theme: ComponentTheme.lightTheme(app: ComponentApp.auth),+ localizationsDelegates: StringsLocalizations.localizationsDelegates,+ supportedLocales: StringsLocalizations.supportedLocales,+ home: Scaffold(+ key: scaffoldKey,+ drawer: Drawer(+ width: 428,+ child: SettingsPage(+ emailNotifier: emailNotifier,+ scaffoldKey: scaffoldKey,+ ),+ ),+ ),+ ),+ );+ scaffoldKey.currentState!.openDrawer();+ await tester.pumpAndSettle();+ await tester.tap(find.byTooltip('Search settings'));+ await tester.pumpAndSettle();+ await tester.enterText(find.byType(TextField), 'Data');+ await tester.pumpAndSettle();+ await tester.tap(find.widgetWithText(MenuComponent, 'Data'));+ await tester.pumpAndSettle();+ Navigator.of(+ tester.element(find.byType(DataSettingsPage)),+ ).pop(completed ? true : null);+ await tester.pumpAndSettle();+ expect(scaffoldKey.currentState!.isDrawerOpen, !completed);+ expect(+ find.byType(SettingsSearchPage),+ completed ? findsNothing : findsOneWidget,+ );+ });+ }++ testWidgets('search refreshes when language and theme change', (+ tester,+ ) async {+ var locale = const Locale('en');+ var dark = false;+ late StateSetter updateApp;+ final emailNotifier = ValueNotifier<String?>(null);+ addTearDown(emailNotifier.dispose);+ await tester.pumpWidget(+ StatefulBuilder(+ builder: (context, setState) {+ updateApp = setState;+ return MaterialApp(+ locale: locale,+ theme: dark+ ? ComponentTheme.darkTheme(app: ComponentApp.auth)+ : ComponentTheme.lightTheme(app: ComponentApp.auth),+ localizationsDelegates: StringsLocalizations.localizationsDelegates,+ supportedLocales: StringsLocalizations.supportedLocales,+ home: SettingsPage(+ emailNotifier: emailNotifier,+ scaffoldKey: GlobalKey<ScaffoldState>(),+ ),+ );+ },+ ),+ );+ await tester.pumpAndSettle();+ await tester.tap(find.byTooltip('Search settings'));+ await tester.pumpAndSettle();+ await tester.enterText(find.byType(TextField), 'release notes');+ await tester.pumpAndSettle();+ updateApp(() {+ locale = const Locale('fr');+ dark = true;+ });+ await tester.pumpAndSettle();+ final search = find.byType(SettingsSearchPage);+ final context = tester.element(search);+ expect(+ tester.widget<TextField>(find.byType(TextField)).controller!.text,+ '',+ );+ expect(find.text(context.strings.suggestions), findsOneWidget);+ expect(find.text(context.strings.data), findsOneWidget);+ expect(find.text(context.strings.security), findsOneWidget);+ expect(find.text(context.strings.whatsNew), findsOneWidget);+ final background = tester.widget<ColoredBox>(+ find.ancestor(of: search, matching: find.byType(ColoredBox)).first,+ );+ expect(background.color, context.componentColors.backgroundBase);+ expect(Theme.of(context).brightness, Brightness.dark);+ await tester.enterText(find.byType(TextField), context.strings.data);+ await tester.pumpAndSettle();+ expect(+ find.widgetWithText(MenuComponent, context.strings.data),+ findsOneWidget,+ );+ });++ testWidgets('search keeps Auth settings width in a desktop window', (+ tester,+ ) async {+ tester.view.physicalSize = const Size(1440, 900);+ tester.view.devicePixelRatio = 1;+ addTearDown(tester.view.resetPhysicalSize);+ addTearDown(tester.view.resetDevicePixelRatio);+ await _pumpSettings(tester);+ await tester.tap(find.byTooltip('Search settings'));+ await tester.pumpAndSettle();+ expect(+ tester.getSize(find.byType(TextField)).width,+ lessThanOrEqualTo(720),+ );+ await tester.enterText(find.byType(TextField), 'Data');+ await tester.pumpAndSettle();+ expect(+ tester.getSize(find.widgetWithText(MenuComponent, 'Data')).width,+ lessThanOrEqualTo(720),+ );+ await tester.enterText(find.byType(TextField), "What's new");+ await tester.pumpAndSettle();+ await tester.tap(find.widgetWithText(MenuComponent, "What's new"));+ await tester.pumpAndSettle();+ await tester.tap(find.text("What's new"));+ await tester.pumpAndSettle();+ expect(find.byType(Dialog), findsOneWidget);+ _expectChangeLog();+ expect(tester.takeException(), isNull);+ await tester.tap(find.byTooltip('Close'));+ await tester.pumpAndSettle();+ expect(find.byType(Dialog), findsNothing);+ }, variant: TargetPlatformVariant.only(TargetPlatform.windows));++ for (final ratio in [2.0, 3.0]) {+ testWidgets('changelog uses the ${ratio}x illustration', (tester) async {+ final key = await const AssetImage(+ 'assets/whats_new_illustration.png',+ ).obtainKey(ImageConfiguration(devicePixelRatio: ratio));+ expect(key.name, 'assets/${ratio}x/whats_new_illustration.png');+ });+ }++ testWidgets('changelog scrolls on a small screen with large text', (+ tester,+ ) async {+ tester.view.physicalSize = const Size(320, 568);+ tester.view.devicePixelRatio = 1;+ addTearDown(tester.view.resetPhysicalSize);+ addTearDown(tester.view.resetDevicePixelRatio);+ await tester.pumpWidget(+ MaterialApp(+ theme: ComponentTheme.lightTheme(app: ComponentApp.auth),+ localizationsDelegates: StringsLocalizations.localizationsDelegates,+ supportedLocales: StringsLocalizations.supportedLocales,+ builder: (context, child) => MediaQuery(+ data: MediaQuery.of(+ context,+ ).copyWith(textScaler: const TextScaler.linear(2)),+ child: child!,+ ),+ home: const AboutSettingsPage(),+ ),+ );+ await tester.pumpAndSettle();+ await tester.tap(find.text("What's new"));+ await tester.pumpAndSettle();+ expect(tester.takeException(), isNull);+ await tester.scrollUntilVisible(+ find.text(+ 'Bring your codes into Ente Auth from an Open Authenticator backup.',+ ),+ 100,+ scrollable: find.descendant(+ of: find.byType(BottomSheetComponent),+ matching: find.byType(Scrollable),+ ),+ );+ expect(tester.takeException(), isNull);+ await tester.tap(find.text('Continue'));+ await tester.pumpAndSettle();+ expect(find.byType(BottomSheetComponent), findsNothing);+ });+}++Future<void> _pumpSettings(WidgetTester tester) async {+ final emailNotifier = ValueNotifier<String?>(null);+ addTearDown(emailNotifier.dispose);+ await tester.pumpWidget(+ MaterialApp(+ theme: ComponentTheme.lightTheme(app: ComponentApp.auth),+ localizationsDelegates: StringsLocalizations.localizationsDelegates,+ supportedLocales: StringsLocalizations.supportedLocales,+ home: SettingsPage(+ emailNotifier: emailNotifier,+ scaffoldKey: GlobalKey<ScaffoldState>(),+ ),+ ),+ );+ await tester.pumpAndSettle();+}++void _expectChangeLog() {+ expect(find.text('Newest first'), findsOneWidget);+ expect(+ find.text('Show your most recently added codes first.'),+ findsOneWidget,+ );+ expect(find.text('Import from Open Authenticator'), findsOneWidget);+ expect(+ find.text(+ 'Bring your codes into Ente Auth from an Open Authenticator backup.',+ ),+ findsOneWidget,+ );+}