Skip to content

Commit

Permalink
fix: checksum issue
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Oct 28, 2022
1 parent f00713b commit 0769550
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public void run() {
Log.i(CapacitorUpdater.TAG, "message " + res.get("message"));
if (res.has("major") && res.getBoolean("major") && res.has("version")) {
final JSObject majorAvailable = new JSObject();
majorAvailable.put("version", (String) res.get("version"));
majorAvailable.put("version", res.getString("version"));
CapacitorUpdaterPlugin.this.notifyListeners("majorAvailable", majorAvailable);
}
final JSObject retNoNeed = new JSObject();
Expand All @@ -612,13 +612,13 @@ public void run() {
return;
}

if (!res.has("url") || !CapacitorUpdaterPlugin.this.isValidURL((String) res.get("url"))) {
if (!res.has("url") || !CapacitorUpdaterPlugin.this.isValidURL(res.getString("url"))) {
Log.e(CapacitorUpdater.TAG, "Error no url or wrong format");
final JSObject retNoNeed = new JSObject();
retNoNeed.put("bundle", current.toJSON());
CapacitorUpdaterPlugin.this.notifyListeners("noNeedUpdate", retNoNeed);
}
final String latestVersionName = (String) res.get("version");
final String latestVersionName = res.getString("version");

if (
latestVersionName != null &&
Expand Down Expand Up @@ -687,10 +687,10 @@ public void run() {
". Update will occur next time app moves to background."
);

final String url = (String) res.get("url");
final String url = res.getString("url");
final BundleInfo next =
CapacitorUpdaterPlugin.this.implementation.download(url, latestVersionName);
final String checksum = (String) res.get("checksum");
final String checksum = res.has("checksum") ? res.getString("checksum") : "";
if (!checksum.equals("") && !next.getChecksum().equals(checksum)) {
Log.e(
CapacitorUpdater.TAG,
Expand Down

0 comments on commit 0769550

Please sign in to comment.