Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions mobile/lib/domain/models/exif.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ class ExifInfo {
final int? fileSize;
final String? description;
final bool isFlipped;
final double? width;
final double? height;
final String? orientation;
final String? timeZone;
final DateTime? dateTimeOriginal;
Expand Down Expand Up @@ -46,8 +44,6 @@ class ExifInfo {
this.fileSize,
this.description,
this.orientation,
this.width,
this.height,
this.timeZone,
this.dateTimeOriginal,
this.isFlipped = false,
Expand All @@ -72,8 +68,6 @@ class ExifInfo {
return other.fileSize == fileSize &&
other.description == description &&
other.isFlipped == isFlipped &&
other.width == width &&
other.height == height &&
other.orientation == orientation &&
other.timeZone == timeZone &&
other.dateTimeOriginal == dateTimeOriginal &&
Expand All @@ -98,8 +92,6 @@ class ExifInfo {
description.hashCode ^
orientation.hashCode ^
isFlipped.hashCode ^
width.hashCode ^
height.hashCode ^
timeZone.hashCode ^
dateTimeOriginal.hashCode ^
latitude.hashCode ^
Expand All @@ -123,8 +115,6 @@ class ExifInfo {
fileSize: ${fileSize ?? 'NA'},
description: ${description ?? 'NA'},
orientation: ${orientation ?? 'NA'},
width: ${width ?? 'NA'},
height: ${height ?? 'NA'},
isFlipped: $isFlipped,
timeZone: ${timeZone ?? 'NA'},
dateTimeOriginal: ${dateTimeOriginal ?? 'NA'},
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/domain/services/asset.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class AssetService {
if (asset.hasRemote) {
final exif = await getExif(asset);
isFlipped = ExifDtoConverter.isOrientationFlipped(exif?.orientation);
width = exif?.width ?? asset.width?.toDouble();
height = exif?.height ?? asset.height?.toDouble();
width = asset.width?.toDouble();
height = asset.height?.toDouble();
} else if (asset is LocalAsset) {
isFlipped = CurrentPlatform.isAndroid && (asset.orientation == 90 || asset.orientation == 270);
width = asset.width?.toDouble();
Expand Down
2 changes: 0 additions & 2 deletions mobile/lib/infrastructure/entities/exif.entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ extension RemoteExifEntityDataDomainEx on RemoteExifEntityData {
f: fNumber?.toDouble(),
mm: focalLength?.toDouble(),
lens: lens,
width: width?.toDouble(),
height: height?.toDouble(),
isFlipped: ExifDtoConverter.isOrientationFlipped(orientation),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ class SyncStreamRepository extends DriftDatabaseRepository {
country: Value(exif.country),
dateTimeOriginal: Value(exif.dateTimeOriginal),
description: Value(exif.description),
height: Value(exif.exifImageHeight),
width: Value(exif.exifImageWidth),
exposureTime: Value(exif.exposureTime),
fNumber: Value(exif.fNumber),
fileSize: Value(exif.fileSizeInByte),
Expand All @@ -244,6 +242,16 @@ class SyncStreamRepository extends DriftDatabaseRepository {
);
}
});

await _db.batch((batch) {
for (final exif in data) {
batch.update(
_db.remoteAssetEntity,
RemoteAssetEntityCompanion(width: Value(exif.exifImageWidth), height: Value(exif.exifImageHeight)),
where: (row) => row.id.equals(exif.assetId),
);
}
});
} catch (error, stack) {
_logger.severe('Error: updateAssetsExifV1 - $debugLabel', error, stack);
rethrow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ class _AssetPropertiesSectionState extends ConsumerState<_AssetPropertiesSection
value: exif.fileSize != null ? '${(exif.fileSize! / 1024 / 1024).toStringAsFixed(2)} MB' : null,
),
_PropertyItem(label: 'Description', value: exif.description),
_PropertyItem(label: 'EXIF Width', value: exif.width?.toString()),
_PropertyItem(label: 'EXIF Height', value: exif.height?.toString()),
_PropertyItem(label: 'Date Taken', value: exif.dateTimeOriginal?.toString()),
_PropertyItem(label: 'Time Zone', value: exif.timeZone),
_PropertyItem(label: 'Camera Make', value: exif.make),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
}

String _getFileInfo(BaseAsset asset, ExifInfo? exifInfo) {
final height = asset.height ?? exifInfo?.height;
final width = asset.width ?? exifInfo?.width;
final height = asset.height;
final width = asset.width;
final resolution = (width != null && height != null) ? "${width.toInt()} x ${height.toInt()}" : null;
final fileSize = exifInfo?.fileSize != null ? formatBytes(exifInfo!.fileSize!) : null;

Expand Down
10 changes: 8 additions & 2 deletions mobile/lib/utils/migration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import 'package:isar/isar.dart';
// ignore: import_rule_photo_manager
import 'package:photo_manager/photo_manager.dart';

const int targetVersion = 17;
const int targetVersion = 18;

Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {
final hasVersion = Store.tryGet(StoreKey.version) != null;
Expand Down Expand Up @@ -63,7 +63,8 @@ Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {
await Store.populateCache();
}

await handleBetaMigration(version, await _isNewInstallation(db, drift), SyncStreamRepository(drift));
final syncStreamRepository = SyncStreamRepository(drift);
await handleBetaMigration(version, await _isNewInstallation(db, drift), syncStreamRepository);

if (version < 17 && Store.isBetaTimelineEnabled) {
final delay = Store.get(StoreKey.backupTriggerDelay, AppSettingsEnum.backupTriggerDelay.defaultValue);
Expand All @@ -72,6 +73,11 @@ Future<void> migrateDatabaseIfNeeded(Isar db, Drift drift) async {
}
}

if (version < 18 && Store.isBetaTimelineEnabled) {
await syncStreamRepository.reset();
await Store.put(StoreKey.shouldResetSync, true);
}

if (targetVersion >= 12) {
await Store.put(StoreKey.version, targetVersion);
return;
Expand Down
Loading