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