mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(mobile): Multiselect add to favorite from the timeline (#1558)
* multiselect add to favorites
This commit is contained in:
parent
2139853dd9
commit
b8d2f5b373
4 changed files with 57 additions and 21 deletions
|
|
@ -277,14 +277,12 @@ class AssetNotifier extends StateNotifier<AssetsState> {
|
|||
return asset.isFavorite;
|
||||
}
|
||||
|
||||
await _updateAssetsState(
|
||||
state.allAssets.map((a) {
|
||||
if (asset.id == a.id) {
|
||||
return Asset.remote(newAsset);
|
||||
}
|
||||
return a;
|
||||
}).toList(),
|
||||
);
|
||||
final index = state.allAssets.indexWhere((a) => asset.id == a.id);
|
||||
if (index > 0) {
|
||||
state.allAssets.removeAt(index);
|
||||
state.allAssets.insert(index, Asset.remote(newAsset));
|
||||
_updateAssetsState(state.allAssets);
|
||||
}
|
||||
|
||||
return newAsset.isFavorite;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue