Fix a race condition observed when the app renders an image in a Group/Community description

This commit is contained in:
Giom Foret
2018-11-13 17:30:37 +01:00
parent f7b91f4421
commit 2b6fb87f7e
@@ -516,8 +516,6 @@
// Check whether the provided URL is a valid Matrix Content URI.
if (cacheFilePath)
{
localSourcePath = [NSString stringWithFormat:@"file://%@", cacheFilePath];
// Download the thumbnail if it is not already stored in the cache.
if (![[NSFileManager defaultManager] fileExistsAtPath:cacheFilePath])
{
@@ -529,10 +527,15 @@
withMethod:MXThumbnailingMethodScale
success:^(NSString *outputFilePath) {
MXStrongifyAndReturnIfNil(self);
[self renderGroupLongDescription];
[self refreshGroupLongDescription];
}
failure:nil];
}
else
{
// Update the local path
localSourcePath = [NSString stringWithFormat:@"file://%@", cacheFilePath];
}
}
}
else
@@ -545,8 +548,6 @@
// Check whether the provided URL is a valid Matrix Content URI.
if (cacheFilePath)
{
localSourcePath = [NSString stringWithFormat:@"file://%@", cacheFilePath];
// Download the image if it is not already stored in the cache.
if (![[NSFileManager defaultManager] fileExistsAtPath:cacheFilePath])
{
@@ -556,10 +557,15 @@
inFolder:kMXMediaManagerDefaultCacheFolder
success:^(NSString *outputFilePath) {
MXStrongifyAndReturnIfNil(self);
[self renderGroupLongDescription];
[self refreshGroupLongDescription];
}
failure:nil];
}
else
{
// Update the local path
localSourcePath = [NSString stringWithFormat:@"file://%@", cacheFilePath];
}
}
}
return localSourcePath;