Ensure that favorites are parsed from fetched collections
This commit is contained in:
parent
95ccf02b2e
commit
0c48d83384
2 changed files with 10 additions and 2 deletions
|
@ -71,8 +71,15 @@ class FavoritesService {
|
|||
}
|
||||
}
|
||||
|
||||
Collection getFavoritesCollection() {
|
||||
Future<Collection> getFavoritesCollection() async {
|
||||
if (!_preferences.containsKey(_favoritesCollectionIDKey)) {
|
||||
final collections = _collectionsService.getOwnedCollections();
|
||||
for (final collection in collections) {
|
||||
if (collection.type == CollectionType.favorites) {
|
||||
await _preferences.setInt(_favoritesCollectionIDKey, collection.id);
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return _collectionsService
|
||||
|
|
|
@ -114,7 +114,8 @@ class _CollectionsGalleryWidgetState extends State<CollectionsGalleryWidget> {
|
|||
});
|
||||
if (favorites.length > 0) {
|
||||
collections.add(CollectionWithThumbnail(
|
||||
FavoritesService.instance.getFavoritesCollection(), favorites[0]));
|
||||
await FavoritesService.instance.getFavoritesCollection(),
|
||||
favorites[0]));
|
||||
}
|
||||
return CollectionItems(folders, collections);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue