Skip to content

Commit

Permalink
Pass options to c++
Browse files Browse the repository at this point in the history
  • Loading branch information
YorkShen committed May 15, 2019
1 parent 25632d7 commit 406d1f0
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1576,12 +1576,14 @@ private void invokeCreateInstance(@NonNull WXSDKInstance instance, Script templa
WXJSObject optionsObj = new WXJSObject(WXJSObject.JSON,
options == null ? "{}"
: WXJsonUtils.fromObjectToJSONString(options));
optionsObj = optionObjConvert(isSandBoxContext, type, optionsObj);
optionsObj = optionObjConvert(isSandBoxContext, type, instance.getRenderStrategy(), optionsObj);
WXJSObject dataObj = new WXJSObject(WXJSObject.JSON,
data == null ? "{}" : data);

WXJSObject apiObj;
if (type == BundType.Rax || instance.getRenderStrategy() == WXRenderStrategy.DATA_RENDER) {
if (type == BundType.Rax ||
instance.getRenderStrategy() == WXRenderStrategy.DATA_RENDER ||
instance.getRenderStrategy() == WXRenderStrategy.DATA_RENDER_BINARY) {
if (mRaxApi == null) {
IWXJsFileLoaderAdapter iwxJsFileLoaderAdapter = WXSDKEngine.getIWXJsFileLoaderAdapter();
if(iwxJsFileLoaderAdapter != null) {
Expand Down Expand Up @@ -1659,8 +1661,8 @@ private void invokeCreateInstance(@NonNull WXSDKInstance instance, Script templa
}
}

public WXJSObject optionObjConvert(boolean useSandBox, BundType type, WXJSObject opt) {
if (!useSandBox || type == BundType.Others) {
public WXJSObject optionObjConvert(boolean useSandBox, BundType type, WXRenderStrategy renderStrategy, WXJSObject opt){
if (!useSandBox || (type == BundType.Others && renderStrategy != WXRenderStrategy.DATA_RENDER && renderStrategy != WXRenderStrategy.DATA_RENDER_BINARY )) {
return opt;
}
try {
Expand Down Expand Up @@ -1689,7 +1691,18 @@ public WXJSObject optionObjConvert(boolean useSandBox, BundType type, WXJSObject
e.printStackTrace();
}
return opt;
}

/**
* Use {@link #optionObjConvert(boolean, BundType, WXRenderStrategy, WXJSObject)} instead
* @param useSandBox
* @param type
* @param opt
* @return
*/
@Deprecated
public WXJSObject optionObjConvert(boolean useSandBox, BundType type, WXJSObject opt) {
return optionObjConvert(useSandBox, type, null, opt);
}

/**
Expand Down

0 comments on commit 406d1f0

Please sign in to comment.