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

* [WEEX-240] [android] feature update for weexsandbox #1088

Merged
merged 4 commits into from
Mar 27, 2018
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
2 changes: 2 additions & 0 deletions android/sdk/assets/main.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions android/sdk/assets/weex-main-jsfm.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions android/sdk/assets/weex-rax-api.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions android/sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ android {
def jsfmVersion = m[0][1]
println jsfmVersion

copy {
from '../../pre-build'
into new File(projectDir,"assets")
include 'weex-main-jsfm.js'
rename('weex-main-jsfm.js','weex-main-jsfm.js')
}

copy {
from '../../pre-build'
into new File(projectDir,"assets")
include 'weex-rax-api.js'
}

if(project.hasProperty('asfRelease')){
//download so file if not exist, when compile in source release
download{
Expand Down
Empty file modified android/sdk/libs/armeabi/libweexjsb.so
100644 → 100755
Empty file.
Binary file modified android/sdk/libs/armeabi/libweexjsc.so
100644 → 100755
Binary file not shown.
Binary file modified android/sdk/libs/armeabi/libweexjss.so
100644 → 100755
Binary file not shown.
Binary file modified android/sdk/libs/armeabi/libweexjst.so
Binary file not shown.
Binary file modified android/sdk/libs/x86/libweexjsc.so
Binary file not shown.
Binary file modified android/sdk/libs/x86/libweexjss.so
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ public static Map<String, String> getConfig() {
configs.put(WXConfig.weexVersion, String.valueOf(WXSDK_VERSION));
configs.put(WXConfig.logLevel,sLogLevel.getName());
try {
if (isApkDebugable()) {
options.put(WXConfig.debugMode, "true");
}
options.put(WXConfig.scale, Float.toString(sApplication.getResources().getDisplayMetrics().density));
}catch (NullPointerException e){
//There is little chance of NullPointerException as sApplication may be null.
Expand Down
17 changes: 11 additions & 6 deletions android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,19 @@ public static boolean registerComponent(Class<? extends WXComponent> clazz, bool

public static boolean registerComponent(IFComponentHolder holder, boolean appendTree, String ... names) throws WXException {
boolean result = true;
for(String name:names) {
Map<String, Object> componentInfo = new HashMap<>();
if (appendTree) {
componentInfo.put("append", "tree");
try {
for (String name : names) {
Map<String, Object> componentInfo = new HashMap<>();
if (appendTree) {
componentInfo.put("append", "tree");
}
result = result && WXComponentRegistry.registerComponent(name, holder, componentInfo);
}
result = result && WXComponentRegistry.registerComponent(name, holder, componentInfo);
return result;
} catch (Throwable e) {
e.printStackTrace();
return result;
}
return result;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ public class WXSDKInstance implements IWXActivityStateListener,DomContext, View.
private ComponentObserver mComponentObserver;
private boolean mIsCommitedDomAtionExp = false;

/**
* set open SandBox
* @param flag
*/
public void setUseSandBox(boolean flag) {
WXBridgeManager.getInstance().setSandBoxContext(flag);
}
public PriorityQueue<WXEmbed> hiddenEmbeds;

private int maxHiddenEmbedsNum = -1; //max hidden embed num, -1 standard for ulimit
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.taobao.weex.bridge;

/**
* Created by shiwentao on 2018/3/13.
*/

public class ModuleFactoryImpl {
public ModuleFactory mFactory = null;
public boolean hasRigster = false;

public ModuleFactoryImpl(ModuleFactory factory) {
mFactory = factory;
}

public ModuleFactoryImpl(ModuleFactory factory, boolean rigister) {
mFactory = factory;
hasRigster = rigister;
}
}

28 changes: 28 additions & 0 deletions android/sdk/src/main/java/com/taobao/weex/bridge/WXBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,27 @@ class WXBridge implements IWXBridge {
*/
public native int execJS(String instanceId, String namespace, String function, WXJSObject[] args);

/**
* nativeCreateInstanceContext
* @param instanceId
* @param name
* @param function
* @param args
* @return
*/
public native int createInstanceContext(String instanceId, String name, String function, WXJSObject[] args);


/**
* nativeDestoryInstance
* @param instanceId
* @param name
* @param function
* @param args
* @return
*/
public native int destoryInstance(String instanceId, String name, String function, WXJSObject[] args);

/**
* Execute JavaScript function
*
Expand All @@ -85,6 +104,15 @@ class WXBridge implements IWXBridge {
*/
public native int execJSService(String javascript);


/**
* execJSOnInstance
* @param instanceId id
* @param script js
* @param type tag: sync | async | global | instance
* @return value
*/
public native String execJSOnInstance(String instanceId, String script, int type);
/**
* Take v8's heap snapshot
* @param filename the name of the file to be written.
Expand Down
Loading