diff --git a/app/lib/features/settings/presentation/screens/developer_settings.dart b/app/lib/features/settings/presentation/screens/developer_settings.dart index 6804c453..7b70f55f 100644 --- a/app/lib/features/settings/presentation/screens/developer_settings.dart +++ b/app/lib/features/settings/presentation/screens/developer_settings.dart @@ -118,6 +118,22 @@ class DeveloperSettingsScreen extends HookConsumerWidget { }, ), ), + SwitchListTile.adaptive( + title: const Text('Use third party CA certificates'), + subtitle: const Text( + 'Allows the use of third party certificates from the Android CA store', + ), + secondary: const Icon(MdiIcons.certificate), + value: engineSettings.enterpriseRootsEnabled, + onChanged: (value) async { + await ref + .read(saveEngineSettingsControllerProvider.notifier) + .save( + (currentSettings) => currentSettings.copyWith + .enterpriseRootsEnabled(value), + ); + }, + ), CustomListTile( title: 'Error Logs', subtitle: 'Copy logs for issue reporting', diff --git a/app/lib/features/user/data/models/engine_settings.dart b/app/lib/features/user/data/models/engine_settings.dart index a36ced0b..bfd1f190 100644 --- a/app/lib/features/user/data/models/engine_settings.dart +++ b/app/lib/features/user/data/models/engine_settings.dart @@ -53,6 +53,8 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { @override WebContentIsolationStrategy get webContentIsolationStrategy => super.webContentIsolationStrategy!; + @override + bool get enterpriseRootsEnabled => super.enterpriseRootsEnabled!; final QueryParameterStripping queryParameterStripping; @@ -80,6 +82,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { required super.cookieBannerHandlingGlobalRulesSubFrames, required super.webContentIsolationStrategy, required super.userAgent, + required super.enterpriseRootsEnabled, required this.queryParameterStripping, required this.bounceTrackingProtectionMode, }); @@ -98,6 +101,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { QueryParameterStripping? queryParameterStripping, BounceTrackingProtectionMode? bounceTrackingProtectionMode, super.userAgent, + bool? enterpriseRootsEnabled, }) : queryParameterStripping = queryParameterStripping ?? QueryParameterStripping.disabled, bounceTrackingProtectionMode = @@ -122,6 +126,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { webContentIsolationStrategy: webContentIsolationStrategy ?? WebContentIsolationStrategy.isolateHighValue, + enterpriseRootsEnabled: enterpriseRootsEnabled ?? false, ); factory EngineSettings.fromJson(Map json) => @@ -144,5 +149,6 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable { super.userAgent, queryParameterStripping, bounceTrackingProtectionMode, + super.enterpriseRootsEnabled, ]; } diff --git a/app/lib/features/user/data/models/engine_settings.g.dart b/app/lib/features/user/data/models/engine_settings.g.dart index d69e4d85..3e11fa19 100644 --- a/app/lib/features/user/data/models/engine_settings.g.dart +++ b/app/lib/features/user/data/models/engine_settings.g.dart @@ -41,6 +41,8 @@ abstract class _$EngineSettingsCWProxy { EngineSettings userAgent(String? userAgent); + EngineSettings enterpriseRootsEnabled(bool? enterpriseRootsEnabled); + EngineSettings queryParameterStripping( QueryParameterStripping queryParameterStripping, ); @@ -67,6 +69,7 @@ abstract class _$EngineSettingsCWProxy { bool? cookieBannerHandlingGlobalRulesSubFrames, WebContentIsolationStrategy? webContentIsolationStrategy, String? userAgent, + bool? enterpriseRootsEnabled, QueryParameterStripping queryParameterStripping, BounceTrackingProtectionMode bounceTrackingProtectionMode, }); @@ -134,6 +137,10 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy { @override EngineSettings userAgent(String? userAgent) => this(userAgent: userAgent); + @override + EngineSettings enterpriseRootsEnabled(bool? enterpriseRootsEnabled) => + this(enterpriseRootsEnabled: enterpriseRootsEnabled); + @override EngineSettings queryParameterStripping( QueryParameterStripping queryParameterStripping, @@ -165,6 +172,7 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy { const $CopyWithPlaceholder(), Object? webContentIsolationStrategy = const $CopyWithPlaceholder(), Object? userAgent = const $CopyWithPlaceholder(), + Object? enterpriseRootsEnabled = const $CopyWithPlaceholder(), Object? queryParameterStripping = const $CopyWithPlaceholder(), Object? bounceTrackingProtectionMode = const $CopyWithPlaceholder(), }) { @@ -223,6 +231,11 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy { ? _value.userAgent // ignore: cast_nullable_to_non_nullable : userAgent as String?, + enterpriseRootsEnabled: + enterpriseRootsEnabled == const $CopyWithPlaceholder() + ? _value.enterpriseRootsEnabled + // ignore: cast_nullable_to_non_nullable + : enterpriseRootsEnabled as bool?, queryParameterStripping: queryParameterStripping == const $CopyWithPlaceholder() ? _value.queryParameterStripping @@ -288,6 +301,7 @@ EngineSettings _$EngineSettingsFromJson(Map json) => json['bounceTrackingProtectionMode'], ), userAgent: json['userAgent'] as String?, + enterpriseRootsEnabled: json['enterpriseRootsEnabled'] as bool?, ); Map _$EngineSettingsToJson( @@ -311,6 +325,7 @@ Map _$EngineSettingsToJson( 'webContentIsolationStrategy': _$WebContentIsolationStrategyEnumMap[instance .webContentIsolationStrategy]!, + 'enterpriseRootsEnabled': instance.enterpriseRootsEnabled, 'queryParameterStripping': _$QueryParameterStrippingEnumMap[instance.queryParameterStripping]!, 'bounceTrackingProtectionMode': diff --git a/app/lib/features/user/domain/repositories/engine_settings.dart b/app/lib/features/user/domain/repositories/engine_settings.dart index be8dbcf5..d19ecb0a 100644 --- a/app/lib/features/user/domain/repositories/engine_settings.dart +++ b/app/lib/features/user/domain/repositories/engine_settings.dart @@ -90,6 +90,10 @@ class EngineSettingsRepository extends _$EngineSettingsRepository { ), 'bounceTrackingProtectionMode': settings['bounceTrackingProtectionMode'] ?.readAs(DriftSqlType.string, db.typeMapping), + 'enterpriseRootsEnabled': settings['enterpriseRootsEnabled']?.readAs( + DriftSqlType.bool, + db.typeMapping, + ), }); } diff --git a/app/lib/features/user/domain/repositories/engine_settings.g.dart b/app/lib/features/user/domain/repositories/engine_settings.g.dart index a06c86dd..921f2c2b 100644 --- a/app/lib/features/user/domain/repositories/engine_settings.g.dart +++ b/app/lib/features/user/domain/repositories/engine_settings.g.dart @@ -26,7 +26,7 @@ final engineSettingsWithDefaultsProvider = // ignore: unused_element typedef EngineSettingsWithDefaultsRef = AutoDisposeProviderRef; String _$engineSettingsRepositoryHash() => - r'aa522c35377280c451f6ac9e5f7063eab7ba6efc'; + r'd0c2fbe060b5eaee7189f6cb0dd58c97cf5987b5'; /// See also [EngineSettingsRepository]. @ProviderFor(EngineSettingsRepository) diff --git a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/api/GeckoEngineSettingsApiImpl.kt b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/api/GeckoEngineSettingsApiImpl.kt index 23ea5c35..bf71bc36 100644 --- a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/api/GeckoEngineSettingsApiImpl.kt +++ b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/api/GeckoEngineSettingsApiImpl.kt @@ -129,6 +129,9 @@ class GeckoEngineSettingsApiImpl : GeckoEngineSettingsApi { //TODO: Add bounce tracking protection when available } + if(settings.enterpriseRootsEnabled != null) { + components.core.engineSettings.enterpriseRootsEnabled = settings.enterpriseRootsEnabled; + } } override fun updateRuntimeSettings(settings: GeckoEngineSettings) { @@ -197,6 +200,10 @@ class GeckoEngineSettingsApiImpl : GeckoEngineSettingsApi { reloadSession = true } + if(settings.enterpriseRootsEnabled != null) { + components.core.engine.settings.enterpriseRootsEnabled = components.core.engineSettings.enterpriseRootsEnabled + reloadSession = true + } if(reloadSession) { components.useCases.sessionUseCases.reload() diff --git a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/pigeons/Gecko.g.kt b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/pigeons/Gecko.g.kt index 4222bbe1..8429e87d 100644 --- a/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/pigeons/Gecko.g.kt +++ b/packages/flutter_mozilla_components/android/src/main/kotlin/eu/weblibre/flutter_mozilla_components/pigeons/Gecko.g.kt @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v26.0.0), do not edit directly. +// Autogenerated from Pigeon (v26.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") @@ -1542,7 +1542,8 @@ data class GeckoEngineSettings ( val cookieBannerHandlingGlobalRulesSubFrames: Boolean? = null, val webContentIsolationStrategy: WebContentIsolationStrategy? = null, val userAgent: String? = null, - val contentBlocking: ContentBlocking? = null + val contentBlocking: ContentBlocking? = null, + val enterpriseRootsEnabled: Boolean? = null ) { companion object { @@ -1559,7 +1560,8 @@ data class GeckoEngineSettings ( val webContentIsolationStrategy = pigeonVar_list[9] as WebContentIsolationStrategy? val userAgent = pigeonVar_list[10] as String? val contentBlocking = pigeonVar_list[11] as ContentBlocking? - return GeckoEngineSettings(javascriptEnabled, trackingProtectionPolicy, httpsOnlyMode, globalPrivacyControlEnabled, preferredColorScheme, cookieBannerHandlingMode, cookieBannerHandlingModePrivateBrowsing, cookieBannerHandlingGlobalRules, cookieBannerHandlingGlobalRulesSubFrames, webContentIsolationStrategy, userAgent, contentBlocking) + val enterpriseRootsEnabled = pigeonVar_list[12] as Boolean? + return GeckoEngineSettings(javascriptEnabled, trackingProtectionPolicy, httpsOnlyMode, globalPrivacyControlEnabled, preferredColorScheme, cookieBannerHandlingMode, cookieBannerHandlingModePrivateBrowsing, cookieBannerHandlingGlobalRules, cookieBannerHandlingGlobalRulesSubFrames, webContentIsolationStrategy, userAgent, contentBlocking, enterpriseRootsEnabled) } } fun toList(): List { @@ -1576,6 +1578,7 @@ data class GeckoEngineSettings ( webContentIsolationStrategy, userAgent, contentBlocking, + enterpriseRootsEnabled, ) } override fun equals(other: Any?): Boolean { diff --git a/packages/flutter_mozilla_components/lib/src/pigeons/gecko.g.dart b/packages/flutter_mozilla_components/lib/src/pigeons/gecko.g.dart index 6a6ab20e..a4a2ff0f 100644 --- a/packages/flutter_mozilla_components/lib/src/pigeons/gecko.g.dart +++ b/packages/flutter_mozilla_components/lib/src/pigeons/gecko.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v26.0.0), do not edit directly. +// Autogenerated from Pigeon (v26.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -1880,6 +1880,7 @@ class GeckoEngineSettings { this.webContentIsolationStrategy, this.userAgent, this.contentBlocking, + this.enterpriseRootsEnabled, }); bool? javascriptEnabled; @@ -1906,6 +1907,8 @@ class GeckoEngineSettings { ContentBlocking? contentBlocking; + bool? enterpriseRootsEnabled; + List _toList() { return [ javascriptEnabled, @@ -1920,6 +1923,7 @@ class GeckoEngineSettings { webContentIsolationStrategy, userAgent, contentBlocking, + enterpriseRootsEnabled, ]; } @@ -1941,6 +1945,7 @@ class GeckoEngineSettings { webContentIsolationStrategy: result[9] as WebContentIsolationStrategy?, userAgent: result[10] as String?, contentBlocking: result[11] as ContentBlocking?, + enterpriseRootsEnabled: result[12] as bool?, ); } diff --git a/packages/flutter_mozilla_components/pigeons/gecko.dart b/packages/flutter_mozilla_components/pigeons/gecko.dart index 41b162e2..11cf719c 100644 --- a/packages/flutter_mozilla_components/pigeons/gecko.dart +++ b/packages/flutter_mozilla_components/pigeons/gecko.dart @@ -592,6 +592,7 @@ class GeckoEngineSettings { final WebContentIsolationStrategy? webContentIsolationStrategy; final String? userAgent; final ContentBlocking? contentBlocking; + final bool? enterpriseRootsEnabled; GeckoEngineSettings( this.javascriptEnabled, @@ -606,6 +607,7 @@ class GeckoEngineSettings { this.webContentIsolationStrategy, this.userAgent, this.contentBlocking, + this.enterpriseRootsEnabled, ); }