提交 c8707552 authored 作者: vipcxj's avatar vipcxj

增加调试代码

上级 de3e057a
......@@ -37,12 +37,15 @@ public class Updater extends ReactContextBaseJavaModule {
@ReactMethod
public synchronized void update(final String sUrl, final Callback cb, final Promise promise) {
Log.i("Updater/url", sUrl);
Log.i("Updater/cb", cb != null ? cb.toString() : "null");
if (!updating) {
updating = true;
cancel = false;
new Thread(new Runnable() {
@Override
public void run() {
Log.i("Updater", cb != null ? cb.toString() : "null");
InputStream is = null;
FileOutputStream fos = null;
File cacheFile = Utils.getDiskCacheDir(getCurrentActivity());
......@@ -74,12 +77,10 @@ public class Updater extends ReactContextBaseJavaModule {
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;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论