fix: init home widget on favorites fetch

This commit is contained in:
Prateek Sunal 2024-03-11 00:01:53 +05:30
parent 7ddb80c64e
commit 150da15683

View file

@ -15,6 +15,7 @@ import 'package:photos/services/collections_service.dart';
import 'package:photos/services/remote_sync_service.dart';
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
import 'package:photos/utils/crypto_util.dart';
import "package:photos/utils/home_widget_util.dart";
class FavoritesService {
late Configuration _config;
@ -51,6 +52,7 @@ class FavoritesService {
}
});
await _warmUpCache();
await _checkHomeWidget();
}
void dispose() {
@ -66,6 +68,12 @@ class FavoritesService {
}
}
Future<void> _checkHomeWidget() async {
if (await countHomeWidgets() > 0 && hasFavorites()) {
await initHomeWidget();
}
}
bool hasFavorites() {
return _cachedFavUploadedIDs.isNotEmpty;
}