dart format
This commit is contained in:
@@ -80,9 +80,7 @@ class _Filesystem {
|
||||
/// Returns `true` if a migration was performed.
|
||||
static Future<bool> _migrateMozillaDirToFiles(Directory profileDir) async {
|
||||
final oldDir = Directory(p.join(profileDir.path, 'mozilla'));
|
||||
final newDir = Directory(
|
||||
p.join(profileDir.path, 'files', 'mozilla'),
|
||||
);
|
||||
final newDir = Directory(p.join(profileDir.path, 'files', 'mozilla'));
|
||||
|
||||
final oldType = await FileSystemEntity.type(
|
||||
oldDir.path,
|
||||
@@ -90,9 +88,7 @@ class _Filesystem {
|
||||
);
|
||||
|
||||
if (oldType == FileSystemEntityType.directory && !await newDir.exists()) {
|
||||
await Directory(
|
||||
p.join(profileDir.path, 'files'),
|
||||
).create(recursive: true);
|
||||
await Directory(p.join(profileDir.path, 'files')).create(recursive: true);
|
||||
await oldDir.rename(newDir.path);
|
||||
return true;
|
||||
}
|
||||
@@ -105,9 +101,7 @@ class _Filesystem {
|
||||
|
||||
for (final profileId in profileIds) {
|
||||
final oldCache = Directory(p.join(globalCacheDir.path, profileId));
|
||||
final newCache = Directory(
|
||||
p.join(profileDir.path, 'cache', profileId),
|
||||
);
|
||||
final newCache = Directory(p.join(profileDir.path, 'cache', profileId));
|
||||
|
||||
if (await oldCache.exists() && !await newCache.exists()) {
|
||||
try {
|
||||
@@ -132,9 +126,7 @@ class _Filesystem {
|
||||
Directory filesDir,
|
||||
Directory profileDir,
|
||||
) async {
|
||||
final mozillaDir = Directory(
|
||||
p.join(profileDir.path, 'files', 'mozilla'),
|
||||
);
|
||||
final mozillaDir = Directory(p.join(profileDir.path, 'files', 'mozilla'));
|
||||
await mozillaDir.create(recursive: true);
|
||||
|
||||
final mozillaPath = p.join(filesDir.path, 'mozilla');
|
||||
@@ -279,10 +271,7 @@ class _Filesystem {
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
await extensionsFile.writeAsString(
|
||||
jsonEncode(json),
|
||||
flush: true,
|
||||
);
|
||||
await extensionsFile.writeAsString(jsonEncode(json), flush: true);
|
||||
logger.i('Migrated extension paths in $profileId/extensions.json');
|
||||
migrated = true;
|
||||
}
|
||||
|
||||
@@ -46,9 +46,6 @@ class TorCountryPickerRoute extends GoRouteData with $TorCountryPickerRoute {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return CountryPickerScreen(
|
||||
title: title,
|
||||
selectedCountryCode: $extra,
|
||||
);
|
||||
return CountryPickerScreen(title: title, selectedCountryCode: $extra);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,16 +38,10 @@ class Profile with FastEquatable {
|
||||
|
||||
static String getNewProfileId() => uuid.v7();
|
||||
|
||||
Profile({
|
||||
required this.id,
|
||||
required this.name,
|
||||
AuthSettings? authSettings,
|
||||
}) : authSettings = authSettings ?? AuthSettings.withDefaults();
|
||||
Profile({required this.id, required this.name, AuthSettings? authSettings})
|
||||
: authSettings = authSettings ?? AuthSettings.withDefaults();
|
||||
|
||||
factory Profile.create({
|
||||
required String name,
|
||||
AuthSettings? authSettings,
|
||||
}) {
|
||||
factory Profile.create({required String name, AuthSettings? authSettings}) {
|
||||
return Profile(
|
||||
id: getNewProfileId(),
|
||||
name: name,
|
||||
|
||||
@@ -358,21 +358,19 @@ class GenericWebsiteService extends _$GenericWebsiteService {
|
||||
}
|
||||
|
||||
late final Future<Result<WebPageInfo>> inFlightFetch;
|
||||
inFlightFetch = fetchPageInfo(
|
||||
url: url,
|
||||
isImageRequest: true,
|
||||
proxyPort: null,
|
||||
).timeout(
|
||||
const Duration(seconds: 20),
|
||||
onTimeout: () => Result.failure(
|
||||
const ErrorMessage(source: 'icon', message: 'Icon fetch timeout'),
|
||||
),
|
||||
).whenComplete(() {
|
||||
// Only clear this entry if it is still the active in-flight request.
|
||||
if (identical(_inFlightFetches[url]?.future, inFlightFetch)) {
|
||||
_inFlightFetches.remove(url);
|
||||
}
|
||||
});
|
||||
inFlightFetch = fetchPageInfo(url: url, isImageRequest: true, proxyPort: null)
|
||||
.timeout(
|
||||
const Duration(seconds: 20),
|
||||
onTimeout: () => Result.failure(
|
||||
const ErrorMessage(source: 'icon', message: 'Icon fetch timeout'),
|
||||
),
|
||||
)
|
||||
.whenComplete(() {
|
||||
// Only clear this entry if it is still the active in-flight request.
|
||||
if (identical(_inFlightFetches[url]?.future, inFlightFetch)) {
|
||||
_inFlightFetches.remove(url);
|
||||
}
|
||||
});
|
||||
|
||||
_inFlightFetches[url] = _InFlightFetch(inFlightFetch);
|
||||
return inFlightFetch;
|
||||
|
||||
+1
-3
@@ -64,9 +64,7 @@ class BrowserFab extends HookConsumerWidget {
|
||||
heroTag: 'dock_fab',
|
||||
onPressed: () {
|
||||
ref
|
||||
.read(
|
||||
toolbarVisibilityControllerProvider(selectedTabId).notifier,
|
||||
)
|
||||
.read(toolbarVisibilityControllerProvider(selectedTabId).notifier)
|
||||
.forceShow();
|
||||
},
|
||||
child: const Icon(MdiIcons.dockBottom),
|
||||
|
||||
+2
-1
@@ -68,7 +68,8 @@ class BrowserView extends StatefulHookConsumerWidget {
|
||||
final Future<void> Function()? postInitializationStep;
|
||||
final StreamSink<Offset>? pointerMoveEventSink;
|
||||
|
||||
const BrowserView({super.key,
|
||||
const BrowserView({
|
||||
super.key,
|
||||
this.screenshotPeriod = const Duration(seconds: 10),
|
||||
this.suggestionTimeout = const Duration(seconds: 30),
|
||||
this.postInitializationStep,
|
||||
|
||||
+2
-1
@@ -52,7 +52,8 @@ class ViewTabSheetWidget extends HookConsumerWidget {
|
||||
final double bottomAppBarHeight;
|
||||
final ValueChanged<bool>? onClearSiteDataExpandedChanged;
|
||||
|
||||
const ViewTabSheetWidget({super.key,
|
||||
const ViewTabSheetWidget({
|
||||
super.key,
|
||||
required this.initialTabState,
|
||||
required this.sheetScrollController,
|
||||
required this.draggableScrollableController,
|
||||
|
||||
@@ -70,15 +70,9 @@ bool isManifestInstallable(PwaManifest manifest) {
|
||||
_validDisplayModes.contains(manifest.display!.toLowerCase());
|
||||
|
||||
// Check that start_url is within scope
|
||||
final isInScope = _isStartUrlInScope(
|
||||
manifest.startUrl,
|
||||
manifest.scope,
|
||||
);
|
||||
final isInScope = _isStartUrlInScope(manifest.startUrl, manifest.scope);
|
||||
|
||||
return hasValidName &&
|
||||
hasValidStartUrl &&
|
||||
hasValidDisplay &&
|
||||
isInScope;
|
||||
return hasValidName && hasValidStartUrl && hasValidDisplay && isInScope;
|
||||
}
|
||||
|
||||
/// Returns true if two URLs share the same origin (scheme + host + port).
|
||||
@@ -120,10 +114,12 @@ bool _isStartUrlInScope(String startUrl, String? scope) {
|
||||
|
||||
// Path containment: scope path must be a prefix of start_url path
|
||||
// on a `/` boundary to avoid "/app" matching "/application"
|
||||
final scopePath =
|
||||
scopeUri.path.endsWith('/') ? scopeUri.path : '${scopeUri.path}/';
|
||||
final startPath =
|
||||
startUri.path.endsWith('/') ? startUri.path : '${startUri.path}/';
|
||||
final scopePath = scopeUri.path.endsWith('/')
|
||||
? scopeUri.path
|
||||
: '${scopeUri.path}/';
|
||||
final startPath = startUri.path.endsWith('/')
|
||||
? startUri.path
|
||||
: '${startUri.path}/';
|
||||
|
||||
return startPath.startsWith(scopePath) || startUri.path == scopeUri.path;
|
||||
} catch (e) {
|
||||
|
||||
@@ -59,7 +59,8 @@ class SearchScreen extends HookConsumerWidget {
|
||||
/// When null, a new tab will be created.
|
||||
final String? tabId;
|
||||
|
||||
const SearchScreen({super.key,
|
||||
const SearchScreen({
|
||||
super.key,
|
||||
required this.initialSearchText,
|
||||
required this.tabType,
|
||||
this.launchedFromIntent = false,
|
||||
|
||||
@@ -178,7 +178,8 @@ class ContainerChips extends HookConsumerWidget {
|
||||
|
||||
final ValueListenable<TextEditingValue>? searchTextListenable;
|
||||
|
||||
const ContainerChips({super.key,
|
||||
const ContainerChips({
|
||||
super.key,
|
||||
required this.selectedContainer,
|
||||
required this.onSelected,
|
||||
required this.onDeleted,
|
||||
|
||||
@@ -4,11 +4,7 @@ import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
|
||||
|
||||
part 'sync_repository_state.g.dart';
|
||||
|
||||
enum SyncEvent {
|
||||
started,
|
||||
completed,
|
||||
error;
|
||||
}
|
||||
enum SyncEvent { started, completed, error }
|
||||
|
||||
@CopyWith()
|
||||
class SyncRepositoryState with FastEquatable {
|
||||
@@ -29,6 +25,12 @@ class SyncRepositoryState with FastEquatable {
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get hashParameters =>
|
||||
[account, remoteTabs, devices, deviceName, lastSyncEvent, lastSyncError];
|
||||
List<Object?> get hashParameters => [
|
||||
account,
|
||||
remoteTabs,
|
||||
devices,
|
||||
deviceName,
|
||||
lastSyncEvent,
|
||||
lastSyncError,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -148,9 +148,7 @@ class UserBackupService extends _$UserBackupService {
|
||||
outputDirectory,
|
||||
);
|
||||
if (existingProfile == null) {
|
||||
throw Exception(
|
||||
'Backup does not contain valid profile metadata',
|
||||
);
|
||||
throw Exception('Backup does not contain valid profile metadata');
|
||||
}
|
||||
|
||||
if (existingProfile.uuidValue == filesystem.selectedProfile) {
|
||||
@@ -159,9 +157,7 @@ class UserBackupService extends _$UserBackupService {
|
||||
);
|
||||
}
|
||||
|
||||
final profileDir = filesystem.getProfileDir(
|
||||
existingProfile.uuidValue,
|
||||
);
|
||||
final profileDir = filesystem.getProfileDir(existingProfile.uuidValue);
|
||||
|
||||
if (await profileDir.exists()) {
|
||||
final result = await confirmOverrideCallback();
|
||||
|
||||
@@ -25,7 +25,8 @@ import 'package:weblibre/features/web_feed/data/models/feed_author.dart';
|
||||
class AuthorsHorizontalList extends StatelessWidget {
|
||||
late final List<Widget> _authors;
|
||||
|
||||
AuthorsHorizontalList({super.key,
|
||||
AuthorsHorizontalList({
|
||||
super.key,
|
||||
required List<FeedAuthor> authors,
|
||||
Set<String> selectedTags = const {},
|
||||
void Function(String tagId, bool value)? onTagSelected,
|
||||
|
||||
@@ -25,7 +25,8 @@ import 'package:weblibre/features/web_feed/data/models/feed_category.dart';
|
||||
class TagsHorizontalList extends StatelessWidget {
|
||||
late final List<Widget> _tags;
|
||||
|
||||
TagsHorizontalList({super.key,
|
||||
TagsHorizontalList({
|
||||
super.key,
|
||||
required List<FeedCategory> tags,
|
||||
Set<String> selectedTags = const {},
|
||||
void Function(String tagId, bool value)? onTagSelected,
|
||||
|
||||
@@ -49,11 +49,6 @@ class SafeRawImage extends StatelessWidget {
|
||||
return fallback ?? SizedBox(width: width, height: height);
|
||||
}
|
||||
|
||||
return RawImage(
|
||||
image: uiImage,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: fit,
|
||||
);
|
||||
return RawImage(image: uiImage, width: width, height: height, fit: fit);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user