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

Commit

Permalink
Merge pull request #2190 from wqyfavor/separate-api-header
Browse files Browse the repository at this point in the history
[Core] Separate weex api result type from WeexApiHeader
  • Loading branch information
Darin726 committed Mar 6, 2019
2 parents ff7b42b + 3dfdf1c commit bd29205
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 42 deletions.
6 changes: 6 additions & 0 deletions ios/sdk/WeexSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@
775BEE4E1C16F993008D1629 /* WXDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 775BEE4D1C16F993008D1629 /* WXDefine.h */; settings = {ATTRIBUTES = (Public, ); }; };
775BEE6E1C1BD8F4008D1629 /* WXImgLoaderProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 775BEE6C1C1BD8F4008D1629 /* WXImgLoaderProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
775BEE711C1BD977008D1629 /* WXModuleProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 775BEE701C1BD977008D1629 /* WXModuleProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
77A3D66E222F9F5B0078A6F5 /* WeexApiValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 77A3D66D222F9F5B0078A6F5 /* WeexApiValue.h */; };
77A3D66F222F9F5B0078A6F5 /* WeexApiValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 77A3D66D222F9F5B0078A6F5 /* WeexApiValue.h */; };
77CF6A5621E6E47E00BA8634 /* core_constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 77CF6A5421E6E47D00BA8634 /* core_constants.h */; };
77CF6A5721E6E47E00BA8634 /* core_constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 77CF6A5421E6E47D00BA8634 /* core_constants.h */; };
77CF6A5821E6E47E00BA8634 /* log_defines.h in Headers */ = {isa = PBXBuildFile; fileRef = 77CF6A5521E6E47D00BA8634 /* log_defines.h */; };
Expand Down Expand Up @@ -1281,6 +1283,7 @@
775BEE4D1C16F993008D1629 /* WXDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXDefine.h; sourceTree = "<group>"; };
775BEE6C1C1BD8F4008D1629 /* WXImgLoaderProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXImgLoaderProtocol.h; sourceTree = "<group>"; };
775BEE701C1BD977008D1629 /* WXModuleProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXModuleProtocol.h; sourceTree = "<group>"; };
77A3D66D222F9F5B0078A6F5 /* WeexApiValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeexApiValue.h; sourceTree = "<group>"; };
77CF6A5421E6E47D00BA8634 /* core_constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = core_constants.h; sourceTree = "<group>"; };
77CF6A5521E6E47D00BA8634 /* log_defines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log_defines.h; sourceTree = "<group>"; };
77D160FD1C02DBE70010B15B /* WeexSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WeexSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -2576,6 +2579,7 @@
B8D66B7D2125572F003960BD /* include */ = {
isa = PBXGroup;
children = (
77A3D66D222F9F5B0078A6F5 /* WeexApiValue.h */,
B8D66B7E2125572F003960BD /* WeexApiHeader.h */,
);
name = include;
Expand Down Expand Up @@ -2797,6 +2801,7 @@
33CE19132153444900CF9670 /* WXJSFrameworkLoadProtocol.h in Headers */,
B8F2C7142133A8BC00635B37 /* vm_monitor.h in Headers */,
B8D66C012125572F003960BD /* constants_value.h in Headers */,
77A3D66E222F9F5B0078A6F5 /* WeexApiValue.h in Headers */,
74AD99841D5B0E59008F0336 /* WXPolyfillSet.h in Headers */,
74A4BA961CB365D100195969 /* WXAppConfiguration.h in Headers */,
B8D66C8721255730003960BD /* simple_render_factory.h in Headers */,
Expand Down Expand Up @@ -2946,6 +2951,7 @@
DCA445A31EFA570800D0CFA8 /* WXSDKManager.h in Headers */,
DCA445BE1EFA57BB00D0CFA8 /* WXComponentManager.h in Headers */,
DCA4459E1EFA56E500D0CFA8 /* WXUtility.h in Headers */,
77A3D66F222F9F5B0078A6F5 /* WeexApiValue.h in Headers */,
DCA445B91EFA579D00D0CFA8 /* WXErrorView.h in Headers */,
B8D66BE42125572F003960BD /* exec_state.h in Headers */,
B8D66C022125572F003960BD /* constants_value.h in Headers */,
Expand Down
4 changes: 2 additions & 2 deletions ios/sdk/WeexSDK/Sources/Utility/WXVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#import "WXVersion.h"
#import "WXDefine.h"

static const char* WeexSDKBuildTime = "2019-01-10 02:29:08 UTC";
static const unsigned long WeexSDKBuildTimestamp = 1547087348;
static const char* WeexSDKBuildTime = "2019-03-06 06:27:55 UTC";
static const unsigned long WeexSDKBuildTimestamp = 1551853675;

NSString* GetWeexSDKVersion(void)
{
Expand Down
42 changes: 2 additions & 40 deletions weex_core/Source/include/WeexApiHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <vector>
#include <set>
#include <map>
#include "WeexApiValue.h"

#ifdef OS_ANDROID
#include <jni.h>
#include "third_party/IPC/IPCResult.h"
Expand All @@ -39,16 +41,6 @@ namespace WeexCore {
} // namespace WeexCore
using namespace WeexCore;

struct WeexString {
uint32_t length;
uint16_t content[1];
};

struct WeexByteArray {
uint32_t length;
char content[1];
};

class WeexJSResult{
public:
std::unique_ptr<char[]> data;
Expand All @@ -62,36 +54,6 @@ typedef struct InitFrameworkParams {
WeexByteArray *value;
} INIT_FRAMEWORK_PARAMS;


enum class ParamsType {
INT32 = 1,
INT64,
FLOAT,
DOUBLE,
JSONSTRING,
STRING,
BYTEARRAY, /* terminated with zero. */
VOID,
JSUNDEFINED,
END,
};


typedef union ExecJsParamValue {
int32_t int32Value;
int64_t int64Value;
float floatValue;
double doubleValue;
WeexString *string;
WeexByteArray *byteArray;
} EXEC_JS_PARAM_VALUE;

typedef struct ValueWithType {
ParamsType type;
EXEC_JS_PARAM_VALUE value;
} VALUE_WITH_TYPE;


#ifdef OS_ANDROID

typedef void (*FuncSetJSVersion)(const char *jsVersion);
Expand Down
57 changes: 57 additions & 0 deletions weex_core/Source/include/WeexApiValue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* 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.
*/

#pragma once

struct WeexString {
uint32_t length;
uint16_t content[1];
};

struct WeexByteArray {
uint32_t length;
char content[1];
};

enum class ParamsType {
INT32 = 1,
INT64,
FLOAT,
DOUBLE,
JSONSTRING,
STRING,
BYTEARRAY, /* terminated with zero. */
VOID,
JSUNDEFINED,
END,
};

typedef union ExecJsParamValue {
int32_t int32Value;
int64_t int64Value;
float floatValue;
double doubleValue;
WeexString *string;
WeexByteArray *byteArray;
} EXEC_JS_PARAM_VALUE;

typedef struct ValueWithType {
ParamsType type;
EXEC_JS_PARAM_VALUE value;
} VALUE_WITH_TYPE;

0 comments on commit bd29205

Please sign in to comment.