chore: bump line length to 120 (#20191)

This commit is contained in:
shenlong
2025-07-25 08:07:22 +05:30
committed by GitHub
parent 977c9b96ba
commit ad65e9011a
517 changed files with 4520 additions and 9514 deletions
+1 -2
View File
@@ -50,8 +50,7 @@ String humanReadableBytesProgress(int bytes, int bytesTotal) {
}
class ThrottleProgressUpdate {
ThrottleProgressUpdate(this._fun, Duration interval)
: _interval = interval.inMicroseconds;
ThrottleProgressUpdate(this._fun, Duration interval) : _interval = interval.inMicroseconds;
final void Function(String?, int, int) _fun;
final int _interval;
int _invokedAt = 0;
+3 -6
View File
@@ -60,15 +60,13 @@ final class CustomImageCache implements ImageCache {
int get currentSizeBytes => _small.currentSizeBytes + _large.currentSizeBytes;
@override
bool evict(Object key, {bool includeLive = true}) =>
_cacheForKey(key).evict(key, includeLive: includeLive);
bool evict(Object key, {bool includeLive = true}) => _cacheForKey(key).evict(key, includeLive: includeLive);
@override
int get liveImageCount => _small.liveImageCount + _large.liveImageCount;
@override
int get pendingImageCount =>
_small.pendingImageCount + _large.pendingImageCount;
int get pendingImageCount => _small.pendingImageCount + _large.pendingImageCount;
@override
ImageStreamCompleter? putIfAbsent(
@@ -79,6 +77,5 @@ final class CustomImageCache implements ImageCache {
_cacheForKey(key).putIfAbsent(key, loader, onError: onError);
@override
ImageCacheStatus statusForKey(Object key) =>
_cacheForKey(key).statusForKey(key);
ImageCacheStatus statusForKey(Object key) => _cacheForKey(key).statusForKey(key);
}
+1 -2
View File
@@ -82,8 +82,7 @@ class _ColorFilterGenerator {
];
}
double x =
((1 + ((value > 0) ? ((3 * value) / 100) : (value / 100)))).toDouble();
double x = ((1 + ((value > 0) ? ((3 * value) / 100) : (value / 100)))).toDouble();
double lumR = 0.3086;
double lumG = 0.6094;
double lumB = 0.082;
+1 -2
View File
@@ -1,3 +1,2 @@
bool isAtSameMomentAs(DateTime? a, DateTime? b) =>
(a == null && b == null) ||
((a != null && b != null) && a.isAtSameMomentAs(b));
(a == null && b == null) || ((a != null && b != null) && a.isAtSameMomentAs(b));
+2 -4
View File
@@ -19,8 +19,7 @@ class Debouncer {
if (maxWaitTime != null &&
// _actionFuture == null && // TODO: should this check be here?
(_lastActionTime == null ||
DateTime.now().difference(_lastActionTime!) > maxWaitTime!)) {
(_lastActionTime == null || DateTime.now().difference(_lastActionTime!) > maxWaitTime!)) {
_callAndRest();
return;
}
@@ -60,8 +59,7 @@ class Debouncer {
_actionFuture = null;
}
bool get isActive =>
_actionFuture != null || (_timer != null && _timer!.isActive);
bool get isActive => _actionFuture != null || (_timer != null && _timer!.isActive);
}
/// Creates a [Debouncer] that will be disposed automatically. If no [interval] is provided, a
@@ -15,19 +15,18 @@ DraggableScrollableController useDraggableScrollController({
);
}
class _DraggableScrollControllerHook
extends Hook<DraggableScrollableController> {
class _DraggableScrollControllerHook extends Hook<DraggableScrollableController> {
const _DraggableScrollControllerHook({
super.keys,
});
@override
HookState<DraggableScrollableController, Hook<DraggableScrollableController>>
createState() => _DraggableScrollControllerHookState();
HookState<DraggableScrollableController, Hook<DraggableScrollableController>> createState() =>
_DraggableScrollControllerHookState();
}
class _DraggableScrollControllerHookState extends HookState<
DraggableScrollableController, _DraggableScrollControllerHook> {
class _DraggableScrollControllerHookState
extends HookState<DraggableScrollableController, _DraggableScrollControllerHook> {
late final controller = DraggableScrollableController();
@override
+1 -2
View File
@@ -23,8 +23,7 @@ class _TimerHook extends Hook<RestartableTimer> {
required this.callback,
});
@override
HookState<RestartableTimer, Hook<RestartableTimer>> createState() =>
_TimerHookState();
HookState<RestartableTimer, Hook<RestartableTimer>> createState() => _TimerHookState();
}
class _TimerHookState extends HookState<RestartableTimer, _TimerHook> {
+2 -4
View File
@@ -12,8 +12,7 @@ class HttpSSLOptions {
static void apply({bool applyNative = true}) {
AppSettingsEnum setting = AppSettingsEnum.allowSelfSignedSSLCert;
bool allowSelfSignedSSLCert =
Store.get(setting.storeKey as StoreKey<bool>, setting.defaultValue);
bool allowSelfSignedSSLCert = Store.get(setting.storeKey as StoreKey<bool>, setting.defaultValue);
_apply(allowSelfSignedSSLCert, applyNative: applyNative);
}
@@ -29,8 +28,7 @@ class HttpSSLOptions {
SSLClientCertStoreVal? clientCert = SSLClientCertStoreVal.load();
HttpOverrides.global =
HttpSSLCertOverride(allowSelfSignedSSLCert, serverHost, clientCert);
HttpOverrides.global = HttpSSLCertOverride(allowSelfSignedSSLCert, serverHost, clientCert);
if (applyNative && Platform.isAndroid) {
_channel.invokeMethod("apply", [
+2 -4
View File
@@ -7,8 +7,7 @@ final _loadingEntry = OverlayEntry(
builder: (context) => SizedBox.square(
dimension: double.infinity,
child: DecoratedBox(
decoration:
BoxDecoration(color: context.colorScheme.surface.withAlpha(200)),
decoration: BoxDecoration(color: context.colorScheme.surface.withAlpha(200)),
child: const Center(
child: DelayedLoadingIndicator(
delay: Duration(seconds: 1),
@@ -30,8 +29,7 @@ class _LoadingOverlay extends Hook<ValueNotifier<bool>> {
_LoadingOverlayState createState() => _LoadingOverlayState();
}
class _LoadingOverlayState
extends HookState<ValueNotifier<bool>, _LoadingOverlay> {
class _LoadingOverlayState extends HookState<ValueNotifier<bool>, _LoadingOverlay> {
late final _isLoading = ValueNotifier(false)..addListener(_listener);
OverlayEntry? _loadingOverlay;
+1 -2
View File
@@ -17,8 +17,7 @@ class InvalidIsolateUsageException implements Exception {
const InvalidIsolateUsageException();
@override
String toString() =>
"IsolateHelper should only be used from the root isolate";
String toString() => "IsolateHelper should only be used from the root isolate";
}
// !! Should be used only from the root isolate
+2 -5
View File
@@ -91,12 +91,9 @@ class MapUtils {
}
}
if (permission == LocationPermission.denied ||
permission == LocationPermission.deniedForever) {
if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) {
// Open app settings only if you did not request for permission before
if (permission == LocationPermission.deniedForever &&
!shouldRequestPermission &&
!silent) {
if (permission == LocationPermission.deniedForever && !shouldRequestPermission && !silent) {
await Geolocator.openAppSettings();
}
return (null, LocationPermission.deniedForever);
+11 -26
View File
@@ -11,8 +11,7 @@ import 'package:immich_mobile/domain/models/store.model.dart';
import 'package:immich_mobile/entities/album.entity.dart';
import 'package:immich_mobile/entities/android_device_asset.entity.dart';
import 'package:immich_mobile/entities/asset.entity.dart';
import 'package:immich_mobile/entities/backup_album.entity.dart'
as isar_backup_album;
import 'package:immich_mobile/entities/backup_album.entity.dart' as isar_backup_album;
import 'package:immich_mobile/entities/etag.entity.dart';
import 'package:immich_mobile/entities/ios_device_asset.entity.dart';
import 'package:immich_mobile/entities/store.entity.dart';
@@ -44,8 +43,7 @@ Future<void> migrateDatabaseIfNeeded(Isar db) async {
if (id != null) {
await db.writeTxn(() async {
final user = await db.users.get(id);
await db.storeValues
.put(StoreValue(StoreKey.currentUser.id, strValue: user?.id));
await db.storeValues.put(StoreValue(StoreKey.currentUser.id, strValue: user?.id));
});
}
}
@@ -89,9 +87,7 @@ Future<void> _migrateDeviceAsset(Isar db) async {
? (await db.androidDeviceAssets.where().findAll())
.map((a) => _DeviceAsset(assetId: a.id.toString(), hash: a.hash))
.toList()
: (await db.iOSDeviceAssets.where().findAll())
.map((i) => _DeviceAsset(assetId: i.id, hash: i.hash))
.toList();
: (await db.iOSDeviceAssets.where().findAll()).map((i) => _DeviceAsset(assetId: i.id, hash: i.hash)).toList();
final PermissionState ps = await PhotoManager.requestPermissionExtend();
if (!ps.hasAccess) {
@@ -105,14 +101,10 @@ Future<void> _migrateDeviceAsset(Isar db) async {
}
List<_DeviceAsset> localAssets = [];
final List<AssetPathEntity> paths =
await PhotoManager.getAssetPathList(onlyAll: true);
final List<AssetPathEntity> paths = await PhotoManager.getAssetPathList(onlyAll: true);
if (paths.isEmpty) {
localAssets = (await db.assets
.where()
.anyOf(ids, (query, id) => query.localIdEqualTo(id.assetId))
.findAll())
localAssets = (await db.assets.where().anyOf(ids, (query, id) => query.localIdEqualTo(id.assetId)).findAll())
.map(
(a) => _DeviceAsset(assetId: a.localId!, dateTime: a.fileModifiedAt),
)
@@ -121,12 +113,9 @@ Future<void> _migrateDeviceAsset(Isar db) async {
final AssetPathEntity albumWithAll = paths.first;
final int assetCount = await albumWithAll.assetCountAsync;
final List<AssetEntity> allDeviceAssets =
await albumWithAll.getAssetListRange(start: 0, end: assetCount);
final List<AssetEntity> allDeviceAssets = await albumWithAll.getAssetListRange(start: 0, end: assetCount);
localAssets = allDeviceAssets
.map((a) => _DeviceAsset(assetId: a.id, dateTime: a.modifiedDateTime))
.toList();
localAssets = allDeviceAssets.map((a) => _DeviceAsset(assetId: a.id, dateTime: a.modifiedDateTime)).toList();
}
debugPrint("[MIGRATION] Device Asset Ids length - ${ids.length}");
@@ -205,8 +194,7 @@ Future<void> migrateBackupAlbumsToSqlite(
// Recents is a virtual album on Android, and we don't have it with the new sync
// If recents is selected previously, select all albums during migration except the excluded ones
if (Platform.isAndroid) {
final recentAlbum =
isarBackupAlbums.firstWhereOrNull((album) => album.id == 'isAll');
final recentAlbum = isarBackupAlbums.firstWhereOrNull((album) => album.id == 'isAll');
if (recentAlbum != null) {
await drift.localAlbumEntity.update().write(
const LocalAlbumEntityCompanion(
@@ -215,8 +203,7 @@ Future<void> migrateBackupAlbumsToSqlite(
);
final excluded = isarBackupAlbums
.where(
(album) =>
album.selection == isar_backup_album.BackupSelection.exclude,
(album) => album.selection == isar_backup_album.BackupSelection.exclude,
)
.map((album) => album.id)
.toList();
@@ -243,10 +230,8 @@ Future<void> migrateBackupAlbumsToSqlite(
backupSelection: Value(
switch (album.selection) {
isar_backup_album.BackupSelection.none => BackupSelection.none,
isar_backup_album.BackupSelection.select =>
BackupSelection.selected,
isar_backup_album.BackupSelection.exclude =>
BackupSelection.excluded,
isar_backup_album.BackupSelection.select => BackupSelection.selected,
isar_backup_album.BackupSelection.exclude => BackupSelection.excluded,
},
),
),
+1 -2
View File
@@ -41,8 +41,7 @@ class _RemoteAlbumSortHandlers {
List<RemoteAlbum> albums,
bool isReverse,
) {
final sorted =
albums.sorted((a, b) => a.assetCount.compareTo(b.assetCount));
final sorted = albums.sorted((a, b) => a.assetCount.compareTo(b.assetCount));
return (isReverse ? sorted.reversed : sorted).toList();
}
+7 -19
View File
@@ -24,10 +24,7 @@ void handleShareAssets(
showDialog(
context: context,
builder: (BuildContext buildContext) {
ref
.watch(shareServiceProvider)
.shareAssets(selection.toList(), context)
.then(
ref.watch(shareServiceProvider).shareAssets(selection.toList(), context).then(
(bool status) {
if (!status) {
ImmichToast.show(
@@ -56,14 +53,10 @@ Future<void> handleArchiveAssets(
}) async {
if (selection.isNotEmpty) {
shouldArchive ??= !selection.every((a) => a.isArchived);
await ref
.read(assetProvider.notifier)
.toggleArchive(selection, shouldArchive);
await ref.read(assetProvider.notifier).toggleArchive(selection, shouldArchive);
final message = shouldArchive
? 'moved_to_archive'
.t(context: context, args: {'count': selection.length})
: 'moved_to_library'
.t(context: context, args: {'count': selection.length});
? 'moved_to_archive'.t(context: context, args: {'count': selection.length})
: 'moved_to_library'.t(context: context, args: {'count': selection.length});
if (context.mounted) {
ImmichToast.show(
context: context,
@@ -83,9 +76,7 @@ Future<void> handleFavoriteAssets(
}) async {
if (selection.isNotEmpty) {
shouldFavorite ??= !selection.every((a) => a.isFavorite);
await ref
.watch(assetProvider.notifier)
.toggleFavorite(selection, shouldFavorite);
await ref.watch(assetProvider.notifier).toggleFavorite(selection, shouldFavorite);
final assetOrAssets = selection.length > 1 ? 'assets' : 'asset';
final toastMessage = shouldFavorite
@@ -140,8 +131,7 @@ Future<void> handleEditLocation(
if (selection.length == 1) {
final asset = selection.first;
final assetWithExif = await ref.watch(assetServiceProvider).loadExif(asset);
if (assetWithExif.exifInfo?.latitude != null &&
assetWithExif.exifInfo?.longitude != null) {
if (assetWithExif.exifInfo?.latitude != null && assetWithExif.exifInfo?.longitude != null) {
initialLatLng = LatLng(
assetWithExif.exifInfo!.latitude!,
assetWithExif.exifInfo!.longitude!,
@@ -168,9 +158,7 @@ Future<void> handleSetAssetsVisibility(
List<Asset> selection,
) async {
if (selection.isNotEmpty) {
await ref
.watch(assetProvider.notifier)
.setLockedView(selection, visibility);
await ref.watch(assetProvider.notifier).setLockedView(selection, visibility);
final assetOrAssets = selection.length > 1 ? 'assets' : 'asset';
final toastMessage = visibility == AssetVisibilityEnum.locked
+1 -2
View File
@@ -9,8 +9,7 @@ class Throttler {
Throttler({required this.interval});
T? run<T>(T Function() action) {
if (_lastActionTime == null ||
(DateTime.now().difference(_lastActionTime!) > interval)) {
if (_lastActionTime == null || (DateTime.now().difference(_lastActionTime!) > interval)) {
final response = action();
_lastActionTime = DateTime.now();
return response;
+1 -2
View File
@@ -12,8 +12,7 @@ String getAltText(
if (exifInfo?.description != null && exifInfo!.description!.isNotEmpty) {
return exifInfo.description!;
}
final (template, args) =
getAltTextTemplate(exifInfo, fileCreatedAt, type, peopleNames);
final (template, args) = getAltTextTemplate(exifInfo, fileCreatedAt, type, peopleNames);
return template.t(args: args);
}
+1 -2
View File
@@ -4,8 +4,7 @@ import 'package:punycode/punycode.dart';
String sanitizeUrl(String url) {
// Add schema if none is set
final urlWithSchema =
url.trimLeft().startsWith(RegExp(r"https?://")) ? url : "https://$url";
final urlWithSchema = url.trimLeft().startsWith(RegExp(r"https?://")) ? url : "https://$url";
// Remove trailing slash(es)
return urlWithSchema.trimRight().replaceFirst(RegExp(r"/+$"), "");