[
https://issues.apache.org/jira/browse/WEEX-561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16582176#comment-16582176
]
ASF GitHub Bot commented on WEEX-561:
-------------------------------------
cxfeng1 closed pull request #1423: [WEEX-561][iOS] performance : fix dic value
is nil
URL: https://github.com/apache/incubator-weex/pull/1423
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 ef28440a45..1beb2cb285 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
@@ -373,12 +373,12 @@ - (void)updateImage
if (self.placeholdSrc) {
newURL = [self.placeholdSrc copy];
WX_REWRITE_URL([self placeholdSrc], WXResourceTypeImage,
self.weexInstance)
- NSDictionary* extInfo =
@{@"instanceId":self.weexInstance.instanceId};
+ NSDictionary* extInfo = @{@"instanceId":[self _safeInstanceId]};
[[self imageLoader] setImageViewWithURL:(UIImageView*)self.view
url:[NSURL URLWithString:newURL] placeholderImage:nil options:extInfo
progress:nil completed:nil];
}
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.weexInstance.instanceId};
+ NSDictionary *userInfo = @{@"imageQuality":@(self.imageQuality),
@"imageSharp":@(self.imageSharp),
@"blurRadius":@(self.blurRadius),@"instanceId":[self _safeInstanceId]};
[[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) {
@@ -396,7 +396,8 @@ - (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.weexInstance.instanceId} progress:nil
completed:nil];
+ [[strongSelf imageLoader]
setImageViewWithURL:(UIImageView*)strongSelf.view url:[NSURL
+
URLWithString:newURL] placeholderImage:nil
options:@{@"instanceId":[strongSelf _safeInstanceId]} progress:nil
completed:nil];
return;
}
}
@@ -468,7 +469,7 @@ - (void)updatePlaceHolderWithFailedBlock:(void(^)(NSString
*, NSError *))downloa
__weak typeof(self) weakSelf = self;
self.placeholderOperation = [[self imageLoader]
downloadImageWithURL:newURL imageFrame:self.calculatedFrame
-
userInfo:@{@"instanceId":self.weexInstance.instanceId}
+ userInfo:@{@"instanceId":[self
_safeInstanceId]}
completed:^(UIImage *image, NSError
*error, BOOL finished)
{
dispatch_async(dispatch_get_main_queue(), ^{
@@ -507,7 +508,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.weexInstance.instanceId};
+ NSDictionary *userInfo = @{@"imageQuality":@(self.imageQuality),
@"imageSharp":@(self.imageSharp),
@"blurRadius":@(self.blurRadius),@"instanceId":[self _safeInstanceId]};
NSString * newURL = [imageSrc copy];
WX_REWRITE_URL(imageSrc, WXResourceTypeImage, self.weexInstance)
__weak typeof(self) weakSelf = self;
@@ -550,6 +551,11 @@ -
(void)updateContentImageWithFailedBlock:(void(^)(NSString *, NSError *))downlo
}];
}
+- (NSString*) _safeInstanceId
+{
+ return self.weexInstance.instanceId ? : @"unknown";
+}
+
- (void)readyToRender
{
// when image download completely (success or failed)
----------------------------------------------------------------
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]
> [iOS]performance , fix dic value is nil
> ---------------------------------------
>
> Key: WEEX-561
> URL: https://issues.apache.org/jira/browse/WEEX-561
> Project: Weex
> Issue Type: Bug
> Components: iOS
> Reporter: peihan
> Assignee: XuYouyang
> Priority: Major
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)