You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/03/02 03:23:30 UTC

[1/4] incubator-weex git commit: + [ios] fix websocket module crash ; load more in direction up; update websocket demo

Repository: incubator-weex
Updated Branches:
  refs/heads/0.11-dev 2f7dd8ab6 -> dd69c0588


+ [ios]  fix websocket module crash ;load more in direction up; update websocket demo


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

Branch: refs/heads/0.11-dev
Commit: 033b246dd6386df3f84b6c1f456a6eea2d3dd8ca
Parents: fa1c8b0
Author: kfeagle <su...@163.com>
Authored: Wed Mar 1 19:26:21 2017 +0800
Committer: kfeagle <su...@163.com>
Committed: Wed Mar 1 19:26:21 2017 +0800

----------------------------------------------------------------------
 examples/module/websocket-demo.we               | 222 ++++++++++---------
 .../Sources/Component/WXScrollerComponent.m     |   2 +-
 .../WeexSDK/Sources/Module/WXWebSocketModule.m  |   4 +-
 3 files changed, 120 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/033b246d/examples/module/websocket-demo.we
----------------------------------------------------------------------
diff --git a/examples/module/websocket-demo.we b/examples/module/websocket-demo.we
index 11d9c11..4fa338c 100644
--- a/examples/module/websocket-demo.we
+++ b/examples/module/websocket-demo.we
@@ -1,112 +1,124 @@
 <template>
-    <scroller>
-        <wxc-panel title="websocket" type="primary">
-            <input
-                    type="text"
-                    placeholder="please input message to send"
-                    class="input"
-                    autofocus="false"
-                    value=""
-                    onchange="onchange"
-                    oninput="oninput"
-                    id = "input"
-            />
-            <div style="flex-direction: row; justify-content: center;">
-                <wxc-button value="connect" size="small"  type="primary" onclick="{{connect}}"></wxc-button>
-                <wxc-button value="send" size="small" onclick="{{send}}" type="primary" style="margin-left:20px;"></wxc-button>
-                <wxc-button value="close" size="small" onclick="{{close}}" type="primary" style="margin-left:20px;"></wxc-button>
-
-            </div>
-
-            <wxc-panel title="method = send">
-                <text>{{sendinfo}}</text>
-            </wxc-panel>
-
-            <wxc-panel title="method = onopen">
-                <text>{{onopeninfo}}</text>
-            </wxc-panel>
-
-            <wxc-panel title="method = onmessage">
-                <text>{{onmessage}}</text>
-            </wxc-panel>
-
-            <wxc-panel title="method = onclose">
-                <text>{{oncloseinfo}}</text>
-            </wxc-panel>
-
-            <wxc-panel title="method = onerror">
-                <text>{{onerrorinfo}}</text>
-            </wxc-panel>
-
-            <wxc-panel title="method = close">
-                <text>{{closeinfo}}</text>
-            </wxc-panel>
-        </wxc-panel>
-    </scroller>
+  <scroller>
+    <div>
+      <div style="background-color: #286090">
+        <text class="title" style="height: 80 ;padding: 20;color: #FFFFFF">websocket</text>
+      </div>
+      <input
+              type="text"
+              placeholder="please input message to send"
+              class="input"
+              autofocus="false"
+              value=""
+              onchange="onchange"
+              oninput="oninput"
+              id = "input"
+      />
+      <div style="flex-direction: row; justify-content: center;">
+        <text class="button" onclick="{{connect}}">connect</text>
+        <text class="button" onclick="{{send}}">send</text>
+        <text class="button" onclick="{{close}}">close</text>
+      </div>
+      <div style="background-color: #D3D3D3;margin-top: 20">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = send</text>
+      </div>
+      <text style="color: #000000;height: 80">{{sendinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onopen</text>
+      </div>
+      <text style="color: #000000;height: 80">{{onopeninfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onmessage</text>
+      </div>
+      <text style="color: #000000;height: 100">{{onmessage}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onclose</text>
+      </div>
+      <text style="color: #000000;height: 80">{{oncloseinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = onerror</text>
+      </div>
+      <text style="color: #000000;height: 80">{{onerrorinfo}}</text>
+      <div style="background-color: #D3D3D3">
+        <text class="title" style="height: 80 ;padding: 20;color: #000000">method = close</text>
+      </div>
+      <text style="color: #000000;height: 80">{{closeinfo}}</text>
+    </div>
+    </div>
+  </scroller>
 </template>
-
 <style>
-    .input {
-        font-size: 40px;
-        height: 80px;
-        width: 600px;
-    }
+  .input {
+    font-size: 40;
+    height: 80;
+    width: 600;
+  }
+  .button {
+    font-size: 36;
+    width: 150;
+    color: #41B883;
+    text-align: center;
+    padding-top: 10;
+    padding-bottom: 10;
+    border-width: 2;
+    border-style: solid;
+    margin-right: 20;
+    border-color: rgb(162, 217, 192);
+    background-color: rgba(162, 217, 192, 0.2);
+  }
 </style>
-
 <script>
-    require('weex-components');
-    var navigator = require('@weex-module/navigator');
-    var modal = require('@weex-module/modal');
-    var websocket = require('@weex-module/webSocket');
-    module.exports = {
-        data: {
-            connectinfo: '',
-            sendinfo: '',
-            onopeninfo: '',
-            onmessage: '',
-            oncloseinfo: '',
-            onerrorinfo: '',
-            closeinfo: '',
-            txtInput:'',
-            navBarHeight: 88,
-            title: 'Navigator',
-            dir: 'examples',
-            baseURL: '',
-        },
-        methods: {
-            connect:function() {
-                websocket.WebSocket('ws://115.29.193.48:8088','');
-                var self = this;
-                websocket.onopen = function(e)
-                {
-                    self.onopeninfo = e;
-                }
-                websocket.onmessage = function(e)
-                {
-                    self.onmessage = e.data;
-                }
-                websocket.onerror = function(e)
-                {
-                    self.onerrorinfo = e.data;
-                }
-                websocket.onclose = function(e)
-                {
-                    self.onerrorinfo = e.code;
-                }
-            },
-            send:function(e) {
-                var input = this.$el('input');
-                input.blur();
-                websocket.send(this.txtInput);
-                this.sendinfo = this.txtInput;
-
-            },
-            oninput: function(event) {
-                this.txtInput = event.value;
-            },
-            close:function(e) {
-                websocket.close();
-            },
+  var websocket = require('@weex-module/webSocket');
+  module.exports = {
+    data: {
+      connectinfo: '',
+      sendinfo: '',
+      onopeninfo: '',
+      onmessage: '',
+      oncloseinfo: '',
+      onerrorinfo: '',
+      closeinfo: '',
+      txtInput:'',
+      navBarHeight: 88,
+      title: 'Navigator',
+      dir: 'examples',
+      baseURL: '',
+    },
+    methods: {
+      connect:function() {
+        websocket.WebSocket('ws://echo.websocket.org','');
+        var self = this;
+        self.onopeninfo = 'connecting...'
+        websocket.onopen = function(e)
+        {
+          self.onopeninfo = 'websocket open';
+        }
+        websocket.onmessage = function(e)
+        {
+          self.onmessage = e.data;
+        }
+        websocket.onerror = function(e)
+        {
+          self.onerrorinfo = e.data;
         }
-    };
+        websocket.onclose = function(e)
+        {
+          self.onopeninfo = '';
+          self.onerrorinfo = e.code;
+        }
+      },
+      send:function(e) {
+        var input = this.$el('input');
+        input.blur();
+        websocket.send(this.txtInput);
+        this.sendinfo = this.txtInput;
+      },
+      oninput: function(event) {
+        this.txtInput = event.value;
+      },
+      close:function(e) {
+        websocket.close();
+      },
+    }
+  };
 </script>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/033b246d/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
index d0bef9b..0e40c88 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.m
@@ -423,6 +423,7 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
         _direction = @"down";
     } else if(_lastContentOffset.y < scrollView.contentOffset.y) {
         _direction = @"up";
+        [self handleLoadMore];
     }
    
     _lastContentOffset = scrollView.contentOffset;
@@ -439,7 +440,6 @@ WX_EXPORT_METHOD(@selector(resetLoadmore))
 
     // check sticky
     [self adjustSticky];
-    [self handleLoadMore];
     [self handleAppear];
     
     if (self.onScroll) {

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/033b246d/ios/sdk/WeexSDK/Sources/Module/WXWebSocketModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXWebSocketModule.m b/ios/sdk/WeexSDK/Sources/Module/WXWebSocketModule.m
index 239c34c..ebcdf5b 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXWebSocketModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXWebSocketModule.m
@@ -67,7 +67,7 @@ WX_EXPORT_METHOD(@selector(onclose:))
         if (weakSelf) {
             WXLogError(@":( Websocket Failed With Error %@", error);
             NSMutableDictionary *dict = [NSMutableDictionary new];
-            [dict setObject:error.userInfo forKey:@"data"];
+            [dict setObject:error.userInfo?[WXUtility JSONString:error.userInfo]:@"" forKey:@"data"];
             if (weakSelf.errorCallBack) {
                 weakSelf.errorCallBack(dict, true);
             }
@@ -79,7 +79,7 @@ WX_EXPORT_METHOD(@selector(onclose:))
                 WXLogInfo(@"Websocket colse ");
                 NSMutableDictionary * callbackRsp = [[NSMutableDictionary alloc] init];
                 [callbackRsp setObject:[NSNumber numberWithInteger:code] forKey:@"code"];
-                [callbackRsp setObject:reason forKey:@"reason"];
+                [callbackRsp setObject:reason?reason:@"" forKey:@"reason"];
                 [callbackRsp setObject:wasClean?@true:@false forKey:@"wasClean"];
                 if (weakSelf.closeCallBack) {
                     weakSelf.closeCallBack(callbackRsp,false);


[2/4] incubator-weex git commit: + [ios] because rax transform number to native, the text weight will lose effect

Posted by cx...@apache.org.
+ [ios] because rax transform number to native,the text weight will lose effect


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

Branch: refs/heads/0.11-dev
Commit: 7ec9dfbdb7469b6be6fc23d1a166691e0973d1a6
Parents: fa1c8b0
Author: kfeagle <su...@163.com>
Authored: Wed Mar 1 20:07:28 2017 +0800
Committer: kfeagle <su...@163.com>
Committed: Wed Mar 1 20:07:28 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 52 ++++++++++++------------
 1 file changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7ec9dfbd/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
index c497d28..b0de541 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
@@ -503,32 +503,32 @@ WX_NUMBER_CONVERT(NSUInteger, unsignedIntegerValue)
 
 + (CGFloat)WXTextWeight:(id)value
 {
-    if([value isKindOfClass:[NSString class]]){
-        NSString *string = (NSString *)value;
-        if ([string isEqualToString:@"normal"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
-        else if ([string isEqualToString:@"bold"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
-        else if ([string isEqualToString:@"100"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.8:UIFontWeightUltraLight;
-        else if ([string isEqualToString:@"200"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.6:UIFontWeightThin;
-        else if ([string isEqualToString:@"300"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.4:UIFontWeightLight;
-        else if ([string isEqualToString:@"400"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
-        else if ([string isEqualToString:@"500"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.23:UIFontWeightMedium;
-        else if ([string isEqualToString:@"600"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.3:UIFontWeightSemibold;
-        else if ([string isEqualToString:@"700"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
-        else if ([string isEqualToString:@"800"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.56:UIFontWeightHeavy;
-        else if ([string isEqualToString:@"900"])
-            return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.62:UIFontWeightBlack;
-
-    }
+    NSString *string = [WXConvert NSString:value];
+    if (!string)
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
+    else if ([string isEqualToString:@"normal"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
+    else if ([string isEqualToString:@"bold"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
+    else if ([string isEqualToString:@"100"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.8:UIFontWeightUltraLight;
+    else if ([string isEqualToString:@"200"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.6:UIFontWeightThin;
+    else if ([string isEqualToString:@"300"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.4:UIFontWeightLight;
+    else if ([string isEqualToString:@"400"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
+    else if ([string isEqualToString:@"500"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.23:UIFontWeightMedium;
+    else if ([string isEqualToString:@"600"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.3:UIFontWeightSemibold;
+    else if ([string isEqualToString:@"700"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
+    else if ([string isEqualToString:@"800"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.56:UIFontWeightHeavy;
+    else if ([string isEqualToString:@"900"])
+        return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.62:UIFontWeightBlack;
+        
     return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
 }
 


[4/4] incubator-weex git commit: Merge branch 'ios-bugfix-textweight-0.11-dev' of https://github.com/kfeagle/incubator-weex into 0.11-dev This closes #12

Posted by cx...@apache.org.
Merge branch 'ios-bugfix-textweight-0.11-dev' of https://github.com/kfeagle/incubator-weex into 0.11-dev
This closes #12


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

Branch: refs/heads/0.11-dev
Commit: dd69c05881eb501fd8d73cd8741abcba67f5c251
Parents: ef0e462 7ec9dfb
Author: cxfeng <yi...@alibaba-inc.com>
Authored: Thu Mar 2 11:23:08 2017 +0800
Committer: cxfeng <yi...@alibaba-inc.com>
Committed: Thu Mar 2 11:23:08 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Utility/WXConvert.m | 52 ++++++++++++------------
 1 file changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------



[3/4] incubator-weex git commit: Merge branch 'ios-bugfix-0.11-dev' of https://github.com/kfeagle/incubator-weex into 0.11-dev

Posted by cx...@apache.org.
Merge branch 'ios-bugfix-0.11-dev' of https://github.com/kfeagle/incubator-weex into 0.11-dev

This closes #11


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

Branch: refs/heads/0.11-dev
Commit: ef0e462810ea2ecee4208953beab387aac964c6b
Parents: 2f7dd8a 033b246
Author: cxfeng <yi...@alibaba-inc.com>
Authored: Thu Mar 2 11:19:03 2017 +0800
Committer: cxfeng <yi...@alibaba-inc.com>
Committed: Thu Mar 2 11:19:03 2017 +0800

----------------------------------------------------------------------
 examples/module/websocket-demo.we               | 222 ++++++++++---------
 .../Sources/Component/WXScrollerComponent.m     |   2 +-
 .../WeexSDK/Sources/Module/WXWebSocketModule.m  |   4 +-
 3 files changed, 120 insertions(+), 108 deletions(-)
----------------------------------------------------------------------