refactor(mobile): reworked Asset, store all required fields from local & remote (#1539)

replace usage of AssetResponseDto with Asset

Add new class ExifInfo to store data from ExifResponseDto
This commit is contained in:
Fynn Petersen-Frey
2023-02-04 21:42:42 +01:00
committed by GitHub
parent 7bd2455175
commit 0048662182
28 changed files with 626 additions and 504 deletions

View File

@@ -1,7 +1,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:immich_mobile/modules/home/ui/asset_grid/asset_grid_data_structure.dart';
import 'package:immich_mobile/shared/models/asset.dart';
import 'package:openapi/api.dart';
void main() {
final List<Asset> testAssets = [];
@@ -13,24 +12,14 @@ void main() {
DateTime date = DateTime(2022, month, day);
testAssets.add(
Asset.remote(
AssetResponseDto(
type: AssetTypeEnum.IMAGE,
id: '$i',
deviceAssetId: '',
ownerId: '',
deviceId: '',
originalPath: '',
resizePath: '',
createdAt: date.toIso8601String(),
modifiedAt: date.toIso8601String(),
isFavorite: false,
mimeType: 'image/jpeg',
duration: '',
webpPath: '',
encodedVideoPath: '',
livePhotoVideoId: '',
),
Asset(
deviceAssetId: '$i',
deviceId: '',
ownerId: '',
createdAt: date,
modifiedAt: date,
durationInSeconds: 0,
fileName: '',
),
);
}
@@ -70,11 +59,20 @@ void main() {
// Day 1
// 15 Assets => 5 Rows
expect(renderList.elements.length, 18);
expect(renderList.elements[0].type, RenderAssetGridElementType.monthTitle);
expect(
renderList.elements[0].type,
RenderAssetGridElementType.monthTitle,
);
expect(renderList.elements[0].date.month, 1);
expect(renderList.elements[7].type, RenderAssetGridElementType.monthTitle);
expect(
renderList.elements[7].type,
RenderAssetGridElementType.monthTitle,
);
expect(renderList.elements[7].date.month, 2);
expect(renderList.elements[11].type, RenderAssetGridElementType.monthTitle);
expect(
renderList.elements[11].type,
RenderAssetGridElementType.monthTitle,
);
expect(renderList.elements[11].date.month, 10);
});