Skip to content

Commit

Permalink
* [android] allow rewrite component
Browse files Browse the repository at this point in the history
  • Loading branch information
sospartan committed Jun 23, 2016
1 parent c3e4d0e commit 2d5284b
Showing 1 changed file with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,15 @@ public static boolean registerComponent(String type, Class<? extends WXComponent
return registerNativeComponent(type, clazz) && registerJSComponent(componentInfo);
}

public static boolean registerNativeComponent(String type, Class<? extends WXComponent> clazz) throws WXException {
private static boolean registerNativeComponent(String type, Class<? extends WXComponent> clazz) throws WXException {
if (type == null) {
if (WXEnvironment.isApkDebugable()) {
throw new WXException("Component name required." );
} else {
WXLogUtils.e("Component name required." + type);
return false;
}
}
//same component class for different name
ComponentHolder holder;
if(sClassTypeMap.get(clazz.getName()) == null){
Expand Down Expand Up @@ -265,23 +273,6 @@ public static boolean registerComponent(Map<String, String> componentInfo, Class
}

String type = componentInfo.get("type");
if (type == null) {
if (WXEnvironment.isApkDebugable()) {
throw new WXException("Exist duplicate component:" + type);
} else {
WXLogUtils.e("WXComponentRegistry Exist duplicate component: " + type);
return false;
}
}
if (sTypeComponentMap.containsKey(type)) {
if (WXEnvironment.isApkDebugable()) {
throw new WXException("Exist duplicate component:" + type);
} else {
WXLogUtils.e("WXComponentRegistry Exist duplicate component: " + type);
return false;
}
}

return registerNativeComponent(type, clazz) && registerJSComponent(componentInfo);
}

Expand Down

0 comments on commit 2d5284b

Please sign in to comment.