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(