Publish event when favorites are updated

This commit is contained in:
Vishnu Mohandas 2020-06-07 01:37:23 +05:30
parent 7745776158
commit 1bd81cc5f9

View file

@ -1,3 +1,5 @@
import 'package:photos/core/event_bus.dart';
import 'package:photos/events/local_photos_updated_event.dart';
import 'package:photos/models/photo.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -28,6 +30,7 @@ class FavoritePhotosRepository {
} else {
liked.remove(photo.generatedId.toString());
}
Bus.instance.fire(LocalPhotosUpdatedEvent());
return _preferences
.setStringList(_favoritePhotoIdsKey, liked.toList())
.then((_) => isLiked);