Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/master' into develop-data-render…
Browse files Browse the repository at this point in the history
…-script
  • Loading branch information
yxping committed Nov 29, 2018
2 parents 0f21755 + 374dc3b commit f542d76
Show file tree
Hide file tree
Showing 338 changed files with 2,902 additions and 38,193 deletions.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug report
about: Report a reproducible bug in the Weex library.

---

<!--
Thanks for using Weex. Please follow the [Bug Report Guidelines](http://weex-project.io/bug-report-guidelines.html) to file issues. A good bug report should include the following information:
-->

<!-- Requirements: please go through this checklist before opening a new issue -->
- [ ] Review the documentation: https://weex.apache.org/index.html
- [ ] Search for existing issues: https://github.com/apache/incubator-weex/issues
- [ ] Use the latest Weex release: https://github.com/apache/incubator-weex/releases

## Describe the bug
A clear and concise description of what the bug is.

## To Reproduce
Steps to reproduce the behavior. Include a MCVE using http://dotwe.org/vue , crash stacktrace or share your app project. Please follow the guidelines for providing a MCVE: https://stackoverflow.com/help/mcve

## Environment
* Device: [e.g. iPhone6]
* OS: [e.g. iOS8.1]
* Version [e.g. 22]
* Build from source [e.g. yes/no]

## Expected behavior
A clear and concise description of what you expected to happen.

## Screenshots
If applicable, add screenshots to help explain your problem.

## Additional context
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for Weex

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
18 changes: 9 additions & 9 deletions HOW-TO-BUILD.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Weex Apache Source Release
Weex produce SDKs to integrate to iOS/Android/Mobile web applications. This file will cover how to build Weex from source. You can either use the script we provided or manually build from source step by step.
See `README.md` for further information about Weex Framework.
Weex produce SDKs to integrate with iOS/Android/Mobile web applications. This file will cover how to build Weex from source. You can either use the script we provided or manually build from source step by step.
See `README.md` for further information about the Weex Framework.

Weex SDK includes 3 different SDKs to use in corresponding system/browser:
* Android SDK
* iOS SDK
* [Mobile Web SDK](https://github.com/weexteam/weex-vue-render)

See our [guide in our website](http://weex.apache.org/guide/integrate-to-your-app.html) to learn more about how to integrate Weex SDK to your app.
See our [guide in our website](http://weex.apache.org/guide/integrate-to-your-app.html) to learn more about how to integrate Weex SDK into your app.

## Build Environment
The environment required to build weex as follow:
The environment required to build weex is:
* Android SDK:
* NodeJS 4.0+
* JDK 1.6+
Expand All @@ -31,11 +31,11 @@ This article was tested in MacOSX system.
This script will build Android and iOS SDKs:
> `$ bash scripts/build_from_source.sh`
This's may take a while. After that, you can look into `dist/`, `android/sdk/build/output/` and `ios/sdk/Products` for Web/Android/iOS SDK artifacts.
This may take a while. After that, you can look in `dist/`, `android/sdk/build/output/` and `ios/sdk/Products` for Web/Android/iOS SDK artifacts.

# Build for Platforms

You can build all SDKs by one script as described above, or just build for a single platform you want step by step.
You can build all SDKs with one script as described above, or just build for a single platform step by step.

## Build Javascript Framework
Javascript Framework is required by native SDKs. **So this must be built first.**
Expand All @@ -54,8 +54,8 @@ Move `min` version to Native SDK folder, which will be used by native SDK build.
> `cp packages/weex-js-framework/index.min.js android_sdk/assets/main.js`
## Build Android SDK
Make sure you have install gradle, see more details about 'how to install gradle' in [gradle website](https://gradle.org/install).
execute root folder of project
Make sure you have gradle installed, see more details about 'how to install gradle' on the [gradle website](https://gradle.org/install).
At the root folder of the project, execute
> `$ gradle wrapper --gradle-version 2.14.1`
Create a Gradle setting file
Expand All @@ -71,4 +71,4 @@ You can now import the aar file to your android project.
Execute command below to compile iOS SDK:
> `$ xcodebuild -project ios_sdk/WeexSDK.xcodeproj -target WeexSDK_MTL`
Then you'll found iOS library(Framework file) under `ios_sdk/Products`.
Then you'll find the iOS library(Framework file) under `ios_sdk/Products`.
2 changes: 1 addition & 1 deletion WeexSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Pod::Spec.new do |s|
w.xcconfig = { 'USER_HEADER_SEARCH_PATHS' => ['${PODS_ROOT}/Headers/Public/WeexSDK/core/**'] }
w.header_mappings_dir = 'weex_core/Source'

w.libraries = "stdc++"
w.libraries = "c++"
end

end
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public static Bitmap blur(@NonNull Bitmap originalImage, int radius) {
}

Bitmap result = stackBlur(sampledImage,radius);
WXLogUtils.d(TAG, "elapsed time on blurring image(radius:"+ radius + ",sampling: " + sampling + "): " + (System.currentTimeMillis() - start) + "ms");
return result;
}catch (Exception e) {
WXLogUtils.e(TAG, "thrown exception when blurred image(times = " + i + "),"+ e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package com.alibaba.weex.commons.adapter;

import com.taobao.weex.WXEnvironment;
import com.taobao.weex.adapter.IWXJSExceptionAdapter;
import com.taobao.weex.common.WXJSExceptionInfo;
import com.taobao.weex.utils.WXLogUtils;
Expand All @@ -29,7 +30,7 @@ public class JSExceptionAdapter implements IWXJSExceptionAdapter {

@Override
public void onJSException(WXJSExceptionInfo exception) {
if (exception != null) {
if (exception != null && WXEnvironment.isApkDebugable()) {
WXLogUtils.d(exception.toString());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
* 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.alibaba.weex.commons.adapter;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PixelFormat;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.Gravity;

import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import com.taobao.weex.WXSDKManager;
import com.taobao.weex.adapter.DrawableStrategy;
import com.taobao.weex.adapter.IDrawableLoader;

public class PicassoBasedDrawableLoader implements IDrawableLoader {

private Context mContext;

public PicassoBasedDrawableLoader(Context context) {
mContext = context;
}

@Override
public void setDrawable(final String url,
final DrawableTarget drawableTarget,
final DrawableStrategy drawableStrategy) {
WXSDKManager.getInstance().postOnUiThread(new Runnable() {
@Override
public void run() {
String temp = url;
if (url.startsWith("//")) {
temp = "http:" + url;
}

/** This is a hack for picasso, as Picasso hold weakReference to Target.
* http://stackoverflow.com/questions/24180805/onbitmaploaded-of-target-object-not-called-on-first-load
*/
class PlaceHolderDrawableTarget extends Drawable implements Target {

@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
BitmapDrawable bitmapDrawable = new BitmapDrawable(mContext.getResources(), bitmap);
bitmapDrawable.setGravity(Gravity.FILL);
drawableTarget.setDrawable(bitmapDrawable, true);
}

@Override
public void onBitmapFailed(Drawable errorDrawable) {

}

@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
drawableTarget.setDrawable(this, true);
}

@Override
public void draw(Canvas canvas) {

}

@Override
public void setAlpha(int alpha) {

}

@Override
public void setColorFilter(ColorFilter colorFilter) {

}

@Override
public int getOpacity() {
return PixelFormat.UNKNOWN;
}
}
Picasso.
with(mContext).
load(temp).
resize(drawableStrategy.width, drawableStrategy.height).
onlyScaleDown().
into(new PlaceHolderDrawableTarget());
}
}, 0);

}
}
6 changes: 4 additions & 2 deletions android/playground/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.alibaba.weex"
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion
versionCode 17
versionName "0.19.0"
versionCode 20
versionName "0.19.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
ndk{
Expand Down Expand Up @@ -107,6 +107,8 @@ dependencies {
compile 'com.facebook.fresco:fresco:0.12.0+'
compile 'com.facebook.fresco:animated-gif:0.12.0'

compile 'com.google.zxing:core:3.3.3'

compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.okhttp:okhttp-ws:2.3.0'
compile 'com.squareup.okio:okio:1.0.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import com.alibaba.weex.commons.adapter.DefaultWebSocketAdapterFactory;
import com.alibaba.weex.commons.adapter.ImageAdapter;
import com.alibaba.weex.commons.adapter.JSExceptionAdapter;
import com.alibaba.weex.commons.adapter.PicassoBasedDrawableLoader;
import com.alibaba.weex.extend.adapter.ApmGenerator;
import com.alibaba.weex.extend.adapter.DefaultAccessibilityRoleAdapter;
import com.alibaba.weex.extend.adapter.InterceptWXHttpAdapter;
import com.alibaba.weex.extend.adapter.WXAnalyzerDemoListener;
import com.alibaba.weex.extend.component.RichText;
import com.alibaba.weex.extend.component.WXComponentSyncTest;
import com.alibaba.weex.extend.component.WXMask;
Expand All @@ -46,6 +48,7 @@
import com.taobao.weex.WXSDKManager;
import com.taobao.weex.bridge.WXBridgeManager;
import com.taobao.weex.common.WXException;
import com.taobao.weex.performance.WXAnalyzerDataTransfer;

public class WXApplication extends Application {

Expand All @@ -72,12 +75,15 @@ public void onCreate() {
new InitConfig.Builder()
//.setImgAdapter(new FrescoImageAdapter())// use fresco adapter
.setImgAdapter(new ImageAdapter())
.setDrawableLoader(new PicassoBasedDrawableLoader(getApplicationContext()))
.setWebSocketAdapterFactory(new DefaultWebSocketAdapterFactory())
.setJSExceptionAdapter(new JSExceptionAdapter())
.setHttpAdapter(new InterceptWXHttpAdapter())
.setApmGenerater(new ApmGenerator())
.build()
);
WXSDKManager.getInstance().addWXAnalyzer(new WXAnalyzerDemoListener());
WXAnalyzerDataTransfer.isOpenPerformance = false;

WXSDKManager.getInstance().setAccessibilityRoleAdapter(new DefaultAccessibilityRoleAdapter());

Expand All @@ -86,7 +92,6 @@ public void onCreate() {
WXSDKEngine.registerComponent("synccomponent", WXComponentSyncTest.class);
WXSDKEngine.registerComponent(WXParallax.PARALLAX, WXParallax.class);

WXSDKEngine.registerComponent("richtext", RichText.class);
WXSDKEngine.registerModule("render", RenderModule.class);
WXSDKEngine.registerModule("event", WXEventModule.class);
WXSDKEngine.registerModule("syncTest", SyncTestModule.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class WXPageActivity extends WXBaseActivity implements IWXRenderListener, Handler.Callback, WXSDKInstance.NestedInstanceInterceptor {
Expand Down Expand Up @@ -270,14 +272,28 @@ public void onError(WXHttpTask task) {
*/
private void startHotRefresh() {
try {
String host = new URL(mUri.toString()).getHost();
String wsUrl = "ws://" + host + ":8082";
URL url = new URL(mUri.toString());
String host = url.getHost();
String query = url.getQuery();
String wsport = TextUtils.isEmpty(query)? "8082" : getUrlParam("wsport", query);
String wsUrl = "ws://" + host + ":" + (wsport.equals("") ? "8082" : wsport) ;
mWXHandler.obtainMessage(Constants.HOT_REFRESH_CONNECT, 0, 0, wsUrl).sendToTarget();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}

private String getUrlParam(String key, String queryString) {
String regex = "[?|&]?" + key + "=([^&]+)";
Pattern p = Pattern.compile(regex);
Matcher matcher = p.matcher(queryString);
if (matcher.find()) {
return matcher.group(1);
} else {
return "";
}
}

private void addOnListener() {

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* 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.alibaba.weex.extend.adapter;

import android.util.Log;
import com.taobao.weex.BuildConfig;
import com.taobao.weex.performance.IWXAnalyzer;
import com.taobao.weex.performance.WXAnalyzerDataTransfer;

/**
* @author zhongcang
* @date 2018/9/17
*/
public class WXAnalyzerDemoListener implements IWXAnalyzer {
@Override
public void transfer(String group, String module, String type, String data) {
//WXAnalyzerDataTransfer.switchInteractionLog(true);
if (BuildConfig.DEBUG){
// Log.d("WXAnalyzerDemoListener", "transfer: ");
}
}
}
Loading

0 comments on commit f542d76

Please sign in to comment.