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

[36/50] incubator-weex git commit: Merge remote-tracking branch 'upstream/dev' into 0.11-dev

Merge remote-tracking branch 'upstream/dev' into 0.11-dev

# Conflicts:
#	examples/module/websocket-demo.we
#	ios/sdk/WeexSDK/Sources/Utility/WXUtility.m


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

Branch: refs/heads/0.12-dev
Commit: b3aa98de26f97bf5f84644a055b1ef203d0d0249
Parents: ac8a7bd 9745b74
Author: acton393 <zh...@gmail.com>
Authored: Mon Mar 20 10:52:15 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Mon Mar 20 10:52:15 2017 +0800

----------------------------------------------------------------------
 CONTRIBUTING.md                                 |  38 +-
 doc/_config.yml                                 |   9 +-
 doc/advanced/extend-to-android.md               |   2 +-
 doc/package.json                                |   2 +-
 doc/source/cn/faq.md                            |   6 +-
 doc/source/cn/guide/contributing.md             | 106 +++++
 doc/source/cn/guide/dev-with-weexpack.md        |  11 -
 doc/source/cn/guide/index.md                    | 123 ++----
 doc/source/cn/guide/integrate-to-your-app.md    |   6 +-
 doc/source/cn/guide/intro/devtools.md           |  99 -----
 doc/source/cn/guide/intro/index.md              |   2 +-
 doc/source/cn/guide/intro/using-vue.md          |   2 +-
 doc/source/cn/guide/intro/write-once.md         |   2 +-
 doc/source/cn/guide/set-up-env.md               | 128 ++++++
 doc/source/cn/guide/tools/devtools.md           | 111 ++++++
 doc/source/cn/guide/tools/index.md              |  11 +
 doc/source/cn/guide/tools/weexpack.md           | 388 +++++++++++++++++++
 .../cn/references/advanced/extend-jsfm.md       |   2 +-
 .../cn/references/advanced/extend-to-android.md |  22 +-
 .../cn/references/advanced/extend-to-html5.md   |   2 +-
 .../cn/references/advanced/extend-to-ios.md     | 233 +++++------
 doc/source/cn/references/advanced/index.md      |   2 +-
 .../advanced/integrate-devtool-to-android.md    |   6 +-
 .../advanced/integrate-devtool-to-ios.md        |   8 +-
 doc/source/cn/references/android-apis.md        |  25 +-
 doc/source/cn/references/common-style.md        |  10 +-
 doc/source/cn/references/components/a.md        |  25 +-
 doc/source/cn/references/components/cell.md     |   7 +-
 doc/source/cn/references/components/div.md      |  12 +-
 doc/source/cn/references/components/image.md    |  18 +-
 .../cn/references/components/indicator.md       |   3 +-
 doc/source/cn/references/components/input.md    |   2 +-
 doc/source/cn/references/components/list.md     |   6 +-
 doc/source/cn/references/components/loading.md  |   2 +
 doc/source/cn/references/components/refresh.md  |   4 +-
 doc/source/cn/references/components/scroller.md |   6 +-
 doc/source/cn/references/components/slider.md   |   2 +-
 doc/source/cn/references/components/switch.md   |   2 +-
 doc/source/cn/references/components/text.md     |   2 +-
 doc/source/cn/references/components/textarea.md |   2 +-
 doc/source/cn/references/components/video.md    |   2 +-
 doc/source/cn/references/components/web.md      |   2 +-
 doc/source/cn/references/gesture.md             |   3 +-
 doc/source/cn/references/ios-apis.md            |   4 +-
 doc/source/cn/references/js-service/index.md    | 118 ++++++
 .../cn/references/migration/difference.md       |   2 +-
 doc/source/cn/references/migration/index.md     |   2 +-
 .../references/migration/migration-from-weex.md |   2 +-
 doc/source/cn/references/modules/animation.md   |   4 +-
 doc/source/cn/references/modules/clipboard.md   |   2 +-
 doc/source/cn/references/modules/dom.md         |   8 +-
 doc/source/cn/references/modules/globalevent.md |   2 +-
 doc/source/cn/references/modules/index.md       |  31 +-
 doc/source/cn/references/modules/modal.md       |   2 +-
 doc/source/cn/references/modules/navigator.md   |   2 +-
 doc/source/cn/references/modules/storage.md     |   4 +-
 doc/source/cn/references/modules/stream.md      |   2 +-
 doc/source/cn/references/modules/websocket.md   | 215 ++++++++++
 doc/source/cn/references/modules/webview.md     |   2 +-
 doc/source/cn/references/path.md                |  32 +-
 .../cn/references/vue/difference-of-vuex.md     |   2 +-
 .../cn/references/vue/difference-with-web.md    |   9 +-
 doc/source/cn/references/vue/index.md           |   2 +-
 .../cn/v-0.10/advanced/extend-to-html5.md       |   2 +-
 .../cn/v-0.10/advanced/integrate-to-android.md  |   4 +-
 .../cn/v-0.10/references/modules/globalevent.md |   2 +-
 .../cn/v-0.10/references/modules/storage.md     |   2 +-
 doc/source/cn/v-0.10/tools/devtools.md          |   4 +-
 doc/source/faq.md                               |   5 +-
 doc/source/guide/contributing.md                | 106 +++++
 doc/source/guide/dev-with-weexpack.md           |  12 -
 doc/source/guide/index.md                       |  49 ++-
 doc/source/guide/integrate-to-your-app.md       | 274 ++++++++++++-
 doc/source/guide/intro/devtools.md              | 100 -----
 doc/source/guide/intro/using-vue.md             |   2 +-
 doc/source/guide/set-up-env.md                  |  93 +++++
 doc/source/guide/tools/devtools.md              | 100 +++++
 doc/source/guide/tools/index.md                 |  11 +
 doc/source/guide/tools/weexpack.md              | 300 ++++++++++++++
 doc/source/references/advanced/extend-jsfm.md   | 159 +++++++-
 .../references/advanced/extend-to-android.md    |  20 +-
 .../references/advanced/extend-to-html5.md      |  88 ++++-
 .../advanced/integrate-devtool-to-android.md    | 137 ++++++-
 .../advanced/integrate-devtool-to-ios.md        | 184 ++++++++-
 doc/source/references/android-apis.md           | 211 +++++++++-
 doc/source/references/common-style.md           |  16 +-
 doc/source/references/components/a.md           |   2 +-
 doc/source/references/components/cell.md        |   4 +-
 doc/source/references/components/div.md         |   6 +-
 doc/source/references/components/image.md       |  11 +-
 doc/source/references/components/indicator.md   |   6 +-
 doc/source/references/components/input.md       |   4 +-
 doc/source/references/components/list.md        |   4 +-
 doc/source/references/components/refresh.md     |   4 +-
 doc/source/references/components/scroller.md    |  10 +-
 doc/source/references/components/slider.md      |  12 +-
 doc/source/references/components/switch.md      |   4 +-
 doc/source/references/components/text.md        |   2 +-
 doc/source/references/components/textarea.md    |   4 +-
 doc/source/references/components/video.md       |   4 +-
 doc/source/references/components/web.md         |   6 +-
 doc/source/references/gesture.md                |   2 +-
 doc/source/references/ios-apis.md               |  70 +++-
 doc/source/references/modules/animation.md      |   2 +-
 doc/source/references/modules/clipboard.md      |   2 +-
 doc/source/references/modules/dom.md            |   8 +-
 doc/source/references/modules/globalevent.md    |   6 +-
 doc/source/references/modules/index.md          |  31 +-
 doc/source/references/modules/modal.md          |   2 +-
 doc/source/references/modules/navigator.md      |   2 +-
 doc/source/references/modules/storage.md        |   4 +-
 doc/source/references/modules/stream.md         |   2 +-
 doc/source/references/modules/websocket.md      | 214 ++++++++++
 doc/source/references/modules/webview.md        |   8 +-
 doc/source/references/native-dom-api.md         | 203 +++++++++-
 doc/source/references/platfrom-difference.md    |  11 +
 doc/source/references/vue/difference-of-vuex.md |  85 +++-
 .../references/vue/difference-with-web.md       | 143 ++++++-
 doc/source/references/weex-variable.md          |  41 +-
 doc/source/v-0.10/advanced/extend-to-html5.md   |   2 +-
 .../v-0.10/advanced/integrate-to-android.md     |   6 +-
 .../guide/how-to/preview-in-playground-app.md   |   2 +-
 .../v-0.10/references/modules/globalevent.md    |   2 +-
 doc/themes/weex/languages/cn.yml                |   5 +-
 doc/themes/weex/languages/en.yml                |  45 ++-
 .../weex/layout/_partial/after-footer.ejs       |   2 +-
 doc/themes/weex/layout/_partial/footer.ejs      |   8 +-
 doc/themes/weex/layout/_partial/header.ejs      |  30 +-
 doc/themes/weex/layout/_partial/search-form.ejs |   2 +-
 doc/themes/weex/layout/_partial/sidebar.ejs     |  15 +-
 doc/themes/weex/layout/_partial/slider.ejs      |   2 +-
 doc/themes/weex/layout/index.ejs                |  29 +-
 doc/themes/weex/source/css/index.scss           |   4 +-
 doc/themes/weex/source/css/media-queries.scss   |   3 +
 doc/themes/weex/source/css/partial/footer.scss  |   1 +
 doc/themes/weex/source/css/partial/header.scss  |  32 +-
 .../weex/source/css/partial/search-form.scss    |   3 -
 doc/themes/weex/source/css/partial/sidebar.scss |   1 +
 doc/themes/weex/source/js/common.js             |  77 +++-
 doc/themes/weex/source/js/example.js            |   2 +-
 examples/module/websocket-demo.we               |   2 +-
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m   |   4 +-
 ios/sdk/WeexSDK/Sources/Utility/WXUtility.m     |  17 +-
 143 files changed, 4184 insertions(+), 815 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b3aa98de/examples/module/websocket-demo.we
----------------------------------------------------------------------
diff --cc examples/module/websocket-demo.we
index 4fa338c,74ad8a6..65de2e7
--- a/examples/module/websocket-demo.we
+++ b/examples/module/websocket-demo.we
@@@ -1,124 -1,124 +1,124 @@@
  <template>
 -    <scroller>
 -        <div>
 -            <div style="background-color: #286090">
 -                <text class="title" style="height: 80px ;padding: 20px;color: white">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: lightgray;margin-top: 20px">
 -                <text class="title" style="height: 80px ;padding: 20px;color: black">method = send</text>
 -            </div>
 -            <text style="color: black;height: 80px">{{sendinfo}}</text>
 -            <div style="background-color: lightgray">
 -                <text class="title" style="height: 80px ;padding: 20px;color: black">method = onopen</text>
 -            </div>
 -            <text style="color: black;height: 80px">{{onopeninfo}}</text>
 -            <div style="background-color: lightgray">
 -                <text class="title" style="height: 80px ;padding: 20px;color: black">method = onmessage</text>
 -            </div>
 -            <text style="color: black;height: 100px">{{onmessage}}</text>
 -            <div style="background-color: lightgray">
 -                <text class="title" style="height: 80px ;padding: 20px;color: black">method = onclose</text>
 -            </div>
 -            <text style="color: black;height: 80px">{{oncloseinfo}}</text>
 -            <div style="background-color: lightgray">
 -                <text class="title" style="height: 80px ;padding: 20px;color: black">method = onerror</text>
 -            </div>
 -            <text style="color: black;height: 80px">{{onerrorinfo}}</text>
 -            <div style="background-color: lightgray">
 -                <text class="title" style="height: 80px ;padding: 20px;color: black">method = close</text>
 -            </div>
 -            <text style="color: black;height: 80px">{{closeinfo}}</text>
 -        </div>
 -        </div>
 -    </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;
 -    }
 -    .button {
 -        font-size: 36px;
 -        width: 150px;
 -        color: #41B883;
 -        text-align: center;
 -        padding-top: 10px;
 -        padding-bottom: 10px;
 -        border-width: 2px;
 -        border-style: solid;
 -        margin-right: 20px;
 -        border-color: rgb(162, 217, 192);
 -        background-color: rgba(162, 217, 192, 0.2);
 -    }
 +  .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>
 -    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();
 -            },
 +  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;
++          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>

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b3aa98de/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b3aa98de/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
----------------------------------------------------------------------
diff --cc ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
index 6668e9d,23b1b1b..443595a
--- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
@@@ -342,23 -342,13 +342,22 @@@ static BOOL WXNotStat
          if ([self isFileExist:fpath]) {
              // if the font file is not the correct font file. it will crash by singal 9
              CFURLRef fontURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge CFStringRef)fpath, kCFURLPOSIXPathStyle, false);
 -            CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL(fontURL);
 -            CFRelease(fontURL);
 -            CGFontRef graphicFont = CGFontCreateWithDataProvider(fontDataProvider);
 -            CGDataProviderRelease(fontDataProvider);
 -            CTFontRef smallFont = CTFontCreateWithGraphicsFont(graphicFont, size, NULL, NULL);
 -            CFRelease(graphicFont);
 -            font = (__bridge_transfer UIFont*)smallFont;
 +            if (fontURL) {
 +                CFErrorRef error = nil;
 +                CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error);
 +                if (error) {
 +                    CFRelease(error);
 +                    error = nil;
 +                    CTFontManagerUnregisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
 +                    CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, NULL);
 +                }
 +                NSArray *descriptors = (__bridge_transfer NSArray *)CTFontManagerCreateFontDescriptorsFromURL(fontURL);
 +                // length of descriptors here will be only one.
 +                for (NSFontDescriptor *desc in descriptors) {
 +                    font = [UIFont fontWithDescriptor:desc size:fontSize];
 +                }
 +                CFRelease(fontURL);
 +            }
-             
          }else {
              [[WXRuleManager sharedInstance] removeRule:@"fontFace" rule:@{@"fontFamily": fontFamily}];
          }