mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(mobile): Library page rework (album sorting, favorites) (#1501)
* Add album sorting * Change AppBar to match photos page behaviour * Add buttons * First crude implementation of the favorites page * Clean up * Add favorite button * i18n * Add star indicator to thumbnail * Add favorite logic to separate provider and fix favorite behavior in album * Review feedback (Add isFavorite variable) * dev: style buttons * dev: styled drop down button --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -268,6 +268,26 @@ class AssetNotifier extends StateNotifier<AssetsState> {
|
||||
.where((a) => a.status == DeleteAssetStatus.SUCCESS)
|
||||
.map((a) => a.id);
|
||||
}
|
||||
|
||||
Future<bool> toggleFavorite(Asset asset, bool status) async {
|
||||
final newAsset = await _assetService.changeFavoriteStatus(asset, status);
|
||||
|
||||
if (newAsset == null) {
|
||||
log.severe("Change favorite status failed for asset ${asset.id}");
|
||||
return asset.isFavorite;
|
||||
}
|
||||
|
||||
await _updateAssetsState(
|
||||
state.allAssets.map((a) {
|
||||
if (asset.id == a.id) {
|
||||
return Asset.remote(newAsset);
|
||||
}
|
||||
return a;
|
||||
}).toList(),
|
||||
);
|
||||
|
||||
return newAsset.isFavorite;
|
||||
}
|
||||
}
|
||||
|
||||
final assetProvider = StateNotifierProvider<AssetNotifier, AssetsState>((ref) {
|
||||
|
||||
Reference in New Issue
Block a user