Commit 591c3e99 authored by Carola Nitz's avatar Carola Nitz

GDrive:show thumbnails for files where possible

parent eba80444
......@@ -12,6 +12,11 @@
*****************************************************************************/
#import "VLCCloudStorageTableViewCell.h"
@interface VLCCloudStorageTableViewCell ()
{
NSURL *_iconURL;
}
@end
@implementation VLCCloudStorageTableViewCell
......@@ -80,7 +85,10 @@
self.titleLabel.hidden = self.subtitleLabel.hidden = NO;
self.folderTitleLabel.hidden = YES;
}
if (_driveFile.thumbnailLink != nil) {
_iconURL = [NSURL URLWithString:_driveFile.thumbnailLink];
[self performSelectorInBackground:@selector(_updateIconFromURL) withObject:@""];
}
NSString *iconName = self.driveFile.iconLink;
if ([iconName isEqualToString:@"https://ssl.gstatic.com/docs/doclist/images/icon_11_shared_collection_list.png"] || [iconName isEqualToString:@"https://ssl.gstatic.com/docs/doclist/images/icon_11_collection_list.png"]) {
self.thumbnailView.image = [UIImage imageNamed:@"folder"];
......@@ -97,6 +105,13 @@
[self setNeedsDisplay];
}
- (void)_updateIconFromURL
{
NSData* imageData = [[NSData alloc]initWithContentsOfURL:_iconURL];
UIImage* image = [[UIImage alloc] initWithData:imageData];
self.thumbnailView.image = image;
}
- (IBAction)triggerDownload:(id)sender
{
if ([self.delegate respondsToSelector:@selector(triggerDownloadForCell:)])
......
......@@ -121,7 +121,7 @@
GTLQueryDrive *query;
query = [GTLQueryDrive queryForFilesList];
query.fields = @"items(originalFilename,title,mimeType,fileExtension,fileSize,iconLink,downloadUrl,webContentLink),nextPageToken";
query.fields = @"items(originalFilename,title,mimeType,fileExtension,fileSize,iconLink,downloadUrl,webContentLink,thumbnailLink),nextPageToken";
query.pageToken = _nextPageToken;
query.maxResults = 100;
......
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