You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ji...@apache.org on 2017/01/24 08:21:32 UTC

[21/50] [abbrv] incubator-weex git commit: * [ios] notify component readyToShow

* [ios] notify component readyToShow


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

Branch: refs/heads/master
Commit: 83bcadeb52c0fdc4a98f91193b1494ec99944a85
Parents: a1baf89
Author: acton393 <zh...@gmail.com>
Authored: Wed Jan 11 11:12:37 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Wed Jan 11 11:12:37 2017 +0800

----------------------------------------------------------------------
 .../Sources/Component/WXImageComponent.m        | 23 +++++++-------------
 .../WeexSDK/Sources/Component/WXTextComponent.m |  2 ++
 .../Sources/Display/WXComponent+Display.m       |  6 +----
 .../Sources/Manager/WXComponentManager.m        |  2 ++
 ios/sdk/WeexSDK/Sources/Model/WXComponent.h     |  2 +-
 ios/sdk/WeexSDK/Sources/Model/WXComponent.m     |  6 +++--
 6 files changed, 18 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bcadeb/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
index 5c070ed..569c900 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
@@ -225,7 +225,7 @@ static dispatch_queue_t WXImageUpdateQueue;
             dispatch_async(dispatch_get_main_queue(), ^{
                 self.layer.contents = nil;
                 weakSelf.imageDownloadFinish = YES;
-                [weakSelf notifyRenderFinish];
+                [weakSelf readyToShow];
             });
         }
     });
@@ -249,7 +249,7 @@ static dispatch_queue_t WXImageUpdateQueue;
                     downloadFailedBlock(placeholderSrc,error);
                     if ([strongSelf isViewLoaded] && !viewImage) {
                         ((UIImageView *)(strongSelf.view)).image = nil;
-                        [self notifyRenderFinish];
+                        [self readyToShow];
                     }
                     return;
                 }
@@ -260,7 +260,7 @@ static dispatch_queue_t WXImageUpdateQueue;
                 if ([strongSelf isViewLoaded] && !viewImage) {
                     ((UIImageView *)strongSelf.view).image = image;
                     weakSelf.imageDownloadFinish = YES;
-                    [self notifyRenderFinish];
+                    [self readyToShow];
                 }
             });
         }];
@@ -289,7 +289,7 @@ static dispatch_queue_t WXImageUpdateQueue;
                     }
                     if (error) {
                         downloadFailedBlock(imageSrc, error);
-                        [strongSelf notifyRenderFinish];
+                        [strongSelf readyToShow];
                         return ;
                     }
                     
@@ -300,7 +300,7 @@ static dispatch_queue_t WXImageUpdateQueue;
                     if ([strongSelf isViewLoaded]) {
                         strongSelf.imageDownloadFinish = YES;
                         ((UIImageView *)strongSelf.view).image = image;
-                        [strongSelf notifyRenderFinish];
+                        [strongSelf readyToShow];
                     }
                 });
             }];
@@ -308,18 +308,11 @@ static dispatch_queue_t WXImageUpdateQueue;
     }
 }
 
-- (void)renderFinish
+- (void)readyToShow
 {
     // when image download completely (success or failed)
-    if (_imageDownloadFinish) {
-        [super renderFinish];
-    }
-}
-
-- (void)notifyRenderFinish
-{
-    if (self.weexInstance.trackComponent) {
-        [self renderFinish];
+    if (self.weexInstance.trackComponent && _imageDownloadFinish) {
+        [super readyToShow];
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bcadeb/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index 64958ae..960e253 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -406,6 +406,8 @@ do {\
         pthread_mutex_unlock(&_textStorageMutex);
     }
     
+    [self readyToShow]; // notify super component
+    
     return textStorage;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bcadeb/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
index cf8478d..b2fcb54 100644
--- a/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
+++ b/ios/sdk/WeexSDK/Sources/Display/WXComponent+Display.m
@@ -67,11 +67,7 @@
 
 - (WXDisplayCompeletionBlock)displayCompeletionBlock
 {
-    return ^(CALayer *layer, BOOL finished) {
-        if (self.weexInstance.trackComponent) {
-            [self renderFinish];
-        }
-    };
+    return nil;
 }
 
 #pragma mark Private

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bcadeb/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
index 475a367..152d671 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.m
@@ -374,6 +374,7 @@ static css_node_t * rootNodeGetChild(void *context, int i)
     [self filterStyles:styles normalStyles:normalStyles resetStyles:resetStyles];
     [component _updateStylesOnComponentThread:normalStyles resetStyles:resetStyles isUpdateStyles:isUpdateStyles];
     [self _addUITask:^{
+        [component readyToShow];
         [component _updateStylesOnMainThread:normalStyles resetStyles:resetStyles];
     }];
 }
@@ -388,6 +389,7 @@ static css_node_t * rootNodeGetChild(void *context, int i)
     
     [component _updateAttributesOnComponentThread:attributes];
     [self _addUITask:^{
+        [component readyToShow];
         [component _updateAttributesOnMainThread:attributes];
     }];
 }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bcadeb/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.h b/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
index 63b3d85..c02eb9a 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.h
@@ -343,7 +343,7 @@ typedef void(^WXDisplayCompeletionBlock)(CALayer *layer, BOOL finished);
 /**
  * renderFinish
  */
-- (void)renderFinish;
+- (void)readyToShow;
 
 /**
  * @abstract Return a block to be called while drawing is finished.

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/83bcadeb/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
index 874a910..6953ee7 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
@@ -430,9 +430,11 @@
     WXAssertMainThread();
 }
 
-- (void)renderFinish
+- (void)readyToShow
 {
-    [self.supercomponent renderFinish];
+    if (self.weexInstance.trackComponent) {
+        [self.supercomponent readyToShow];
+    }
 }
 
 - (void)updateAttributes:(NSDictionary *)attributes