melos format
This commit is contained in:
+4
-3
@@ -85,9 +85,10 @@ extension HitResultX on HitResult {
|
|||||||
return switch (this) {
|
return switch (this) {
|
||||||
UnknownHitResult(src: final src) => src.uriDisplayString,
|
UnknownHitResult(src: final src) => src.uriDisplayString,
|
||||||
ImageSrcHitResult(uri: final uri) => uri.uriDisplayString,
|
ImageSrcHitResult(uri: final uri) => uri.uriDisplayString,
|
||||||
ImageHitResult(src: final src, title: final title) => title.isEmpty
|
ImageHitResult(src: final src, title: final title) =>
|
||||||
? (src.length > maxTitleLength ? 'image' : src.uriDisplayString)
|
title.isEmpty
|
||||||
: title!,
|
? (src.length > maxTitleLength ? 'image' : src.uriDisplayString)
|
||||||
|
: title!,
|
||||||
VideoHitResult(src: final src, title: final title) =>
|
VideoHitResult(src: final src, title: final title) =>
|
||||||
(title.isEmpty) ? src.uriDisplayString : title!,
|
(title.isEmpty) ? src.uriDisplayString : title!,
|
||||||
AudioHitResult(src: final src, title: final title) =>
|
AudioHitResult(src: final src, title: final title) =>
|
||||||
|
|||||||
+6
-4
@@ -195,7 +195,11 @@ class _InstallConfigSheet extends HookConsumerWidget {
|
|||||||
list.add(_StorageNewIsolated());
|
list.add(_StorageNewIsolated());
|
||||||
return list;
|
return list;
|
||||||
},
|
},
|
||||||
[tabContextId, containerData?.id, containerData?.metadata.contextualIdentity],
|
[
|
||||||
|
tabContextId,
|
||||||
|
containerData?.id,
|
||||||
|
containerData?.metadata.contextualIdentity,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Pick sensible default selection based on current context.
|
// Pick sensible default selection based on current context.
|
||||||
@@ -319,9 +323,7 @@ class _InstallConfigSheet extends HookConsumerWidget {
|
|||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.shortcut),
|
leading: const Icon(Icons.shortcut),
|
||||||
title: const Text('Add Shortcut'),
|
title: const Text('Add Shortcut'),
|
||||||
subtitle: const Text(
|
subtitle: const Text('Opens as a standard tab in the browser.'),
|
||||||
'Opens as a standard tab in the browser.',
|
|
||||||
),
|
|
||||||
onTap: () => submit(ShortcutInstallType.shortcut),
|
onTap: () => submit(ShortcutInstallType.shortcut),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|||||||
+1
-2
@@ -32,8 +32,7 @@ import 'package:weblibre/utils/ui_helper.dart';
|
|||||||
Future<void> showPwaInstallDialog(BuildContext context, WidgetRef ref) async {
|
Future<void> showPwaInstallDialog(BuildContext context, WidgetRef ref) async {
|
||||||
final selectedTabId = ref.read(selectedTabProvider);
|
final selectedTabId = ref.read(selectedTabProvider);
|
||||||
final manifest = ref.read(currentTabManifestProvider);
|
final manifest = ref.read(currentTabManifestProvider);
|
||||||
final defaultName =
|
final defaultName = manifest?.shortName ?? manifest?.name ?? 'this web app';
|
||||||
manifest?.shortName ?? manifest?.name ?? 'this web app';
|
|
||||||
final tabState = selectedTabId != null
|
final tabState = selectedTabId != null
|
||||||
? ref.read(tabStateProvider(selectedTabId))
|
? ref.read(tabStateProvider(selectedTabId))
|
||||||
: null;
|
: null;
|
||||||
|
|||||||
+6
-7
@@ -28,9 +28,7 @@ import 'package:weblibre/presentation/widgets/url_icon.dart';
|
|||||||
import 'package:weblibre/utils/form_validators.dart';
|
import 'package:weblibre/utils/form_validators.dart';
|
||||||
import 'package:weblibre/utils/ui_helper.dart' as ui_helper;
|
import 'package:weblibre/utils/ui_helper.dart' as ui_helper;
|
||||||
|
|
||||||
final _wildcardHostRegex = RegExp(
|
final _wildcardHostRegex = RegExp(r'^\*\.([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,63}$');
|
||||||
r'^\*\.([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,63}$',
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Parses a user-entered site-assignment value. Accepts:
|
/// Parses a user-entered site-assignment value. Accepts:
|
||||||
/// - `example.com`, `https://example.com/path` → exact origin entry
|
/// - `example.com`, `https://example.com/path` → exact origin entry
|
||||||
@@ -44,8 +42,10 @@ Uri? _parseSiteAssignmentInput(String? input) {
|
|||||||
// Strip scheme for wildcard detection.
|
// Strip scheme for wildcard detection.
|
||||||
var rest = trimmed;
|
var rest = trimmed;
|
||||||
var scheme = 'https';
|
var scheme = 'https';
|
||||||
final schemeMatch = RegExp(r'^(https?):\/\/', caseSensitive: false)
|
final schemeMatch = RegExp(
|
||||||
.firstMatch(trimmed);
|
r'^(https?):\/\/',
|
||||||
|
caseSensitive: false,
|
||||||
|
).firstMatch(trimmed);
|
||||||
if (schemeMatch != null) {
|
if (schemeMatch != null) {
|
||||||
scheme = schemeMatch.group(1)!.toLowerCase();
|
scheme = schemeMatch.group(1)!.toLowerCase();
|
||||||
rest = trimmed.substring(schemeMatch.end);
|
rest = trimmed.substring(schemeMatch.end);
|
||||||
@@ -110,8 +110,7 @@ class ContainerSitesScreen extends HookConsumerWidget {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
label: const Text('Add Site'),
|
label: const Text('Add Site'),
|
||||||
hintText: 'example.com or *.example.com',
|
hintText: 'example.com or *.example.com',
|
||||||
helperText:
|
helperText: 'Use *.example.com to match all subdomains',
|
||||||
'Use *.example.com to match all subdomains',
|
|
||||||
floatingLabelBehavior: FloatingLabelBehavior.always,
|
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||||
suffix: TextButton(
|
suffix: TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
|||||||
+6
-6
@@ -113,16 +113,16 @@ class IntentGatekeeperDialog extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
FilledButton.tonal(
|
FilledButton.tonal(
|
||||||
onPressed: () => Navigator.of(context).pop(
|
onPressed: () => Navigator.of(
|
||||||
const DialogOutcome(decision: IntentSourcePolicy.allow),
|
context,
|
||||||
),
|
).pop(const DialogOutcome(decision: IntentSourcePolicy.allow)),
|
||||||
child: const Text('Allow once'),
|
child: const Text('Allow once'),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
onPressed: () => Navigator.of(context).pop(
|
onPressed: () => Navigator.of(
|
||||||
const DialogOutcome(decision: IntentSourcePolicy.block),
|
context,
|
||||||
),
|
).pop(const DialogOutcome(decision: IntentSourcePolicy.block)),
|
||||||
child: const Text('Block once'),
|
child: const Text('Block once'),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
|||||||
@@ -686,8 +686,9 @@ class _AllowNonManifestPwaInstallTile extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final allowNonManifestPwaInstall = ref.watch(
|
final allowNonManifestPwaInstall = ref.watch(
|
||||||
generalSettingsWithDefaultsProvider
|
generalSettingsWithDefaultsProvider.select(
|
||||||
.select((s) => s.allowNonManifestPwaInstall),
|
(s) => s.allowNonManifestPwaInstall,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return SwitchListTile.adaptive(
|
return SwitchListTile.adaptive(
|
||||||
|
|||||||
@@ -71,8 +71,9 @@ class _ManageExtensionsTile extends StatelessWidget {
|
|||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
title: const Text('Manage Extensions'),
|
title: const Text('Manage Extensions'),
|
||||||
subtitle:
|
subtitle: const Text(
|
||||||
const Text('Browse installed, disabled, available, and unsupported extensions'),
|
'Browse installed, disabled, available, and unsupported extensions',
|
||||||
|
),
|
||||||
trailing: const Icon(Icons.chevron_right),
|
trailing: const Icon(Icons.chevron_right),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await const AddonManagerRoute().push<void>(context);
|
await const AddonManagerRoute().push<void>(context);
|
||||||
|
|||||||
+2
-2
@@ -475,8 +475,8 @@ class _ScreenshotProtectionTile extends HookConsumerWidget {
|
|||||||
await ref
|
await ref
|
||||||
.read(saveGeneralSettingsControllerProvider.notifier)
|
.read(saveGeneralSettingsControllerProvider.notifier)
|
||||||
.save(
|
.save(
|
||||||
(currentSettings) => currentSettings.copyWith
|
(currentSettings) =>
|
||||||
.screenshotProtectionEnabled(value),
|
currentSettings.copyWith.screenshotProtectionEnabled(value),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -356,10 +356,10 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
|||||||
String? json,
|
String? json,
|
||||||
) =>
|
) =>
|
||||||
json.mapNotNull(
|
json.mapNotNull(
|
||||||
(encoded) => UBlockFilterListSettings.fromJson(
|
(encoded) => UBlockFilterListSettings.fromJson(
|
||||||
jsonDecode(encoded) as Map<String, dynamic>,
|
jsonDecode(encoded) as Map<String, dynamic>,
|
||||||
),
|
),
|
||||||
) ??
|
) ??
|
||||||
UBlockFilterListSettings();
|
UBlockFilterListSettings();
|
||||||
|
|
||||||
static String _ublockFilterListSettingsToJson(
|
static String _ublockFilterListSettingsToJson(
|
||||||
|
|||||||
@@ -236,10 +236,10 @@ class GeneralSettings with FastEquatable {
|
|||||||
uiScaleFactor = uiScaleFactor ?? defaultUiScaleFactor,
|
uiScaleFactor = uiScaleFactor ?? defaultUiScaleFactor,
|
||||||
disableAnimations = disableAnimations ?? false,
|
disableAnimations = disableAnimations ?? false,
|
||||||
showModalBarrier = showModalBarrier ?? true,
|
showModalBarrier = showModalBarrier ?? true,
|
||||||
enableReadability = enableReadability ?? true,
|
enableReadability = enableReadability ?? true,
|
||||||
enforceReadability = enforceReadability ?? false,
|
enforceReadability = enforceReadability ?? false,
|
||||||
screenshotProtectionEnabled = screenshotProtectionEnabled ?? false,
|
screenshotProtectionEnabled = screenshotProtectionEnabled ?? false,
|
||||||
defaultSearchProvider = defaultSearchProvider ?? _fallbackSearchProvider,
|
defaultSearchProvider = defaultSearchProvider ?? _fallbackSearchProvider,
|
||||||
defaultSearchSuggestionsProvider =
|
defaultSearchSuggestionsProvider =
|
||||||
defaultSearchSuggestionsProvider ?? _fallbackAutocompleteProvider,
|
defaultSearchSuggestionsProvider ?? _fallbackAutocompleteProvider,
|
||||||
createChildTabsOption = createChildTabsOption ?? false,
|
createChildTabsOption = createChildTabsOption ?? false,
|
||||||
|
|||||||
@@ -85,7 +85,9 @@ class UBlockFilterListSettings with FastEquatable {
|
|||||||
this.externalFilterLists = const [],
|
this.externalFilterLists = const [],
|
||||||
});
|
});
|
||||||
|
|
||||||
factory UBlockFilterListSettings.managedDefaults(UBlockAssetsRegistry registry) {
|
factory UBlockFilterListSettings.managedDefaults(
|
||||||
|
UBlockAssetsRegistry registry,
|
||||||
|
) {
|
||||||
return UBlockFilterListSettings(
|
return UBlockFilterListSettings(
|
||||||
enabled: true,
|
enabled: true,
|
||||||
enabledStockListTokens: registry.defaultEnabledTokens,
|
enabledStockListTokens: registry.defaultEnabledTokens,
|
||||||
|
|||||||
+19
-22
@@ -280,31 +280,28 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
test(
|
test('toggling off a token in both sets removes it from both', () {
|
||||||
'toggling off a token in both sets removes it from both',
|
final settings = UBlockFilterListSettings(
|
||||||
() {
|
enabled: true,
|
||||||
final settings = UBlockFilterListSettings(
|
enabledStockListTokens: ['DEU-0', 'easylist'],
|
||||||
enabled: true,
|
autoEnabledStockListTokens: ['DEU-0', 'NLD-0'],
|
||||||
enabledStockListTokens: ['DEU-0', 'easylist'],
|
);
|
||||||
autoEnabledStockListTokens: ['DEU-0', 'NLD-0'],
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(settings.isTokenEnabled('DEU-0'), true);
|
expect(settings.isTokenEnabled('DEU-0'), true);
|
||||||
|
|
||||||
final updated = settings.copyWith(
|
final updated = settings.copyWith(
|
||||||
enabledStockListTokens: [...settings.enabledStockListTokens]
|
enabledStockListTokens: [...settings.enabledStockListTokens]
|
||||||
..remove('DEU-0'),
|
..remove('DEU-0'),
|
||||||
autoEnabledStockListTokens: [...settings.autoEnabledStockListTokens]
|
autoEnabledStockListTokens: [...settings.autoEnabledStockListTokens]
|
||||||
..remove('DEU-0'),
|
..remove('DEU-0'),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(updated.enabledStockListTokens, isNot(contains('DEU-0')));
|
expect(updated.enabledStockListTokens, isNot(contains('DEU-0')));
|
||||||
expect(updated.autoEnabledStockListTokens, isNot(contains('DEU-0')));
|
expect(updated.autoEnabledStockListTokens, isNot(contains('DEU-0')));
|
||||||
expect(updated.isTokenEnabled('DEU-0'), false);
|
expect(updated.isTokenEnabled('DEU-0'), false);
|
||||||
expect(updated.isTokenEnabled('NLD-0'), true);
|
expect(updated.isTokenEnabled('NLD-0'), true);
|
||||||
expect(updated.isTokenEnabled('easylist'), true);
|
expect(updated.isTokenEnabled('easylist'), true);
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
test('toggling on a disabled token adds to enabledStockListTokens', () {
|
test('toggling on a disabled token adds to enabledStockListTokens', () {
|
||||||
final settings = UBlockFilterListSettings(
|
final settings = UBlockFilterListSettings(
|
||||||
|
|||||||
Reference in New Issue
Block a user