remove deprecated content blocking
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lensai/features/content_block/data/models/host.dart';
|
||||
import 'package:lensai/features/kagi/data/entities/modes.dart';
|
||||
|
||||
part 'settings.g.dart';
|
||||
@@ -13,9 +12,7 @@ class Settings with FastEquatable {
|
||||
final bool incognitoMode;
|
||||
final bool enableJavascript;
|
||||
final bool launchUrlExternal;
|
||||
final bool enableContentBlocking;
|
||||
final bool blockHttpProtocol;
|
||||
final Set<HostSource> enableHostList;
|
||||
final ThemeMode themeMode;
|
||||
final KagiTool? quickAction;
|
||||
final bool quickActionVoiceInput;
|
||||
@@ -27,9 +24,7 @@ class Settings with FastEquatable {
|
||||
required this.incognitoMode,
|
||||
required this.enableJavascript,
|
||||
required this.launchUrlExternal,
|
||||
required this.enableContentBlocking,
|
||||
required this.blockHttpProtocol,
|
||||
required this.enableHostList,
|
||||
required this.themeMode,
|
||||
required this.quickAction,
|
||||
required this.quickActionVoiceInput,
|
||||
@@ -44,7 +39,6 @@ class Settings with FastEquatable {
|
||||
bool? launchUrlExternal,
|
||||
bool? enableContentBlocking,
|
||||
bool? blockHttpProtocol,
|
||||
Set<HostSource>? enableHostList,
|
||||
ThemeMode? themeMode,
|
||||
this.quickAction,
|
||||
bool? quickActionVoiceInput,
|
||||
@@ -53,9 +47,7 @@ class Settings with FastEquatable {
|
||||
incognitoMode = incognitoMode ?? true,
|
||||
enableJavascript = enableJavascript ?? true,
|
||||
launchUrlExternal = launchUrlExternal ?? false,
|
||||
enableContentBlocking = enableContentBlocking ?? true,
|
||||
blockHttpProtocol = blockHttpProtocol ?? false,
|
||||
enableHostList = enableHostList ?? {HostSource.stevenBlackUnified},
|
||||
themeMode = themeMode ?? ThemeMode.dark,
|
||||
quickActionVoiceInput = quickActionVoiceInput ?? false,
|
||||
enableReadability = enableReadability ?? true;
|
||||
@@ -70,9 +62,7 @@ class Settings with FastEquatable {
|
||||
incognitoMode,
|
||||
enableJavascript,
|
||||
launchUrlExternal,
|
||||
enableContentBlocking,
|
||||
blockHttpProtocol,
|
||||
enableHostList,
|
||||
themeMode,
|
||||
quickAction,
|
||||
quickActionVoiceInput,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:lensai/features/settings/data/models/settings.dart';
|
||||
import 'package:lensai/features/settings/utils/preference_parser.dart';
|
||||
@@ -15,9 +14,7 @@ enum _StorageKeys {
|
||||
incognito('enabe_incognito'),
|
||||
javascript('enable_js'),
|
||||
launchExternal('enable_launch_external'),
|
||||
contentBlocking('enable_content_blocking'),
|
||||
blockHttpProtocol('block_http'),
|
||||
enableHostList('enable_host_lists'),
|
||||
themeMode('theme_mode'),
|
||||
quickAction('enable_quick_action'),
|
||||
quickActionVoiceInput('enable_quick_action_voice_input'),
|
||||
@@ -81,14 +78,6 @@ class SettingsRepository extends _$SettingsRepository {
|
||||
);
|
||||
}
|
||||
|
||||
if (newSettings.enableContentBlocking !=
|
||||
oldSettings.enableContentBlocking) {
|
||||
await sharedPreferences.setBool(
|
||||
_StorageKeys.contentBlocking.key,
|
||||
newSettings.enableContentBlocking,
|
||||
);
|
||||
}
|
||||
|
||||
if (newSettings.blockHttpProtocol != oldSettings.blockHttpProtocol) {
|
||||
await sharedPreferences.setBool(
|
||||
_StorageKeys.blockHttpProtocol.key,
|
||||
@@ -96,16 +85,6 @@ class SettingsRepository extends _$SettingsRepository {
|
||||
);
|
||||
}
|
||||
|
||||
if (!const DeepCollectionEquality.unordered().equals(
|
||||
newSettings.enableHostList,
|
||||
oldSettings.enableHostList,
|
||||
)) {
|
||||
await sharedPreferences.setStringList(
|
||||
_StorageKeys.enableHostList.key,
|
||||
newSettings.enableHostList.map((list) => list.name).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
if (newSettings.themeMode != oldSettings.themeMode) {
|
||||
await sharedPreferences.setInt(
|
||||
_StorageKeys.themeMode.key,
|
||||
@@ -157,13 +136,8 @@ class SettingsRepository extends _$SettingsRepository {
|
||||
enableJavascript: sharedPreferences.getBool(_StorageKeys.javascript.key),
|
||||
launchUrlExternal:
|
||||
sharedPreferences.getBool(_StorageKeys.launchExternal.key),
|
||||
enableContentBlocking:
|
||||
sharedPreferences.getBool(_StorageKeys.contentBlocking.key),
|
||||
blockHttpProtocol:
|
||||
sharedPreferences.getBool(_StorageKeys.blockHttpProtocol.key),
|
||||
enableHostList: parseHostSources(
|
||||
sharedPreferences.getStringList(_StorageKeys.enableHostList.key),
|
||||
),
|
||||
themeMode:
|
||||
parseThemeMode(sharedPreferences.getInt(_StorageKeys.themeMode.key)),
|
||||
quickAction:
|
||||
|
||||
Reference in New Issue
Block a user