Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] Add bundle response url in options dictionary.
Browse files Browse the repository at this point in the history
  • Loading branch information
wqyfavor committed Apr 8, 2019
1 parent f466641 commit 6c74fb7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define WEEX_LITE_URL_SUFFIX @"wlasm"

NSString *const bundleUrlOptionKey = @"bundleUrl";
NSString *const bundleResponseUrlOptionKey = @"bundleResponseUrl";

NSTimeInterval JSLibInitTime = 0;

Expand Down Expand Up @@ -486,6 +487,14 @@ - (void)_renderWithRequest:(WXResourceRequest *)request options:(NSDictionary *)
[self.apmInstance onStage:KEY_PAGE_STAGES_DOWN_BUNDLE_START];
_mainBundleLoader.onFinished = ^(WXResourceResponse *response, NSData *data) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (strongSelf == nil) {
return;
}

NSMutableDictionary* optionsCopy = [strongSelf->_options mutableCopy];
optionsCopy[bundleResponseUrlOptionKey] = [response.URL absoluteString];
strongSelf->_options = [optionsCopy copy];

NSError *error = nil;
if ([response isKindOfClass:[NSHTTPURLResponse class]] && ((NSHTTPURLResponse *)response).statusCode != 200) {
error = [NSError errorWithDomain:WX_ERROR_DOMAIN
Expand Down

0 comments on commit 6c74fb7

Please sign in to comment.