mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(mobile): add AssetState and proper asset updating (#2270)
* refactor(mobile): add AssetState and proper asset updating * generate files --------- Co-authored-by: Fynn Petersen-Frey <zoodyy@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
b970a40b4e
commit
e80d37bf8f
14 changed files with 256 additions and 98 deletions
|
|
@ -101,7 +101,7 @@ class AssetService {
|
|||
if (a.isRemote) {
|
||||
final dto = await _apiService.assetApi.getAssetById(a.remoteId!);
|
||||
if (dto != null && dto.exifInfo != null) {
|
||||
a = a.withUpdatesFromDto(dto);
|
||||
a.exifInfo = Asset.remote(dto).exifInfo!.copyWith(id: a.id);
|
||||
if (a.isInDb) {
|
||||
_db.writeTxn(() => a.put(_db));
|
||||
} else {
|
||||
|
|
@ -122,7 +122,7 @@ class AssetService {
|
|||
final dto =
|
||||
await _apiService.assetApi.updateAsset(asset.remoteId!, updateAssetDto);
|
||||
if (dto != null) {
|
||||
final updated = Asset.remote(dto).updateFromDb(asset);
|
||||
final updated = asset.updatedCopy(Asset.remote(dto));
|
||||
if (updated.isInDb) {
|
||||
await _db.writeTxn(() => updated.put(_db));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue