提交 55bf05a9 authored 作者: 吴强's avatar 吴强
......@@ -73,9 +73,15 @@ public class Updater extends ReactContextBaseJavaModule {
int numRead = is.read(buf);
count += numRead;
int progress = (int) (((float) count / length) * 100);
if (cb != null) {
Log.i("Updater", cb.toString());
cb.invoke("downloading", progress, count, length);
}
if (numRead <= 0) {
if (cb != null) {
Log.i("Updater", cb.toString());
cb.invoke("downloaded", progress, count, length);
}
break;
}
fos.write(buf, 0, numRead);
......@@ -117,7 +123,7 @@ public class Updater extends ReactContextBaseJavaModule {
}
}
}
});
}).start();
} else {
promise.reject("ERROR_UPDATE", "There is another updater worker running already.");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论