Commit 86041442 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

cloud storage: don't update table view cell contents from a background thread

parent d9ef36ef
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
if (dropboxFile != _dropboxFile) if (dropboxFile != _dropboxFile)
_dropboxFile = dropboxFile; _dropboxFile = dropboxFile;
[self _updatedDisplayedInformation]; [self performSelectorOnMainThread:@selector(_updatedDisplayedInformation)
withObject:nil waitUntilDone:NO];
} }
- (void)setDriveFile:(GTLDriveFile *)driveFile - (void)setDriveFile:(GTLDriveFile *)driveFile
...@@ -43,7 +44,8 @@ ...@@ -43,7 +44,8 @@
if (driveFile != _driveFile) if (driveFile != _driveFile)
_driveFile = driveFile; _driveFile = driveFile;
[self _updatedDisplayedInformation]; [self performSelectorOnMainThread:@selector(_updatedDisplayedInformation)
withObject:nil waitUntilDone:NO];
} }
- (void)setBoxFile:(BoxItem *)boxFile - (void)setBoxFile:(BoxItem *)boxFile
...@@ -51,7 +53,8 @@ ...@@ -51,7 +53,8 @@
if (boxFile != _boxFile) if (boxFile != _boxFile)
_boxFile = boxFile; _boxFile = boxFile;
[self _updatedDisplayedInformation]; [self performSelectorOnMainThread:@selector(_updatedDisplayedInformation)
withObject:nil waitUntilDone:NO];
} }
- (void)setOneDriveFile:(VLCOneDriveObject *)oneDriveFile - (void)setOneDriveFile:(VLCOneDriveObject *)oneDriveFile
...@@ -59,7 +62,8 @@ ...@@ -59,7 +62,8 @@
if (oneDriveFile != _oneDriveFile) if (oneDriveFile != _oneDriveFile)
_oneDriveFile = oneDriveFile; _oneDriveFile = oneDriveFile;
[self _updatedDisplayedInformation]; [self performSelectorOnMainThread:@selector(_updatedDisplayedInformation)
withObject:nil waitUntilDone:NO];
} }
- (void)_updatedDisplayedInformation - (void)_updatedDisplayedInformation
...@@ -191,13 +195,18 @@ ...@@ -191,13 +195,18 @@
- (void)_updateIconFromURL - (void)_updateIconFromURL
{ {
NSData *imageData = [[NSData alloc] initWithContentsOfURL:_iconURL]; NSData *imageData = [[NSData alloc] initWithContentsOfURL:_iconURL];
UIImage *image = [[UIImage alloc] initWithData:imageData]; UIImage *icon = [[UIImage alloc] initWithData:imageData];
if (image != nil) { if (icon != nil) {
self.thumbnailView.contentMode = UIViewContentModeScaleAspectFit; [self performSelectorOnMainThread:@selector(_updateIconOnMainThread:) withObject:icon waitUntilDone:NO];
self.thumbnailView.image = image;
} }
} }
- (void)_updateIconOnMainThread:(UIImage *)icon
{
self.thumbnailView.contentMode = UIViewContentModeScaleAspectFit;
self.thumbnailView.image = icon;
}
- (IBAction)triggerDownload:(id)sender - (IBAction)triggerDownload:(id)sender
{ {
if ([self.delegate respondsToSelector:@selector(triggerDownloadForCell:)]) if ([self.delegate respondsToSelector:@selector(triggerDownloadForCell:)])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment