cxfeng1 closed pull request #1556: [iOS] Pass pageURL to external image loader.
URL: https://github.com/apache/incubator-weex/pull/1556
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/Component/WXImageComponent.m
b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
index f80a5408d2..69f44e5fc6 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
@@ -395,7 +395,7 @@ - (void)updateImage
}
newURL = [[self imageSrc] copy];
WX_REWRITE_URL([self imageSrc], WXResourceTypeImage, self.weexInstance)
- NSDictionary *userInfo = @{@"imageQuality":@(self.imageQuality),
@"imageSharp":@(self.imageSharp),
@"blurRadius":@(self.blurRadius),@"instanceId":[self _safeInstanceId]};
+ NSDictionary *userInfo = @{@"imageQuality":@(self.imageQuality),
@"imageSharp":@(self.imageSharp), @"blurRadius":@(self.blurRadius),
@"instanceId":[self _safeInstanceId], @"pageURL": self.weexInstance.scriptURL
?: @""};
[[self imageLoader] setImageViewWithURL:(UIImageView*)self.view
url:[NSURL URLWithString:newURL] placeholderImage:nil options:userInfo
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
// progress when loading image
} completed:^(UIImage *image, NSError *error, WXImageLoaderCacheType
cacheType, NSURL *imageURL) {
@@ -413,8 +413,12 @@ - (void)updateImage
if (strongSelf.placeholdSrc) {
NSString *newURL = [strongSelf.placeholdSrc copy];
WX_REWRITE_URL([strongSelf placeholdSrc],
WXResourceTypeImage, strongSelf.weexInstance)
- [[strongSelf imageLoader]
setImageViewWithURL:(UIImageView*)strongSelf.view url:[NSURL
-
URLWithString:newURL] placeholderImage:nil
options:@{@"instanceId":[strongSelf _safeInstanceId]} progress:nil
completed:nil];
+ [[strongSelf imageLoader]
setImageViewWithURL:(UIImageView*)strongSelf.view
+ url:[NSURL
URLWithString:newURL]
+ placeholderImage:nil
+
options:@{@"instanceId":[strongSelf _safeInstanceId], @"pageURL":
strongSelf.weexInstance.scriptURL ?: @""}
+ progress:nil
+ completed:nil];
return;
}
}
@@ -496,7 +500,7 @@ - (void)updatePlaceHolderWithFailedBlock:(void(^)(NSString
*, NSError *))downloa
__weak typeof(self) weakSelf = self;
self.placeholderOperation = [[self imageLoader]
downloadImageWithURL:newURL imageFrame:self.calculatedFrame
- userInfo:@{@"instanceId":[self
_safeInstanceId]}
+ userInfo:@{@"instanceId":[self
_safeInstanceId], @"pageURL": self.weexInstance.scriptURL ?: @""}
completed:^(UIImage *image, NSError
*error, BOOL finished)
{
dispatch_async(dispatch_get_main_queue(), ^{
@@ -535,7 +539,7 @@ - (void)updateContentImageWithFailedBlock:(void(^)(NSString
*, NSError *))downlo
}
WXLogDebug(@"Updating image:%@, component:%@", self.imageSrc, self.ref);
- NSDictionary *userInfo = @{@"imageQuality":@(self.imageQuality),
@"imageSharp":@(self.imageSharp),
@"blurRadius":@(self.blurRadius),@"instanceId":[self _safeInstanceId]};
+ NSDictionary *userInfo = @{@"imageQuality":@(self.imageQuality),
@"imageSharp":@(self.imageSharp), @"blurRadius":@(self.blurRadius),
@"instanceId":[self _safeInstanceId], @"pageURL": self.weexInstance.scriptURL
?: @""};
NSString * newURL = [imageSrc copy];
WX_REWRITE_URL(imageSrc, WXResourceTypeImage, self.weexInstance)
__weak typeof(self) weakSelf = self;
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services