[app] Don't suggest incompatible versions in app details

This commit is contained in:
Torsten Grote
2024-06-06 10:15:06 -03:00
parent 4a3d9ba2d2
commit de643551e3
2 changed files with 10 additions and 1 deletions

View File

@@ -539,6 +539,7 @@ public class App implements Comparable<App>, Parcelable {
}
}
// use the first of the list, before we don't choose anything
// TODO does this still make sense? Maybe better to not suggest anything in this case?
if (apk == null && apks.size() > 0) {
apk = apks.get(0);
}

View File

@@ -149,6 +149,7 @@ public class AppDetailsRecyclerViewAdapter
items.clear();
versions.clear();
suggestedApk = null;
// Get versions
compatibleVersionsDifferentSigner.clear();
@@ -170,7 +171,14 @@ public class AppDetailsRecyclerViewAdapter
}
}
}
if (apks != null) suggestedApk = app.findSuggestedApk(apks, appPrefs);
if (apks != null) {
final Apk foundApk = app.findSuggestedApk(apks, appPrefs);
// only use suggested APK, if app not installed, or signer matches installed signer
// because otherwise, there's no use in suggesting it as we can't install it anyway
if (app.installedSigner == null || (foundApk != null && app.installedSigner.equals(foundApk.signer))) {
suggestedApk = foundApk;
}
}
addItem(VIEWTYPE_HEADER);
if (!app.getAllScreenshots().isEmpty()) addItem(VIEWTYPE_SCREENSHOTS);