Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce Lee committed Aug 5, 2015
2 parents cbdef95 + 6f7df61 commit 6086d89
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions library/src/main/java/com/github/lzyzsd/jsbridge/BridgeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public class BridgeUtil {
final static String YY_OVERRIDE_SCHEMA = "yy://";
final static String YY_RETURN_DATA = YY_OVERRIDE_SCHEMA + "return/";//格式为 yy://return/{function}/returncontent
final static String YY_FETCHQUEUE = YY_RETURN_DATA + "_fetchQueue/";
final static String EMPTY_STR = "";
final static String UNDERLINE_STR = "_";
final static String SPLIT_MARK = "/";
Expand All @@ -26,15 +27,27 @@ public static String parseFunctionName(String jsUrl){


public static String getDataFromReturnUrl(String url) {
if(url.startsWith(YY_FETCHQUEUE)) {
return url.replace(YY_FETCHQUEUE, EMPTY_STR);
}


String temp = url.replace(YY_RETURN_DATA, EMPTY_STR);
int start = temp.indexOf(SPLIT_MARK);
return temp.substring(start + 1);
String[] functionAndData = temp.split(SPLIT_MARK);
if(functionAndData.length >= 2) {
StringBuilder sb = new StringBuilder();
for (int i = 1; i < functionAndData.length; i++) {
sb.append(functionAndData[i]);
}
return sb.toString();
}
return null;
}

public static String getFunctionFromReturnUrl(String url) {
String temp = url.replace(YY_RETURN_DATA, EMPTY_STR);
String[] functionAndData = temp.split(SPLIT_MARK);
if(functionAndData != null && functionAndData.length >= 1){
if(functionAndData.length >= 1){
return functionAndData[0];
}
return null;
Expand Down

0 comments on commit 6086d89

Please sign in to comment.