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

* [android] update modify rewrite #134

Merged
merged 1 commit into from
Mar 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,10 @@ public boolean isDestroy(){
return isDestroy;
}

public String getBundleUrl() {
/**
* @return If you use render () the return value may be empty
*/
public @Nullable String getBundleUrl() {
return mBundleUrl;
}

Expand All @@ -1276,6 +1279,7 @@ public View getContainerView() {
return mRenderContainer;
}

@Deprecated
public void setBundleUrl(String url){
mBundleUrl = url;
if(WXSDKManager.getInstance().getValidateProcessor()!=null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@

import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextUtils;

import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.common.Constants;

import java.util.List;

Expand All @@ -223,6 +223,10 @@ public class DefaultUriAdapter implements URIAdapter {
@NonNull
@Override
public Uri rewrite(WXSDKInstance instance, String type, Uri uri) {
if (TextUtils.isEmpty(instance.getBundleUrl())) {
return uri;
}

Uri base = Uri.parse(instance.getBundleUrl());
Uri.Builder resultBuilder = uri.buildUpon();

Expand All @@ -231,8 +235,6 @@ public Uri rewrite(WXSDKInstance instance, String type, Uri uri) {
return resultBuilder.build();
}
return uri;


}

private Uri.Builder buildRelativeURI(Uri.Builder resultBuilder, Uri base, Uri uri) {
Expand Down