Skip to content

Commit

Permalink
fix: android build
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Jul 2, 2022
1 parent fe02774 commit 3e2f154
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.json.JSONException;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;

@CapacitorPlugin(name = "CapacitorUpdater")
Expand Down Expand Up @@ -133,7 +134,7 @@ public void notifyDownload(final String id, final int percent) {
try {
final JSObject ret = new JSObject();
ret.put("percent", percent);
var bundle = this.implementation.getBundleInfo(id).toJSON();
JSObject bundle = this.implementation.getBundleInfo(id).toJSON();
ret.put("bundle", bundle);
this.notifyListeners("download", ret);
if (percent == 100) {
Expand Down Expand Up @@ -302,7 +303,19 @@ public void getLatest(final PluginCall call) {
@Override
public void run() {
CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, (res) -> {
call.resolve(res);
final JSObject ret = new JSObject();
Iterator<String> keys = res.keys();
while(keys.hasNext()) {
String key = keys.next();
if (res.has(key)) {
try {
ret.put(key, res.get(key));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
call.resolve(ret);
});
}
});
Expand Down

0 comments on commit 3e2f154

Please sign in to comment.