1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

feat(mobile): Shows a toast after adding to favorites (#1714)

* shows toast on adding assets to favorites

* add to favorites first

* typo
This commit is contained in:
martyfuhry 2023-02-10 01:05:39 -05:00 committed by GitHub
parent b71a86142b
commit e6f9d9a31a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,10 +101,20 @@ class HomePage extends HookConsumerWidget {
}
void onFavoriteAssets() {
final remoteAssests = remoteOnlySelection(
final remoteAssets = remoteOnlySelection(
localErrorMessage: 'Can not favorite local assets yet, skipping',
);
ref.watch(favoriteProvider.notifier).addToFavorites(remoteAssests);
if (remoteAssets.isNotEmpty) {
ref.watch(favoriteProvider.notifier).addToFavorites(remoteAssets);
final assetOrAssets = remoteAssets.length > 1 ? 'assets' : 'asset';
ImmichToast.show(
context: context,
msg: 'Added ${remoteAssets.length} $assetOrAssets to favorites',
gravity: ToastGravity.BOTTOM,
);
}
selectionEnabledHook.value = false;
}