You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/09 08:38:46 UTC

[05/50] incubator-weex git commit: * [ios] add config to clear data when did receive response

* [ios] add config to clear data when did receive response


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

Branch: refs/heads/release
Commit: 70098ce3a1871a40d8fca64ccddddcbb1be549b7
Parents: bf3ab44
Author: acton393 <zh...@gmail.com>
Authored: Sat Sep 30 17:38:18 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Sat Sep 30 17:38:18 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/70098ce3/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m b/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m
index e3b58fd..9015625 100644
--- a/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m
+++ b/ios/sdk/WeexSDK/Sources/Loader/WXResourceLoader.m
@@ -22,6 +22,8 @@
 #import "WXLog.h"
 #import "WXHandlerFactory.h"
 #import "WXSDKError.h"
+#import "WXConfigCenterProtocol.h"
+#import "WXSDKEngine.h"
 
 //deprecated
 #import "WXNetworkProtocol.h"
@@ -138,6 +140,14 @@
     WXLogDebug(@"request:%@ didReceiveResponse:%@ ", request, response);
     
     _response = response;
+    id<WXConfigCenterProtocol> configCenter = [WXSDKEngine handlerForProtocol:@protocol(WXConfigCenterProtocol)];
+    if ([configCenter respondsToSelector:@selector(configForKey:defaultValue:isDefault:)]) {
+        BOOL isDefault;
+        BOOL clearResponseData = [[configCenter configForKey:@"iOS_weex_ext_config.clearResponseDataWhenDidReceiveResponse" defaultValue:@(NO) isDefault:&isDefault] boolValue];
+        if(clearResponseData) {
+            _data = nil;
+        }
+    }
     
     if (self.onResponseReceived) {
         self.onResponseReceived(response);