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

修复new了线程却忘记启动

上级 25814230
......@@ -73,9 +73,15 @@ public class Updater extends ReactContextBaseJavaModule {
int numRead = is.read(buf);
count += numRead;
int progress = (int) (((float) count / length) * 100);
cb.invoke("downloading", progress, count, length);
if (cb != null) {
Log.i("Updater", cb.toString());
cb.invoke("downloading", progress, count, length);
}
if (numRead <= 0) {
cb.invoke("downloaded", progress, count, length);
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论