Repository: incubator-weex
Updated Branches:
  refs/heads/0.16-dev d1bdd73bc -> 4bf47ed41


+ [ios] support extend call native for third part


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b3e40493
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b3e40493
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b3e40493

Branch: refs/heads/0.16-dev
Commit: b3e404937bafa77cee4544c97598c1c4ec6ef2ed
Parents: f102f3f
Author: 齐山 <sunjjb...@163.com>
Authored: Sun Jul 23 21:30:45 2017 +0800
Committer: 齐山 <sunjjb...@163.com>
Committed: Sun Jul 23 21:30:45 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK.xcodeproj/project.pbxproj       |  4 +++
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 14 ++++++++++
 .../Protocol/WXExtendCallNativeProtocol.h       | 27 ++++++++++++++++++++
 3 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b3e40493/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj 
b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
index d16e630..46f7adb 100644
--- a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
+++ b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
@@ -238,6 +238,7 @@
                C41E1A981DC1FD15009C7F90 /* WXDatePickerManager.m in Sources */ 
= {isa = PBXBuildFile; fileRef = C41E1A961DC1FD15009C7F90 /* 
WXDatePickerManager.m */; };
                C43C03E81EC8ACA40044C7FF /* WXPrerenderManager.h in Headers */ 
= {isa = PBXBuildFile; fileRef = C43C03E41EC8ACA40044C7FF /* 
WXPrerenderManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
                C43C03E91EC8ACA40044C7FF /* WXPrerenderManager.m in Sources */ 
= {isa = PBXBuildFile; fileRef = C43C03E51EC8ACA40044C7FF /* 
WXPrerenderManager.m */; };
+               C4424E5B1F24DA3D009F52E2 /* WXExtendCallNativeProtocol.h in 
Headers */ = {isa = PBXBuildFile; fileRef = C4424E591F24DA3D009F52E2 /* 
WXExtendCallNativeProtocol.h */; };
                C4B3D6D41E6954300013F38D /* WXEditComponent.h in Headers */ = 
{isa = PBXBuildFile; fileRef = C4B3D6D21E6954300013F38D /* WXEditComponent.h 
*/; };
                C4B3D6D51E6954300013F38D /* WXEditComponent.m in Sources */ = 
{isa = PBXBuildFile; fileRef = C4B3D6D31E6954300013F38D /* WXEditComponent.m 
*/; };
                C4B834271DE69B09007AD27E /* WXPickerModule.m in Sources */ = 
{isa = PBXBuildFile; fileRef = C4B834251DE69B09007AD27E /* WXPickerModule.m */; 
};
@@ -555,6 +556,7 @@
                C41E1A961DC1FD15009C7F90 /* WXDatePickerManager.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= WXDatePickerManager.m; sourceTree = "<group>"; };
                C43C03E41EC8ACA40044C7FF /* WXPrerenderManager.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
WXPrerenderManager.h; sourceTree = "<group>"; };
                C43C03E51EC8ACA40044C7FF /* WXPrerenderManager.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= WXPrerenderManager.m; sourceTree = "<group>"; };
+               C4424E591F24DA3D009F52E2 /* WXExtendCallNativeProtocol.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = WXExtendCallNativeProtocol.h; sourceTree = "<group>"; };
                C4B3D6D21E6954300013F38D /* WXEditComponent.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
WXEditComponent.h; sourceTree = "<group>"; };
                C4B3D6D31E6954300013F38D /* WXEditComponent.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= WXEditComponent.m; sourceTree = "<group>"; };
                C4B834251DE69B09007AD27E /* WXPickerModule.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= WXPickerModule.m; sourceTree = "<group>"; };
@@ -1002,6 +1004,7 @@
                                74EF31A91DE58AE600667A07 /* 
WXURLRewriteProtocol.h */,
                                042013AC1E66CD6A001FC79C /* 
WXValidateProtocol.h */,
                                DC6836E51EBB12B200AD2D84 /* 
WXConfigCenterProtocol.h */,
+                               C4424E591F24DA3D009F52E2 /* 
WXExtendCallNativeProtocol.h */,
                        );
                        path = Protocol;
                        sourceTree = "<group>";
@@ -1338,6 +1341,7 @@
                                744BEA551D05178F00452B5D /* 
WXComponent+Display.h in Headers */,
                                741081231CED6756001BC6E5 /* 
WXComponentFactory.h in Headers */,
                                59D3CA4A1CFC3CE1008835DC /* NSTimer+Weex.h in 
Headers */,
+                               C4424E5B1F24DA3D009F52E2 /* 
WXExtendCallNativeProtocol.h in Headers */,
                                D334510C1D3E19B80083598A /* WXCanvasModule.h in 
Headers */,
                                742AD73A1DF98C8B007DC46C /* WXResourceLoader.h 
in Headers */,
                                746319291C71B92600EFEBD4 /* WXModalUIModule.h 
in Headers */,

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b3e40493/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m 
b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
index ee9406a..f241502 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m
@@ -34,6 +34,7 @@
 #import "JSValue+Weex.h"
 #import "WXJSExceptionProtocol.h"
 #import "WXSDKManager.h"
+#import "WXExtendCallNativeProtocol.h"
 
 #import <dlfcn.h>
 
@@ -103,6 +104,9 @@
                                        initWithData:nsdataFromBase64String 
encoding:NSUTF8StringEncoding];
             return base64Decoded;
         };
+        _jsContext[@"extendCallNative"] = ^(JSValue *value ) {
+            return [weakSelf extendCallNative:[value toDictionary]];
+        };
         
         _jsContext[@"nativeLog"] = ^() {
             static NSDictionary *levelMap;
@@ -496,4 +500,14 @@
         [_timers removeObject:ret];
     }
 }
+
+-(id)extendCallNative:(NSDictionary *)dict
+{
+    id extendCallNative = [WXSDKEngine 
handlerForProtocol:@protocol(WXExtendCallNativeProtocol)];
+    if(extendCallNative){
+        return [extendCallNative excuteCallNative:dict];
+    }
+    return @(-1);
+}
+
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b3e40493/ios/sdk/WeexSDK/Sources/Protocol/WXExtendCallNativeProtocol.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Protocol/WXExtendCallNativeProtocol.h 
b/ios/sdk/WeexSDK/Sources/Protocol/WXExtendCallNativeProtocol.h
new file mode 100644
index 0000000..5afb1dc
--- /dev/null
+++ b/ios/sdk/WeexSDK/Sources/Protocol/WXExtendCallNativeProtocol.h
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+
+#import <Foundation/Foundation.h>
+
+@protocol WXExtendCallNativeProtocol <NSObject>
+
+- (id)excuteCallNative:(NSDictionary *)dict;
+
+@end

Reply via email to