Skip to content

Commit

Permalink
fix(android): set init complete after bridge ready
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 authored and zoomchan-cxj committed Aug 23, 2022
1 parent d983051 commit 04c8bdc
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,39 +275,40 @@ public void Call(long result, Message message, String action,
String info =
"initJSBridge error: result=" + result + ", reason="
+ reason;
reportException(new Throwable(info));
RuntimeException exception = new RuntimeException(info);
if (callback != null) {
callback.callback(false, exception);
}
return;
}

if (enableTurbo()) {
mTurboModuleManager = new TurboModuleManager(mContext);
mTurboModuleManager.install(mHippyBridge.getV8RuntimeId());
}

if (mThirdPartyAdapter != null) {
mThirdPartyAdapter.onRuntimeInit(mHippyBridge.getV8RuntimeId());
}
mContext.getStartTimeMonitor()
.startEvent(
HippyEngineMonitorEvent.ENGINE_LOAD_EVENT_LOAD_COMMONJS);

mIsInit = true;
if (mCoreBundleLoader != null) {
mCoreBundleLoader
.load(mHippyBridge, new NativeCallback(mHandler) {
@Override
public void Call(long result, Message message,
String action, String reason) {
mIsInit = result == 0;
RuntimeException exception = null;
if (!mIsInit) {
boolean ret = (result == 0);
if (!ret) {
exception = new RuntimeException(
"load coreJsBundle failed, check your core jsBundle:"
+ reason);
}
callback.callback(mIsInit, exception);
callback.callback(ret, exception);
}
});
} else {
mIsInit = true;
callback.callback(mIsInit, null);
}
}
Expand Down

0 comments on commit 04c8bdc

Please sign in to comment.