Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Core] support Richtext component on eagle (#2766)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianhan-he authored and YorkShen committed Jul 31, 2019
1 parent 2b9d773 commit 0b12b28
Show file tree
Hide file tree
Showing 42 changed files with 1,784 additions and 118 deletions.
99 changes: 80 additions & 19 deletions android/sdk/src/main/java/com/taobao/weex/bridge/WXBridge.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public int callNative(String instanceId, String tasks, String callback) {
try{
return callNative(instanceId, JSONArray.parseArray(tasks), callback);
}catch (Exception e){
WXLogUtils.e(TAG, "callNative throw exception: " + e.getMessage());
WXLogUtils.e(TAG, "callNative throw exception: " + WXLogUtils.getStackTrace(e));
return IWXBridge.INSTANCE_RENDERING;
}
}
Expand All @@ -266,7 +266,7 @@ private int callNative(String instanceId, JSONArray tasks, String callback){
try {
errorCode = WXBridgeManager.getInstance().callNative(instanceId, tasks, callback);
} catch (Throwable e) {
WXLogUtils.e(TAG, "callNative throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callNative throw exception:" + WXLogUtils.getStackTrace(e));
}

if (WXEnvironment.isApkDebugable()) {
Expand Down Expand Up @@ -436,7 +436,7 @@ public int callUpdateFinish(String instanceId, byte[] tasks, String callback) {
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callCreateBody throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callCreateBody throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -451,7 +451,7 @@ public int callRefreshFinish(String instanceId, byte[] tasks, String callback) {
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callCreateFinish throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callCreateFinish throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -469,7 +469,7 @@ public void reportServerCrash(String instanceId, String crashFile) {
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "reloadPageNative throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "reloadPageNative throw exception:" + WXLogUtils.getStackTrace(e));
}
}
}
Expand All @@ -487,7 +487,7 @@ public int callCreateBody(String instanceId, String componentType, String ref,
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callCreateBody throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callCreateBody throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -507,7 +507,7 @@ public int callAddElement(String instanceId, String componentType, String ref, i
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
e.printStackTrace();
WXLogUtils.e(TAG, "callAddElement throw error:" + e.getMessage());
WXLogUtils.e(TAG, "callAddElement throw error:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -521,7 +521,7 @@ public int callRemoveElement(String instanceId, String ref) {
errorCode = WXBridgeManager.getInstance().callRemoveElement(instanceId, ref);
} catch (Throwable e) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callRemoveElement throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callRemoveElement throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -535,7 +535,7 @@ public int callMoveElement(String instanceId, String ref, String parentref, int
errorCode = WXBridgeManager.getInstance().callMoveElement(instanceId, ref, parentref, index);
} catch (Throwable e) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callMoveElement throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callMoveElement throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -550,7 +550,7 @@ public int callAddEvent(String instanceId, String ref, String event) {
} catch (Throwable e) {
//catch everything during call native.
// if(WXEnvironment.isApkDebugable()){
WXLogUtils.e(TAG, "callAddEvent throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callAddEvent throw exception:" + WXLogUtils.getStackTrace(e));
// }
}
return errorCode;
Expand All @@ -565,7 +565,7 @@ public int callRemoveEvent(String instanceId, String ref, String event) {
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callRemoveEvent throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callRemoveEvent throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -584,7 +584,7 @@ public int callUpdateStyle(String instanceId, String ref,
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callUpdateStyle throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callUpdateStyle throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -599,12 +599,73 @@ public int callUpdateAttrs(String instanceId, String ref, HashMap<String, String
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callUpdateAttr throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callUpdateAttr throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
}

@Override
@CalledByNative
public int callAddChildToRichtext(String instanceId, String nodeType, String ref, String parentRef, String richTextRef,
HashMap<String, String> styles, HashMap<String, String> attrs){
int errorCode = IWXBridge.INSTANCE_RENDERING;
try {
errorCode = WXBridgeManager.getInstance().callAddChildToRichtext(instanceId, nodeType, ref, parentRef, richTextRef,
styles, attrs);
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callAddChildToRichtext throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
}
@Override
@CalledByNative
public int callRemoveChildFromRichtext(String instanceId, String ref, String parentRef, String richTextRef){
int errorCode = IWXBridge.INSTANCE_RENDERING;
try {
errorCode = WXBridgeManager.getInstance().callRemoveChildFromRichtext(instanceId, ref, parentRef, richTextRef);
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callRemoveChildFromRichtext throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
}

@Override
@CalledByNative
public int callUpdateRichtextStyle(String instanceId, String ref, HashMap<String, String> styles, String parentRef, String richTextRef){
int errorCode = IWXBridge.INSTANCE_RENDERING;
try {
errorCode = WXBridgeManager.getInstance().callUpdateRichtextStyle(instanceId, ref, styles, parentRef, richTextRef);
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callUpdateRichtextStyle throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
}
@Override
@CalledByNative
public int callUpdateRichtextChildAttr(String instanceId, String ref, HashMap<String, String> attrs, String parentRef, String richTextRef){
int errorCode = IWXBridge.INSTANCE_RENDERING;
try {
errorCode = WXBridgeManager.getInstance().callUpdateRichtextChildAttr(instanceId, ref, attrs, parentRef, richTextRef);
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callUpdateRichtextChildAttr throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
}


@Override
@CalledByNative
public int callLayout(String instanceId, String ref, int top, int bottom, int left, int right, int height, int width, boolean isRTL, int index) {
Expand All @@ -614,7 +675,7 @@ public int callLayout(String instanceId, String ref, int top, int bottom, int le
} catch (Throwable e) {
//catch everything during call native.
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callLayout throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callLayout throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -627,7 +688,7 @@ public int callCreateFinish(String instanceId) {
try {
errorCode = WXBridgeManager.getInstance().callCreateFinish(instanceId);
} catch (Throwable e) {
WXLogUtils.e(TAG, "callCreateFinish throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callCreateFinish throw exception:" + WXLogUtils.getStackTrace(e));
}
return errorCode;
}
Expand All @@ -639,7 +700,7 @@ public int callRenderSuccess(String instanceId) {
try {
errorCode = WXBridgeManager.getInstance().callRenderSuccess(instanceId);
} catch (Throwable e) {
WXLogUtils.e(TAG, "callCreateFinish throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callCreateFinish throw exception:" + WXLogUtils.getStackTrace(e));
}
return errorCode;
}
Expand All @@ -651,7 +712,7 @@ public int callAppendTreeCreateFinish(String instanceId, String ref) {
try {
errorCode = WXBridgeManager.getInstance().callAppendTreeCreateFinish(instanceId, ref);
} catch (Throwable e) {
WXLogUtils.e(TAG, "callAppendTreeCreateFinish throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callAppendTreeCreateFinish throw exception:" + WXLogUtils.getStackTrace(e));
}
return errorCode;
}
Expand All @@ -664,7 +725,7 @@ public int callHasTransitionPros(String instanceId, String ref, HashMap<String,
errorCode = WXBridgeManager.getInstance().callHasTransitionPros(instanceId, ref, styles);
} catch (Throwable e) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "callHasTransitionPros throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "callHasTransitionPros throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return errorCode;
Expand All @@ -678,7 +739,7 @@ public ContentBoxMeasurement getMeasurementFunc(String instanceId, long renderOb
obj = WXBridgeManager.getInstance().getMeasurementFunc(instanceId, renderObjectPtr);
} catch (Throwable e) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e(TAG, "getMeasurementFunc throw exception:" + e.getMessage());
WXLogUtils.e(TAG, "getMeasurementFunc throw exception:" + WXLogUtils.getStackTrace(e));
}
}
return obj;
Expand Down
Loading

0 comments on commit 0b12b28

Please sign in to comment.