You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/08/10 09:08:14 UTC
[5/8] incubator-weex git commit: + [ios] add array buffer for stream
+ [ios] add array buffer for stream
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c914eb16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c914eb16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c914eb16
Branch: refs/heads/0.16-dev
Commit: c914eb164644a4fc77aae4e8cf0d0516734f3ad6
Parents: 0966957
Author: 齐山 <su...@163.com>
Authored: Tue Aug 8 16:02:39 2017 +0800
Committer: 齐山 <su...@163.com>
Committed: Tue Aug 8 16:02:39 2017 +0800
----------------------------------------------------------------------
ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m | 13 +++++++++++++
1 file changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c914eb16/ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m b/ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m
index a386fd0..4b01cde 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXStreamModule.m
@@ -32,6 +32,7 @@
WX_EXPORT_METHOD(@selector(sendHttp:callback:))
WX_EXPORT_METHOD(@selector(fetch:callback:progressCallback:))
+WX_EXPORT_METHOD(@selector(fetchWithArrayBuffer:options:callback:progressCallback:))
- (void)fetch:(NSDictionary *)options callback:(WXModuleCallback)callback progressCallback:(WXModuleKeepAliveCallback)progressCallback
{
@@ -104,6 +105,18 @@ WX_EXPORT_METHOD(@selector(fetch:callback:progressCallback:))
[loader start];
}
+- (void)fetchWithArrayBuffer:(id)arrayBuffer options:(NSDictionary *)options callback:(WXModuleCallback)callback progressCallback:(WXModuleKeepAliveCallback)progressCallback
+{
+ NSMutableDictionary *newOptions = [options mutableCopy];
+ if([arrayBuffer isKindOfClass:[NSDictionary class]]){
+ NSData *sendData = [WXUtility base64DictToData:arrayBuffer];
+ if(sendData){
+ [newOptions setObject:sendData forKey:@"body"];
+ }
+ }
+ [self fetch:newOptions callback:callback progressCallback:progressCallback];
+}
+
- (WXResourceRequest*)_buildRequestWithOptions:(NSDictionary*)options callbackRsp:(NSMutableDictionary*)callbackRsp
{
// parse request url