add setting to block http protocol

This commit is contained in:
Fabian Freund
2024-06-25 15:43:54 +02:00
parent d2f55400aa
commit e20ed23c76
7 changed files with 56 additions and 2 deletions
@@ -34,6 +34,7 @@ class SettingsRepository extends _$SettingsRepository {
static const _javascriptStorageKey = 'b4ng_settings_js';
static const _launchExternalStorageKey = 'b4ng_settings_launch_external';
static const _contentBlockingStorageKey = 'b4ng_settings_content_blocking';
static const _blockHttpProtocolStorageKey = 'b4ng_settings_block_http';
static const _enableHostListStorageKey = 'b4ng_settings_host_lists';
static const _themeModeStorageKey = 'b4ng_settings_theme_mode';
@@ -96,6 +97,13 @@ class SettingsRepository extends _$SettingsRepository {
);
}
if (newSettings.blockHttpProtocol != oldSettings.blockHttpProtocol) {
await sharedPreferences.setBool(
_blockHttpProtocolStorageKey,
newSettings.blockHttpProtocol,
);
}
if (!const DeepCollectionEquality.unordered().equals(
newSettings.enableHostList,
oldSettings.enableHostList,
@@ -130,6 +138,8 @@ class SettingsRepository extends _$SettingsRepository {
launchUrlExternal: sharedPreferences.getBool(_launchExternalStorageKey),
enableContentBlocking:
sharedPreferences.getBool(_contentBlockingStorageKey),
blockHttpProtocol:
sharedPreferences.getBool(_blockHttpProtocolStorageKey),
enableHostList: _parseHostSources(
sharedPreferences.getStringList(_enableHostListStorageKey),
),
@@ -7,7 +7,7 @@ part of 'settings_repository.dart';
// **************************************************************************
String _$settingsRepositoryHash() =>
r'2fed76bdc3132729f1018f8e4c9d493ee11831a0';
r'ac2b1ecddd82e45e901425e9e5fcb9b4b61855fa';
/// See also [SettingsRepository].
@ProviderFor(SettingsRepository)