mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore(mobile): add debugPrint lint rule (#21872)
* add lint rule
* update usages
* stragglers
* use dcm
* formatting
* test ci
* Revert "test ci"
This reverts commit 8f864c4e4d.
* revert whitespace change
This commit is contained in:
parent
23aa661324
commit
17bbcdf584
38 changed files with 168 additions and 153 deletions
|
|
@ -4,7 +4,6 @@ import 'dart:io';
|
|||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||
import 'package:immich_mobile/entities/album.entity.dart';
|
||||
|
|
@ -26,6 +25,7 @@ import 'package:immich_mobile/utils/diff.dart';
|
|||
import 'package:isar/isar.dart';
|
||||
// ignore: import_rule_photo_manager
|
||||
import 'package:photo_manager/photo_manager.dart';
|
||||
import 'package:immich_mobile/utils/debug_print.dart';
|
||||
|
||||
const int targetVersion = 15;
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ Future<bool> _isNewInstallation(Isar db, Drift drift) async {
|
|||
|
||||
return true;
|
||||
} catch (error) {
|
||||
debugPrint("[MIGRATION] Error checking if new installation: $error");
|
||||
dPrint(() => "[MIGRATION] Error checking if new installation: $error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -143,10 +143,7 @@ Future<void> _migrateDeviceAsset(Isar db) async {
|
|||
|
||||
final PermissionState ps = await PhotoManager.requestPermissionExtend();
|
||||
if (!ps.hasAccess) {
|
||||
if (kDebugMode) {
|
||||
debugPrint("[MIGRATION] Photo library permission not granted. Skipping device asset migration.");
|
||||
}
|
||||
|
||||
dPrint(() => "[MIGRATION] Photo library permission not granted. Skipping device asset migration.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -166,8 +163,8 @@ Future<void> _migrateDeviceAsset(Isar db) async {
|
|||
localAssets = allDeviceAssets.map((a) => _DeviceAsset(assetId: a.id, dateTime: a.modifiedDateTime)).toList();
|
||||
}
|
||||
|
||||
debugPrint("[MIGRATION] Device Asset Ids length - ${ids.length}");
|
||||
debugPrint("[MIGRATION] Local Asset Ids length - ${localAssets.length}");
|
||||
dPrint(() => "[MIGRATION] Device Asset Ids length - ${ids.length}");
|
||||
dPrint(() => "[MIGRATION] Local Asset Ids length - ${localAssets.length}");
|
||||
ids.sort((a, b) => a.assetId.compareTo(b.assetId));
|
||||
localAssets.sort((a, b) => a.assetId.compareTo(b.assetId));
|
||||
final List<DeviceAssetEntity> toAdd = [];
|
||||
|
|
@ -182,20 +179,14 @@ Future<void> _migrateDeviceAsset(Isar db) async {
|
|||
return false;
|
||||
},
|
||||
onlyFirst: (deviceAsset) {
|
||||
if (kDebugMode) {
|
||||
debugPrint('[MIGRATION] Local asset not found in DeviceAsset: ${deviceAsset.assetId}');
|
||||
}
|
||||
dPrint(() => '[MIGRATION] Local asset not found in DeviceAsset: ${deviceAsset.assetId}');
|
||||
},
|
||||
onlySecond: (asset) {
|
||||
if (kDebugMode) {
|
||||
debugPrint('[MIGRATION] Local asset not found in DeviceAsset: ${asset.assetId}');
|
||||
}
|
||||
dPrint(() => '[MIGRATION] Local asset not found in DeviceAsset: ${asset.assetId}');
|
||||
},
|
||||
);
|
||||
|
||||
if (kDebugMode) {
|
||||
debugPrint("[MIGRATION] Total number of device assets migrated - ${toAdd.length}");
|
||||
}
|
||||
dPrint(() => "[MIGRATION] Total number of device assets migrated - ${toAdd.length}");
|
||||
|
||||
await db.writeTxn(() async {
|
||||
await db.deviceAssetEntitys.putAll(toAdd);
|
||||
|
|
@ -215,7 +206,7 @@ Future<void> migrateDeviceAssetToSqlite(Isar db, Drift drift) async {
|
|||
}
|
||||
});
|
||||
} catch (error) {
|
||||
debugPrint("[MIGRATION] Error while migrating device assets to SQLite: $error");
|
||||
dPrint(() => "[MIGRATION] Error while migrating device assets to SQLite: $error");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +254,7 @@ Future<void> migrateBackupAlbumsToSqlite(Isar db, Drift drift) async {
|
|||
}
|
||||
});
|
||||
} catch (error) {
|
||||
debugPrint("[MIGRATION] Error while migrating backup albums to SQLite: $error");
|
||||
dPrint(() => "[MIGRATION] Error while migrating backup albums to SQLite: $error");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +272,7 @@ Future<void> migrateStoreToSqlite(Isar db, Drift drift) async {
|
|||
}
|
||||
});
|
||||
} catch (error) {
|
||||
debugPrint("[MIGRATION] Error while migrating store values to SQLite: $error");
|
||||
dPrint(() => "[MIGRATION] Error while migrating store values to SQLite: $error");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +287,7 @@ Future<void> migrateStoreToIsar(Isar db, Drift drift) async {
|
|||
await db.storeValues.putAll(driftStoreValues);
|
||||
});
|
||||
} catch (error) {
|
||||
debugPrint("[MIGRATION] Error while migrating store values to Isar: $error");
|
||||
dPrint(() => "[MIGRATION] Error while migrating store values to Isar: $error");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue