Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
fix(app): validate if item thread exists
Browse files Browse the repository at this point in the history
Signed-off-by: Rafa Hernandez <[email protected]>
  • Loading branch information
rafaelje authored and Hector Rondon committed Sep 21, 2018
1 parent e95c3f5 commit aa41508
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ private AppThreadManager(MqttAndroidClient client) {
}

public void add(Context context, JSONObject jsonObj) {
if(!item.isEmpty()) {
for (int i = 0; i < item.size(); i++) {
if (item.get(i).toString().trim().contains(jsonObj.toString().trim())) {
return;
}
}
}

item.add(jsonObj);
process(context);
}
Expand Down Expand Up @@ -95,14 +103,16 @@ public void process(Context context) {

// check if the app exists with same version or older
Boolean bDownload = true;
if(appsArray.length>0 && Integer.parseInt(versionCode) > Integer.parseInt(appsArray[0].appVersionCode)) {
if(appsArray.length>0 && Integer.parseInt(versionCode) >= Integer.parseInt(appsArray[0].appVersionCode)) {
bDownload = false;
}

if(bDownload) {
// execute the policy
PoliciesController policiesController = new PoliciesController(context, this.client);
policiesController.installPackage(deployApp, id, versionCode, taskId);
} else {
finishProcess(context);
}
} catch (Exception ex) {
FlyveLog.e(ex.getMessage());
Expand Down

0 comments on commit aa41508

Please sign in to comment.