feat(mobile): Multiselect add to favorite from the timeline (#1558)

* multiselect add to favorites
This commit is contained in:
martyfuhry
2023-02-06 07:59:56 -05:00
committed by GitHub
parent 2139853dd9
commit b8d2f5b373
4 changed files with 57 additions and 21 deletions

View File

@@ -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;
}