Use App IDs for app lookups and deprecate the old name-based lookup function

This commit is contained in:
Cameron Gutman
2015-02-27 13:29:41 -05:00
parent a4ec619e5a
commit fb8fc54bb1
3 changed files with 47 additions and 12 deletions
@@ -304,11 +304,24 @@ public class NvHTTP {
return Integer.parseInt(game);
}
public NvApp getApp(String app) throws IOException,
XmlPullParserException {
public NvApp getAppById(int appId) throws IOException, XmlPullParserException {
LinkedList<NvApp> appList = getAppList();
for (NvApp appFromList : appList) {
if (appFromList.getAppName().equals(app)) {
if (appFromList.getAppId() == appId) {
return appFromList;
}
}
return null;
}
/* NOTE: Only use this function if you know what you're doing.
* It's totally valid to have two apps named the same thing,
* or even nothing at all! Look apps up by ID if at all possible
* using the above function */
public NvApp getAppByName(String appName) throws IOException, XmlPullParserException {
LinkedList<NvApp> appList = getAppList();
for (NvApp appFromList : appList) {
if (appFromList.getAppName().equals(appName)) {
return appFromList;
}
}