You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2018/11/14 06:26:15 UTC

[GitHub] cxfeng1 closed pull request #1756: [iOS] fix renderWithUrl on data_render

cxfeng1 closed pull request #1756: [iOS] fix renderWithUrl on data_render
URL: https://github.com/apache/incubator-weex/pull/1756
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 8cf079e158..0a75f5f16c 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -235,9 +235,7 @@ - (void)renderWithURL:(NSURL *)url options:(NSDictionary *)options data:(id)data
         WXLogError(@"Url must be passed if you use renderWithURL");
         return;
     }
-    if ([url.absoluteString hasSuffix:WEEX_LITE_URL_SUFFIX]) {
-        _defaultDataRender = YES;
-    }
+
     _scriptURL = url;
     [self _checkPageName];
     [self.apmInstance startRecord:self.instanceId];
@@ -278,7 +276,7 @@ - (void)_renderWithData:(NSData *)contents
     }
     
     if (_isRendered) {
-        [WXExceptionUtils commitCriticalExceptionRT:self.instanceId errCode:[NSString stringWithFormat:@"%d", WX_ERR_RENDER_TWICE] function:@"_renderWithOpcode:" exception:[NSString stringWithFormat:@"instance is rendered twice"] extParams:nil];
+        [WXExceptionUtils commitCriticalExceptionRT:self.instanceId errCode:[NSString stringWithFormat:@"%d", WX_ERR_RENDER_TWICE] function:@"_renderWithData:" exception:[NSString stringWithFormat:@"instance is rendered twice"] extParams:nil];
         return;
     }
 
@@ -336,9 +334,9 @@ - (void)_renderWithData:(NSData *)contents
         return;
     }
 
-    [WXTracingManager startTracingWithInstanceId:self.instanceId ref:nil className:nil name:WXTExecJS phase:WXTracingBegin functionName:@"renderWithOpcode" options:@{@"threadName":WXTMainThread}];
+    [WXTracingManager startTracingWithInstanceId:self.instanceId ref:nil className:nil name:WXTExecJS phase:WXTracingBegin functionName:@"_renderWithData" options:@{@"threadName":WXTMainThread}];
     [[WXSDKManager bridgeMgr] createInstance:self.instanceId contents:contents options:dictionary data:_jsData];
-    [WXTracingManager startTracingWithInstanceId:self.instanceId ref:nil className:nil name:WXTExecJS phase:WXTracingEnd functionName:@"renderWithOpcode" options:@{@"threadName":WXTMainThread}];
+    [WXTracingManager startTracingWithInstanceId:self.instanceId ref:nil className:nil name:WXTExecJS phase:WXTracingEnd functionName:@"_renderWithData" options:@{@"threadName":WXTMainThread}];
 
    // WX_MONITOR_PERF_SET(WXPTBundleSize, [data length], self);
     _isRendered = YES;
@@ -484,6 +482,11 @@ - (void)_renderWithRequest:(WXResourceRequest *)request options:(NSDictionary *)
     if (!newOptions[bundleUrlOptionKey]) {
         newOptions[bundleUrlOptionKey] = url.absoluteString;
     }
+
+    if ([url.absoluteString hasSuffix:WEEX_LITE_URL_SUFFIX]) {
+        newOptions[@"WLASM_RENDER"] = @(YES);
+    }
+
     // compatible with some wrong type, remove this hopefully in the future.
     if ([newOptions[bundleUrlOptionKey] isKindOfClass:[NSURL class]]) {
         WXLogWarning(@"Error type in options with key:bundleUrl, should be of type NSString, not NSURL!");
@@ -542,7 +545,7 @@ - (void)_renderWithRequest:(WXResourceRequest *)request options:(NSDictionary *)
             return;
         }
         
-        if (strongSelf.dataRender) {
+        if (([options[@"DATA_RENDER"] boolValue] && [options[@"RENDER_WITH_BINARY"] boolValue]) || [options[@"WLASM_RENDER"] boolValue]) {
             [strongSelf _renderWithData:data];
             return;
         }
@@ -779,7 +782,7 @@ - (CGFloat)pixelScaleFactor
 
 - (BOOL)dataRender
 {
-    if ([_options[@"WLASM_RENDER"] boolValue]) {
+    if ([_options[@"DATA_RENDER"] boolValue] || [_options[@"WLASM_RENDER"] boolValue]) {
         return YES;
     }
     return _defaultDataRender;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services