mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-16 14:46:44 +02:00
Update checking improvements (#38)
Still no auto retry for rate-limit. Instead, rate-limit errors are ignored and the unchecked Apps have to wait until the next cycle. Even this needs more testing before release.
This commit is contained in:
@ -297,12 +297,23 @@ class AppsProvider with ChangeNotifier {
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<List<App>> checkUpdates() async {
|
||||
Future<List<App>> checkUpdates({DateTime? ignoreAfter}) async {
|
||||
List<App> updates = [];
|
||||
if (!gettingUpdates) {
|
||||
gettingUpdates = true;
|
||||
|
||||
List<String> appIds = apps.keys.toList();
|
||||
if (ignoreAfter != null) {
|
||||
appIds = appIds
|
||||
.where((id) =>
|
||||
apps[id]!.app.lastUpdateCheck != null &&
|
||||
apps[id]!.app.lastUpdateCheck!.isBefore(ignoreAfter))
|
||||
.toList();
|
||||
}
|
||||
appIds.sort((a, b) => (apps[a]!.app.lastUpdateCheck ??
|
||||
DateTime.fromMicrosecondsSinceEpoch(0))
|
||||
.compareTo(apps[b]!.app.lastUpdateCheck ??
|
||||
DateTime.fromMicrosecondsSinceEpoch(0)));
|
||||
for (int i = 0; i < appIds.length; i++) {
|
||||
App? newApp = await getUpdate(appIds[i]);
|
||||
if (newApp != null) {
|
||||
|
Reference in New Issue
Block a user