Fix bug where widget would get out of sync w/ app once collected artifacts were explored

This commit is contained in:
Shawn 2024-01-18 11:22:31 -07:00
parent 97cb83733c
commit 590e542b34

View File

@ -57,10 +57,11 @@ class CollectiblesLogic with ThrottledSaveLoadMixin {
if (state == CollectibleState.discovered) _discoveredCount++; if (state == CollectibleState.discovered) _discoveredCount++;
if (state == CollectibleState.explored) _exploredCount++; if (state == CollectibleState.explored) _exploredCount++;
}); });
HomeWidget.saveWidgetData<int>('discoveredCount', _discoveredCount).then((value){ final foundCount = discoveredCount + exploredCount;
HomeWidget.saveWidgetData<int>('discoveredCount', foundCount).then((value) {
HomeWidget.updateWidget(iOSName: _appName); HomeWidget.updateWidget(iOSName: _appName);
}); });
debugPrint('setting discovered count for home widget $_discoveredCount'); debugPrint('setting discoveredCount for home widget $foundCount');
} }
/// Get a discovered item, sorted by the order of wondersLogic.all /// Get a discovered item, sorted by the order of wondersLogic.all