more refactors and logs page handling

This commit is contained in:
shenlong-tanwen
2024-10-23 02:30:46 +05:30
parent 8f47645cdb
commit a0afea04d8
90 changed files with 2386 additions and 584 deletions
+8 -8
View File
@@ -71,8 +71,8 @@ class Asset {
createdTime: createdTime ?? this.createdTime,
modifiedTime: modifiedTime ?? this.modifiedTime,
duration: duration ?? this.duration,
localId: localId != null ? localId() : this.localId,
remoteId: remoteId != null ? remoteId() : this.remoteId,
localId: localId == null ? this.localId : localId(),
remoteId: remoteId == null ? this.remoteId : remoteId(),
livePhotoVideoId: livePhotoVideoId ?? this.livePhotoVideoId,
);
}
@@ -89,20 +89,20 @@ class Asset {
if (newAsset.modifiedTime.isAfter(existingAsset.modifiedTime)) {
return newAsset.copyWith(
id: newAsset.id ?? existingAsset.id,
height: newAsset.height ?? existingAsset.height,
width: newAsset.width ?? existingAsset.width,
createdTime: oldestCreationTime,
localId: () => existingAsset.localId ?? newAsset.localId,
remoteId: () => existingAsset.remoteId ?? newAsset.remoteId,
width: newAsset.width ?? existingAsset.width,
height: newAsset.height ?? existingAsset.height,
createdTime: oldestCreationTime,
);
}
return existingAsset.copyWith(
height: existingAsset.height ?? newAsset.height,
width: existingAsset.width ?? newAsset.width,
createdTime: oldestCreationTime,
localId: () => existingAsset.localId ?? newAsset.localId,
remoteId: () => existingAsset.remoteId ?? newAsset.remoteId,
width: existingAsset.width ?? newAsset.width,
height: existingAsset.height ?? newAsset.height,
createdTime: oldestCreationTime,
);
}
@@ -4,8 +4,9 @@ import 'package:immich_mobile/domain/models/render_list_element.model.dart';
class RenderList {
final List<RenderListElement> elements;
late final int totalCount;
final DateTime modifiedTime;
RenderList({required this.elements}) {
RenderList({required this.elements, required this.modifiedTime}) {
final lastAssetElement =
elements.whereType<RenderListAssetElement>().lastOrNull;
if (lastAssetElement == null) {
@@ -16,6 +17,21 @@ class RenderList {
}
factory RenderList.empty() {
return RenderList(elements: []);
return RenderList(elements: [], modifiedTime: DateTime.now());
}
@override
String toString() =>
'RenderList(totalCount: $totalCount, modifiedTime: $modifiedTime)';
@override
bool operator ==(covariant RenderList other) {
if (identical(this, other)) return true;
return other.totalCount == totalCount &&
other.modifiedTime.isAtSameMomentAs(modifiedTime);
}
@override
int get hashCode => totalCount.hashCode ^ modifiedTime.hashCode;
}