From 2d4fbc633e7e1f61cfc25ba1f1dbfe217e3606ab Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Thu, 12 Mar 2026 03:41:03 +0100 Subject: [PATCH] move experimental settings --- .../screens/advanced_settings.dart | 90 +++++++++++++++++++ .../screens/privacy_security_settings.dart | 68 -------------- 2 files changed, 90 insertions(+), 68 deletions(-) diff --git a/app/lib/features/settings/presentation/screens/advanced_settings.dart b/app/lib/features/settings/presentation/screens/advanced_settings.dart index f4e25084..cc8bd479 100644 --- a/app/lib/features/settings/presentation/screens/advanced_settings.dart +++ b/app/lib/features/settings/presentation/screens/advanced_settings.dart @@ -35,6 +35,7 @@ import 'package:weblibre/features/settings/presentation/dialogs/user_agent_resta import 'package:weblibre/features/settings/presentation/widgets/custom_list_tile.dart'; import 'package:weblibre/features/settings/presentation/widgets/sections.dart'; import 'package:weblibre/features/user/data/models/engine_settings.dart'; +import 'package:weblibre/features/user/domain/presentation/dialogs/quit_browser_dialog.dart'; import 'package:weblibre/features/user/domain/providers.dart'; import 'package:weblibre/features/user/domain/repositories/cache.dart'; import 'package:weblibre/features/user/domain/repositories/engine_settings.dart'; @@ -57,6 +58,7 @@ class AdvancedSettingsScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 12.0), children: const [ _ContentBehaviorSection(), + _ExperimentalSection(), _ExtensionsSection(), _StorageDebuggingSection(), _ResetSection(), @@ -100,6 +102,21 @@ class _ExtensionsSection extends StatelessWidget { } } +class _ExperimentalSection extends StatelessWidget { + const _ExperimentalSection(); + + @override + Widget build(BuildContext context) { + return const Column( + children: [ + SettingSection(name: 'Experimental'), + _IsolatedProcessEnabledTile(), + _AppZygoteProcessEnabledTile(), + ], + ); + } +} + class _InstallLocalAddonTile extends StatelessWidget { const _InstallLocalAddonTile(); @@ -286,6 +303,72 @@ class _EnterpriseRootsTile extends HookConsumerWidget { } } +class _IsolatedProcessEnabledTile extends HookConsumerWidget { + const _IsolatedProcessEnabledTile(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final isolatedProcessEnabled = ref.watch( + engineSettingsWithDefaultsProvider.select( + (s) => s.isolatedProcessEnabled, + ), + ); + + return SwitchListTile.adaptive( + title: const Text('Isolated Content Process'), + subtitle: const Text( + 'Run web content in an isolated process. Requires app restart.', + ), + secondary: const Icon(MdiIcons.shieldCheck), + value: isolatedProcessEnabled, + onChanged: (value) async { + await ref + .read(saveEngineSettingsControllerProvider.notifier) + .save( + (currentSettings) => + currentSettings.copyWith.isolatedProcessEnabled(value), + ); + if (context.mounted) { + await _showRestartDialog(context, ref); + } + }, + ); + } +} + +class _AppZygoteProcessEnabledTile extends HookConsumerWidget { + const _AppZygoteProcessEnabledTile(); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final appZygoteProcessEnabled = ref.watch( + engineSettingsWithDefaultsProvider.select( + (s) => s.appZygoteProcessEnabled, + ), + ); + + return SwitchListTile.adaptive( + title: const Text('App Zygote Process'), + subtitle: const Text( + 'Preload content service via App Zygote for faster isolated process startup. Requires Android 10+ and app restart.', + ), + secondary: const Icon(MdiIcons.rocketLaunch), + value: appZygoteProcessEnabled, + onChanged: (value) async { + await ref + .read(saveEngineSettingsControllerProvider.notifier) + .save( + (currentSettings) => + currentSettings.copyWith.appZygoteProcessEnabled(value), + ); + if (context.mounted) { + await _showRestartDialog(context, ref); + } + }, + ); + } +} + class _IconCacheTile extends HookConsumerWidget { const _IconCacheTile(); @@ -428,3 +511,10 @@ class _ResetUITile extends ConsumerWidget { ); } } + +Future _showRestartDialog(BuildContext context, WidgetRef ref) async { + final result = await showQuitBrowserDialog(context); + if (result == true && context.mounted) { + await exitApp(ProviderScope.containerOf(context)); + } +} diff --git a/app/lib/features/settings/presentation/screens/privacy_security_settings.dart b/app/lib/features/settings/presentation/screens/privacy_security_settings.dart index f0553d34..26224bc6 100644 --- a/app/lib/features/settings/presentation/screens/privacy_security_settings.dart +++ b/app/lib/features/settings/presentation/screens/privacy_security_settings.dart @@ -204,8 +204,6 @@ class _AdvancedSection extends StatelessWidget { SettingSection(name: 'Advanced'), _WebEngineHardeningTile(), _FissionEnabledTile(), - _IsolatedProcessEnabledTile(), - _AppZygoteProcessEnabledTile(), _ExtensionsWebAPIEnabledTile(), ], ); @@ -774,72 +772,6 @@ class _FissionEnabledTile extends HookConsumerWidget { } } -class _IsolatedProcessEnabledTile extends HookConsumerWidget { - const _IsolatedProcessEnabledTile(); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final isolatedProcessEnabled = ref.watch( - engineSettingsWithDefaultsProvider.select( - (s) => s.isolatedProcessEnabled, - ), - ); - - return SwitchListTile.adaptive( - title: const Text('Isolated Content Process'), - subtitle: const Text( - 'Run web content in an isolated process. Requires app restart.', - ), - secondary: const Icon(MdiIcons.shieldCheck), - value: isolatedProcessEnabled, - onChanged: (value) async { - await ref - .read(saveEngineSettingsControllerProvider.notifier) - .save( - (currentSettings) => - currentSettings.copyWith.isolatedProcessEnabled(value), - ); - if (context.mounted) { - await _showRestartDialog(context, ref); - } - }, - ); - } -} - -class _AppZygoteProcessEnabledTile extends HookConsumerWidget { - const _AppZygoteProcessEnabledTile(); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final appZygoteProcessEnabled = ref.watch( - engineSettingsWithDefaultsProvider.select( - (s) => s.appZygoteProcessEnabled, - ), - ); - - return SwitchListTile.adaptive( - title: const Text('App Zygote Process'), - subtitle: const Text( - 'Preload content service via App Zygote for faster isolated process startup. Requires Android 10+ and app restart.', - ), - secondary: const Icon(MdiIcons.rocketLaunch), - value: appZygoteProcessEnabled, - onChanged: (value) async { - await ref - .read(saveEngineSettingsControllerProvider.notifier) - .save( - (currentSettings) => - currentSettings.copyWith.appZygoteProcessEnabled(value), - ); - if (context.mounted) { - await _showRestartDialog(context, ref); - } - }, - ); - } -} - class _ExtensionsWebAPIEnabledTile extends HookConsumerWidget { const _ExtensionsWebAPIEnabledTile();