Update manager_api.dart

This commit is contained in:
Benjamin Halko 2023-10-21 13:00:06 -07:00
parent 72a99bc7fb
commit 527951397f
No known key found for this signature in database
GPG Key ID: 790C70040EB331A0

View File

@ -284,8 +284,13 @@ class ManagerAPI {
Future<void> setPatchedAppHistory(
List<PatchedApplication> patchedAppHistory,
) async {
if (patchedAppHistory.length > 10) {
// remove oldest app and delete app.outFilePath
patchedAppHistory.sort((a, b) => b.patchDate.compareTo(a.patchDate));
while (patchedAppHistory.length > 3) {
final File file = File(patchedAppHistory[3].outFilePath);
if (await file.exists()) {
await file.delete();
}
patchedAppHistory.removeAt(3);
}
await _prefs.setStringList(