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

* [Android][iOS][C++] Add eagle version of data-render #1937

Merged
merged 61 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
e7e2abd
[core] add vcomponent diff
yxping Nov 2, 2018
257cdcd
[core] support component ref finder
yxping Nov 2, 2018
75db0d1
[core][data_render] support class binding
yxping Nov 5, 2018
4da4a58
[core][data_render] add event support
yxping Nov 6, 2018
1ca818e
[core][data_render] support value array of attr parser
yxping Nov 8, 2018
ad24674
[core][data_render] support vcomponent lifecycle and update from js
yxping Nov 8, 2018
38b88ee
[core][data_render] support event
yxping Nov 9, 2018
eb0220b
[iOS] add js binding on iOS
jianhan-he Nov 10, 2018
2408aaa
[core][eagle] fix codegen prefix invalid problem
yxping Nov 10, 2018
407945a
[iOS] add createinstance to execute js
jianhan-he Nov 11, 2018
0c685a3
Merge branch 'develop-data-render-script' of gitlab.alibaba-inc.com:w…
jianhan-he Nov 11, 2018
d306455
[core] add http_module
jianhan-he Nov 11, 2018
13a0bbb
[core][eagle] fix event params
yxping Nov 11, 2018
7cda3b1
[eagle] fix repeat bug
yxping Nov 11, 2018
9b3acb4
[iOS] add requestHandle to download js
jianhan-he Nov 13, 2018
9a40175
Merge branch 'develop-data-render-script' of gitlab.alibaba-inc.com:w…
jianhan-he Nov 13, 2018
724bcf5
[iOS] fix weexsdk compile error
jianhan-he Nov 13, 2018
b9c847b
[iOS] fix weexsdk compile error
jianhan-he Nov 13, 2018
34a9fec
[Android] make WXHttpListener be in common use
yxping Nov 19, 2018
ff165ef
[core][eagle] support httpmodule in android
yxping Nov 19, 2018
66998fe
[eagle] support binding style and computed
yxping Nov 29, 2018
dda2359
[eagle] fix bugs
yxping Nov 29, 2018
941b9ab
[Android] fix update styles bug when only border change
yxping Nov 29, 2018
8012cbf
[Android] do not set the same text repeatedly
yxping Nov 29, 2018
5cf90a9
[Android] fix boxshadow not change size when view size changed
yxping Nov 29, 2018
0f21755
Merge remote-tracking branch 'github/master' into develop-data-render…
yxping Nov 29, 2018
f542d76
Merge remote-tracking branch 'github/master' into develop-data-render…
yxping Nov 29, 2018
dcc34f2
* [Android] Update URL render rule
YorkShen Dec 10, 2018
cc4f8f6
[core] support javascript binding on iOS
jianhan-he Dec 10, 2018
d8c4ad9
Merge branch 'develop-data-render-script' of gitlab.alibaba-inc.com:w…
jianhan-he Dec 10, 2018
33dec8d
Merge branch 'master' into 'develop-data-render-script'
YorkShen Dec 10, 2018
3d7b4af
[iOS] update js framework
jianhan-he Dec 11, 2018
5e5d731
Merge branch 'develop-data-render-script' of gitlab.alibaba-inc.com:w…
jianhan-he Dec 11, 2018
09de7ad
[core] fix click event error on eagle
jianhan-he Dec 11, 2018
778165a
[core] fix crash when data is null on eagle
jianhan-he Dec 12, 2018
b7ca0d8
[core] fix crash when data array are null on eagle
jianhan-he Dec 12, 2018
49d4235
* [Android] Update libweexjss for updateComponentData.
YorkShen Dec 12, 2018
91a917f
[core] fix bool type equre operator error
jianhan-he Dec 13, 2018
b105cf4
Merge branch 'develop-data-render-script' of gitlab.alibaba-inc.com:w…
jianhan-he Dec 13, 2018
2be6d17
[core] support js file cache
jianhan-he Dec 13, 2018
411ffeb
[iOS] fix data null error
jianhan-he Dec 13, 2018
8e1499a
Merge branch 'master' into develop-data-render-script
YorkShen Dec 13, 2018
2046041
[iOS] support bundleUrl on eagle
jianhan-he Dec 13, 2018
66f3378
[core] fix crash when root_node is null
jianhan-he Dec 13, 2018
9e8ae8c
Merge branch 'develop-data-render-script' of gitlab.alibaba-inc.com:w…
jianhan-he Dec 13, 2018
2683f93
* [Android] Add libweexcore.so due to the malfunction of integration …
YorkShen Dec 13, 2018
625ed22
[jsframework] updata jsframework to support get data
jianhan-he Dec 14, 2018
ed441b8
* [Android] Update jsfm.js
YorkShen Dec 14, 2018
b92b1e7
Merge branch 'master' into 'develop-data-render-script'
YorkShen Dec 17, 2018
8b33bc6
[core] fix incorrect data this get from js
jianhan-he Dec 17, 2018
dffc0ad
Merge branch 'master' of https://github.com/apache/incubator-weex int…
Dec 18, 2018
45db48b
* [Android] Update libweexcore.so
YorkShen Dec 18, 2018
72f9b09
[core] fix parent component bug
jianhan-he Dec 18, 2018
f102f4b
[core] fix onAppear event can not exec
jianhan-he Dec 19, 2018
0429019
* [Android] Update so
YorkShen Dec 19, 2018
863c018
Merge branch 'master' into develop-data-render-script
YorkShen Dec 19, 2018
49a80bd
[iOS] add CUSTOM_PREPROCESS record time
jianhan-he Dec 19, 2018
47c8be3
Merge branch 'develop-data-render-script' of gitlab.alibaba-inc.com:w…
jianhan-he Dec 19, 2018
8dc1efb
* [Android] Add customPreprocess for APM
YorkShen Dec 19, 2018
6e1c727
Merge branch 'master' into develo-data-render-script-apache
YorkShen Dec 20, 2018
977ec7c
* [Android] Update build.gradle
YorkShen Dec 20, 2018
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
7 changes: 4 additions & 3 deletions WeexSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Pod::Spec.new do |s|
Alibaba-INC copyright
LICENSE
}
s.authors = {
s.authors = {
"cxfeng1" => "cxfeng1@gmail.com",
"boboning" => "ningli928@163.com",
"yangshengtao" => "yangshengtao1314@163.com",
Expand All @@ -32,7 +32,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0'

# use for public
# s.source = {
# s.source = {
# :git => 'https://github.com/apache/incubator-weex.git',
# :tag => #{s.version}
# }
Expand All @@ -46,7 +46,8 @@ Pod::Spec.new do |s|
'weex_core/Source/wson/**/*.{h,hpp,m,mm,c,cpp,cc}',
'weex_core/Source/third_party/**/*.{h,hpp,m,mm,c,cpp,cc}',
'weex_core/Source/include/**/*.{h,hpp,m,mm,c,cpp,cc}'
s.exclude_files = 'weex_core/Source/**/*android.{h,hpp,m,mm,c,cpp,cc}'
s.exclude_files = 'weex_core/Source/**/*android.{h,hpp,m,mm,c,cpp,cc}',
'weex_core/Source/core/network/android/'

s.private_header_files = 'ios/sdk/WeexSDK/Sources/Component/RecycleList/WXJSASTParser.h'
s.public_header_files = 'ios/sdk/WeexSDK/Sources/WeexSDK.h',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.alibaba.fastjson.JSON;
import com.alibaba.weex.commons.WXAnalyzerDelegate;
import com.alibaba.weex.constants.Constants;
Expand All @@ -63,7 +62,6 @@
import com.taobao.weex.ui.component.WXVContainer;
import com.taobao.weex.utils.WXFileUtils;
import com.taobao.weex.utils.WXLogUtils;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -246,8 +244,11 @@ public void onSuccess(WXHttpTask task) {
try {
Uri uri = Uri.parse(url);
mConfigMap.put("bundleUrl", url);
if (uri.getPath().endsWith(".wlasm")){
if(TextUtils.equals(uri.getQueryParameter("__eagle"), Boolean.TRUE.toString())){
mInstance.render(TAG, task.response.data, mConfigMap, null);
}
else if (TextUtils.equals(uri.getQueryParameter("__data_render"), Boolean.TRUE.toString())){
mInstance.render(TAG, new String(task.response.data, "UTF-8"), mConfigMap, null, WXRenderStrategy.DATA_RENDER);
} else {
mInstance.render(TAG, new String(task.response.data, "utf-8"), mConfigMap, null, WXRenderStrategy.APPEND_ASYNC);
}
Expand Down
3 changes: 0 additions & 3 deletions android/sdk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ lint.xml
project.properties
assets/main.js
.externalNativeBuild
libs/armeabi/libweexcore.so
libs/armeabi-v7a/libweexcore.so
libs/x86/libweexcore.so
4 changes: 4 additions & 0 deletions android/sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ version = project.hasProperty('weexVersion')? project.getProperty('weexVersion')

android {

delete 'libs/armeabi/libweexcore.so'
delete 'libs/armeabi-v7a/libweexcore.so'
delete 'libs/x86/libweexcore.so'

compileSdkVersion project.compileSdkVersion
buildToolsVersion project.buildToolsVersion
resourcePrefix "weex"
Expand Down
Binary file modified android/sdk/libs/armeabi-v7a/libweexjss.so
Binary file not shown.
Binary file modified android/sdk/libs/armeabi/libweexjss.so
Binary file not shown.
260 changes: 260 additions & 0 deletions android/sdk/src/main/java/com/taobao/weex/WXHttpListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.taobao.weex;

import android.net.Uri;
import android.text.TextUtils;

import com.taobao.weex.adapter.IWXHttpAdapter;
import com.taobao.weex.adapter.IWXUserTrackAdapter;
import com.taobao.weex.common.WXErrorCode;
import com.taobao.weex.common.WXPerformance;
import com.taobao.weex.common.WXRenderStrategy;
import com.taobao.weex.common.WXResponse;
import com.taobao.weex.performance.WXInstanceApm;
import com.taobao.weex.tracing.WXTracing;
import com.taobao.weex.utils.WXLogUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* load bundle js listener
*/
public class WXHttpListener implements IWXHttpAdapter.OnHttpListener {

private String pageName;
private Map<String, Object> options;
private String jsonInitData;
private WXRenderStrategy flag;
private WXSDKInstance instance;
private long startRequestTime;
private int traceId;
private WXPerformance mWXPerformance;
private WXInstanceApm mApmForInstance;
private IWXUserTrackAdapter mUserTrackAdapter;

private String mBundleUrl;

public WXHttpListener(WXSDKInstance instance) {
this.instance = instance;
this.traceId = WXTracing.nextId();
this.mWXPerformance = instance.getWXPerformance();
this.mApmForInstance = instance.getApmForInstance();
this.mUserTrackAdapter = WXSDKManager.getInstance().getIWXUserTrackAdapter();
if (WXTracing.isAvailable()) {
WXTracing.TraceEvent event = WXTracing.newEvent("downloadBundleJS", instance.getInstanceId(), -1);
event.iid = instance.getInstanceId();
event.tname = "Network";
event.ph = "B";
event.traceId = traceId;
event.submit();
}
}

public WXHttpListener(WXSDKInstance instance, String bundleUrl) {
this(instance);
this.startRequestTime = System.currentTimeMillis();
this.mBundleUrl = bundleUrl;
}

public WXHttpListener(WXSDKInstance instance, String pageName, Map<String, Object> options, String jsonInitData, WXRenderStrategy flag, long startRequestTime) {
this(instance);
this.pageName = pageName;
this.options = options;
this.jsonInitData = jsonInitData;
this.flag = flag;
this.startRequestTime = startRequestTime;
this.mBundleUrl = instance.getBundleUrl();
}

public void setSDKInstance(WXSDKInstance instance) {
this.instance = instance;
}

@Override
public void onHttpStart() {
if (this.instance != null
&& this.instance.getWXStatisticsListener() != null) {
this.instance.getWXStatisticsListener().onHttpStart();
}
}

@Override
public void onHeadersReceived(int statusCode, Map<String,List<String>> headers) {
if (this.instance != null
&& this.instance.getWXStatisticsListener() != null) {
this.instance.getWXStatisticsListener().onHeadersReceived();
this.instance.onHttpStart();
}
if(this.instance != null
&& this.instance.responseHeaders != null
&& headers != null){
this.instance.responseHeaders.putAll(headers);
}
}

@Override
public void onHttpUploadProgress(int uploadProgress) {

}

@Override
public void onHttpResponseProgress(int loadedLength) {
instance.getApmForInstance().extInfo.put(WXInstanceApm.VALUE_BUNDLE_LOAD_LENGTH,loadedLength);
}

@Override
public void onHttpFinish(WXResponse response) {

if (this.instance != null
&& this.instance.getWXStatisticsListener() != null) {
this.instance.getWXStatisticsListener().onHttpFinish();
}

if (WXTracing.isAvailable()) {
WXTracing.TraceEvent event = WXTracing.newEvent("downloadBundleJS", instance.getInstanceId(), -1);
event.traceId = traceId;
event.tname = "Network";
event.ph = "E";
event.extParams = new HashMap<>();
if (response != null && response.originalData != null) {
event.extParams.put("BundleSize", response.originalData.length);
}
event.submit();
}

mWXPerformance.networkTime = System.currentTimeMillis() - startRequestTime;
if(null!= response && response.extendParams!=null){
mApmForInstance.updateRecordInfo(response.extendParams);
Object actualNetworkTime=response.extendParams.get("actualNetworkTime");
mWXPerformance.actualNetworkTime=actualNetworkTime instanceof Long?(long)actualNetworkTime:0;

Object pureNetworkTime=response.extendParams.get("pureNetworkTime");
mWXPerformance.pureNetworkTime=pureNetworkTime instanceof Long?(long)pureNetworkTime:0;

Object connectionType=response.extendParams.get("connectionType");
mWXPerformance.connectionType=connectionType instanceof String?(String)connectionType:"";

Object packageSpendTime=response.extendParams.get("packageSpendTime");
mWXPerformance.packageSpendTime=packageSpendTime instanceof Long ?(long)packageSpendTime:0;

Object syncTaskTime=response.extendParams.get("syncTaskTime");
mWXPerformance.syncTaskTime=syncTaskTime instanceof Long ?(long)syncTaskTime:0;

Object requestType=response.extendParams.get("requestType");
mWXPerformance.requestType=requestType instanceof String?(String)requestType:"none";

Object cacheType = response.extendParams.get(WXPerformance.Dimension.cacheType.toString());
if(cacheType instanceof String){
mWXPerformance.cacheType = (String) cacheType;
}

Object zCacheInfo = response.extendParams.get("zCacheInfo");
mWXPerformance.zCacheInfo = zCacheInfo instanceof String?(String)zCacheInfo:"";

if(isNet(mWXPerformance.requestType) && mUserTrackAdapter!=null){
WXPerformance performance=new WXPerformance(instance.getInstanceId());
if(!TextUtils.isEmpty(mBundleUrl)){
try {
performance.args= Uri.parse(mBundleUrl).buildUpon().clearQuery().toString();
} catch (Exception e) {
performance.args=pageName;
}
}
if(!"200".equals(response.statusCode)){
performance.errCode= WXErrorCode.WX_ERR_JSBUNDLE_DOWNLOAD.getErrorCode();
performance.appendErrMsg(response.errorCode);
performance.appendErrMsg("|");
performance.appendErrMsg(response.errorMsg);

}else if("200".equals(response.statusCode) && (response.originalData==null || response.originalData.length<=0)){
performance.errCode=WXErrorCode.WX_ERR_JSBUNDLE_DOWNLOAD.getErrorCode();
performance.appendErrMsg(response.statusCode);
performance.appendErrMsg("|template is null!");
}else {
performance.errCode=WXErrorCode.WX_SUCCESS.getErrorCode();
}

if (mUserTrackAdapter != null) {
mUserTrackAdapter.commit(instance.getContext(), null, IWXUserTrackAdapter.JS_DOWNLOAD, performance, null);
}
}
}
String wxErrorCode = WXInstanceApm.VALUE_ERROR_CODE_DEFAULT;
if (response!=null && response.originalData!=null && TextUtils.equals("200", response.statusCode)) {
mApmForInstance.onStage(WXInstanceApm.KEY_PAGE_STAGES_DOWN_BUNDLE_END);
onSuccess(response);

// check content-type
} else if (TextUtils.equals(WXErrorCode.WX_DEGRAD_ERR_BUNDLE_CONTENTTYPE_ERROR.getErrorCode(),
response.statusCode)) {
WXLogUtils.e("user intercept: WX_DEGRAD_ERR_BUNDLE_CONTENTTYPE_ERROR");
wxErrorCode = WXErrorCode.WX_DEGRAD_ERR_BUNDLE_CONTENTTYPE_ERROR.getErrorCode();
instance.onRenderError(wxErrorCode,
"|response.errorMsg==" + response.errorMsg +
"|instance bundleUrl = \n" + instance.getBundleUrl() +
"|instance requestUrl = \n" + Uri.decode(WXSDKInstance.requestUrl)
);
onFail(response);

// check content-length
} else if (response!=null && response.originalData!=null && TextUtils.equals("-206", response.statusCode)) {
WXLogUtils.e("user intercept: WX_DEGRAD_ERR_NETWORK_CHECK_CONTENT_LENGTH_FAILED");
wxErrorCode = WXErrorCode.WX_DEGRAD_ERR_NETWORK_CHECK_CONTENT_LENGTH_FAILED.getErrorCode();
instance.onRenderError(wxErrorCode ,
WXErrorCode.WX_DEGRAD_ERR_NETWORK_CHECK_CONTENT_LENGTH_FAILED.getErrorCode() +
"|response.errorMsg==" + response.errorMsg
);
onFail(response);
}
else {
wxErrorCode = WXErrorCode.WX_DEGRAD_ERR_NETWORK_BUNDLE_DOWNLOAD_FAILED.getErrorCode();
instance.onRenderError(wxErrorCode,
response.errorMsg);
onFail(response);
}
if (!WXInstanceApm.VALUE_ERROR_CODE_DEFAULT.equals(wxErrorCode)){
mApmForInstance.addProperty(WXInstanceApm.KEY_PROPERTIES_ERROR_CODE,wxErrorCode);
}
}

private boolean isNet(String requestType){

return "network".equals(requestType) || "2g".equals(requestType) || "3g".equals(requestType)
|| "4g".equals(requestType) || "wifi".equals(requestType) || "other".equals(requestType)
|| "unknown".equals(requestType);
}

public void onSuccess(WXResponse response) {
if (flag==WXRenderStrategy.DATA_RENDER_BINARY){
instance.render(pageName, response.originalData, options, jsonInitData);
}else {
String template = new String(response.originalData);
instance.render(pageName, template, options, jsonInitData, flag);
}
}

public void onFail(WXResponse response) {

}
}


Loading