mirror of
https://github.com/immich-app/immich.git
synced 2026-04-21 09:19:00 -04:00
use adjustment time in iOS for hash reset
# Conflicts: # mobile/lib/infrastructure/repositories/local_album.repository.dart # mobile/lib/presentation/pages/drift_asset_troubleshoot.page.dart
This commit is contained in:
parent
e700bb5467
commit
deb01f9dfc
@ -300,7 +300,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
||||
return Future.value();
|
||||
}
|
||||
|
||||
return _db.batch((batch) async {
|
||||
await _db.batch((batch) async {
|
||||
for (final asset in localAssets) {
|
||||
final companion = LocalAssetEntityCompanion.insert(
|
||||
name: asset.name,
|
||||
@ -314,11 +314,35 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
|
||||
checksum: const Value(null),
|
||||
orientation: Value(asset.orientation),
|
||||
isFavorite: Value(asset.isFavorite),
|
||||
adjustmentTime: Value(asset.adjustmentTime),
|
||||
latitude: Value(asset.latitude),
|
||||
longitude: Value(asset.longitude),
|
||||
);
|
||||
batch.insert<$LocalAssetEntityTable, LocalAssetEntityData>(
|
||||
_db.localAssetEntity,
|
||||
companion.copyWith(checksum: const Value(null)),
|
||||
onConflict: DoUpdate(
|
||||
(old) => companion,
|
||||
where: (old) => CurrentPlatform.isAndroid
|
||||
? old.updatedAt.isNotValue(asset.updatedAt)
|
||||
: old.latitude.equalsNullable(asset.latitude).not() |
|
||||
old.longitude.equalsNullable(asset.longitude).not() |
|
||||
old.createdAt.isNotValue(asset.createdAt),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Reset checksum if asset changed
|
||||
return _db.batch((batch) async {
|
||||
for (final asset in localAssets) {
|
||||
final companion = const LocalAssetEntityCompanion(checksum: Value(null));
|
||||
batch.update(
|
||||
_db.localAssetEntity,
|
||||
companion,
|
||||
onConflict: DoUpdate((_) => companion, where: (old) => old.updatedAt.isNotValue(asset.updatedAt)),
|
||||
where: (row) => CurrentPlatform.isIOS
|
||||
? row.adjustmentTime.equalsNullable(asset.adjustmentTime).not()
|
||||
: row.updatedAt.isNotValue(asset.updatedAt),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user