From 527951397f9591c5fe7849875a1c2c83bee19bf1 Mon Sep 17 00:00:00 2001 From: Benjamin Halko Date: Sat, 21 Oct 2023 13:00:06 -0700 Subject: [PATCH] Update manager_api.dart --- lib/services/manager_api.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/services/manager_api.dart b/lib/services/manager_api.dart index ef2574aa..7136396c 100644 --- a/lib/services/manager_api.dart +++ b/lib/services/manager_api.dart @@ -284,8 +284,13 @@ class ManagerAPI { Future setPatchedAppHistory( List 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(