{"action":"created","comment":{"url":"https://api.github.com/repos/owncloud/ios/pulls/comments/65882603","id":65882603,"diff_hunk":"@@ -7,84 +7,105 @@\n \n #import \"ELCAssetCell.h\"\n #import \"ELCAsset.h\"\n+#import \"ELCConsole.h\"\n+#import \"ELCOverlayImageView.h\"\n+#import \"ELCConstants.h\"\n+#import <Photos/Photos.h>\n \n @interface ELCAssetCell ()\n \n-@property (nonatomic, retain) NSArray *rowAssets;\n-@property (nonatomic, retain) NSMutableArray *imageViewArray;\n-@property (nonatomic, retain) NSMutableArray *overlayViewArray;\n+@property (nonatomic, strong) NSArray *rowAssets;\n+@property (nonatomic, strong) NSMutableArray *imageViewArray;\n+@property (nonatomic, strong) NSMutableArray *overlayViewArray;\n+@property (strong) PHCachingImageManager *imageManager;\n \n @end\n \n @implementation ELCAssetCell\n \n-@synthesize rowAssets = _rowAssets;\n+//Using auto synthesizers\n \n-- (id)initWithAssets:(NSArray *)assets reuseIdentifier:(NSString *)identifier\n+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier\n {\n-    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];\n-\tif(self) {\n+    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];\n+\tif (self) {\n         UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cellTapped:)];\n         [self addGestureRecognizer:tapRecognizer];\n-        [tapRecognizer release];\n         \n         NSMutableArray *mutableArray = [[NSMutableArray alloc] initWithCapacity:4];\n         self.imageViewArray = mutableArray;\n-        [mutableArray release];\n         \n         NSMutableArray *overlayArray = [[NSMutableArray alloc] initWithCapacity:4];\n         self.overlayViewArray = overlayArray;\n-        [overlayArray release];\n-\n-        [self setAssets:assets];\n+        \n+        self.alignmentLeft = YES;\n+        self.imageManager = [[PHCachingImageManager alloc] init];\n \t}\n \treturn self;\n }\n \n - (void)setAssets:(NSArray *)assets\n {\n     self.rowAssets = assets;\n-\tfor (UIView *view in [self subviews]) {\n-        if ([view isKindOfClass:UIImageView.class]) {\n-            [view removeFromSuperview];\n-        }\n+\tfor (UIImageView *view in _imageViewArray) {\n+        [view removeFromSuperview];\n+\t}\n+    for (ELCOverlayImageView *view in _overlayViewArray) {\n+        [view removeFromSuperview];\n \t}\n-    \n     //set up a pointer here so we don't keep calling [UIImage imageNamed:] if creating overlays\n+    \n+    \n     UIImage *overlayImage = nil;\n     for (int i = 0; i < [_rowAssets count]; ++i) {\n-\n+        \n         ELCAsset *asset = [_rowAssets objectAtIndex:i];\n         \n+        PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];\n+        \n+        // Download from cloud if necessary\n+        // Need to make NO for existing images.\n+        options.networkAccessAllowed = YES;\n+        options.progressHandler = ^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {\n+            \n+        };\n+        \n         if (i < [_imageViewArray count]) {\n             UIImageView *imageView = [_imageViewArray objectAtIndex:i];\n-            imageView.image = [UIImage imageWithCGImage:asset.asset.thumbnail];\n+            PHAsset *phAsset = (PHAsset *)asset.asset;\n+            [self.imageManager requestImageForAsset:phAsset targetSize:CGSizeMake(70, 70) contentMode:PHImageContentModeAspectFill options:options resultHandler:^(UIImage * result, NSDictionary * info) {\n+                imageView.image = result;\n+            }];\n+            \n         } else {\n-            UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithCGImage:asset.asset.thumbnail]];\n+            UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 70, 70)];\n+            PHAsset *phAsset = (PHAsset *)asset.asset;\n+            [self.imageManager requestImageForAsset:phAsset targetSize:CGSizeMake(70, 70) contentMode:PHImageContentModeAspectFill options:options resultHandler:^(UIImage * result, NSDictionary * info) {","path":"Owncloud iOs Client/ExternalLibreries/ELCPickerLib/ELCAssetCell.m","position":97,"original_position":97,"commit_id":"9c5e866b966dfce510188d6fdf7657e006e6125d","original_commit_id":"9c5e866b966dfce510188d6fdf7657e006e6125d","user":{"login":"mRoRo","id":15103194,"avatar_url":"https://avatars.githubusercontent.com/u/15103194?v=3","gravatar_id":"","url":"https://api.github.com/users/mRoRo","html_url":"https://github.com/mRoRo","followers_url":"https://api.github.com/users/mRoRo/followers","following_url":"https://api.github.com/users/mRoRo/following{/other_user}","gists_url":"https://api.github.com/users/mRoRo/gists{/gist_id}","starred_url":"https://api.github.com/users/mRoRo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mRoRo/subscriptions","organizations_url":"https://api.github.com/users/mRoRo/orgs","repos_url":"https://api.github.com/users/mRoRo/repos","events_url":"https://api.github.com/users/mRoRo/events{/privacy}","received_events_url":"https://api.github.com/users/mRoRo/received_events","type":"User","site_admin":false},"body":"This code is also in the else structure.\r\n\r\n [self.imageManager requestImageForAsset:phAsset targetSize:CGSizeMake(70, 70) contentMode:PHImageContentModeAspectFill options:options resultHandler:^(UIImage * result, NSDictionary * info) {                imageView.image = result;\r\n            }];","created_at":"2016-06-06T12:40:31Z","updated_at":"2016-06-06T12:40:31Z","html_url":"https://github.com/owncloud/ios/pull/679#discussion_r65882603","pull_request_url":"https://api.github.com/repos/owncloud/ios/pulls/679","_links":{"self":{"href":"https://api.github.com/repos/owncloud/ios/pulls/comments/65882603"},"html":{"href":"https://github.com/owncloud/ios/pull/679#discussion_r65882603"},"pull_request":{"href":"https://api.github.com/repos/owncloud/ios/pulls/679"}}},"pull_request":{"url":"https://api.github.com/repos/owncloud/ios/pulls/679","id":71884510,"html_url":"https://github.com/owncloud/ios/pull/679","diff_url":"https://github.com/owncloud/ios/pull/679.diff","patch_url":"https://github.com/owncloud/ios/pull/679.patch","issue_url":"https://api.github.com/repos/owncloud/ios/issues/679","number":679,"state":"open","locked":false,"title":"Use photo framework instead assets library","user":{"login":"nasli","id":6570505,"avatar_url":"https://avatars.githubusercontent.com/u/6570505?v=3","gravatar_id":"","url":"https://api.github.com/users/nasli","html_url":"https://github.com/nasli","followers_url":"https://api.github.com/users/nasli/followers","following_url":"https://api.github.com/users/nasli/following{/other_user}","gists_url":"https://api.github.com/users/nasli/gists{/gist_id}","starred_url":"https://api.github.com/users/nasli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nasli/subscriptions","organizations_url":"https://api.github.com/users/nasli/orgs","repos_url":"https://api.github.com/users/nasli/repos","events_url":"https://api.github.com/users/nasli/events{/privacy}","received_events_url":"https://api.github.com/users/nasli/received_events","type":"User","site_admin":false},"body":"This closes #667 ","created_at":"2016-05-30T10:45:32Z","updated_at":"2016-06-06T12:40:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d953b444de8c337e42c8d49f2afe67c3d11e8ba8","assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/ios/milestones/11","html_url":"https://github.com/owncloud/ios/milestones/3.5.0-current","labels_url":"https://api.github.com/repos/owncloud/ios/milestones/11/labels","id":1751236,"number":11,"title":"3.5.0-current","description":"","creator":{"login":"rperezb","id":1846927,"avatar_url":"https://avatars.githubusercontent.com/u/1846927?v=3","gravatar_id":"","url":"https://api.github.com/users/rperezb","html_url":"https://github.com/rperezb","followers_url":"https://api.github.com/users/rperezb/followers","following_url":"https://api.github.com/users/rperezb/following{/other_user}","gists_url":"https://api.github.com/users/rperezb/gists{/gist_id}","starred_url":"https://api.github.com/users/rperezb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rperezb/subscriptions","organizations_url":"https://api.github.com/users/rperezb/orgs","repos_url":"https://api.github.com/users/rperezb/repos","events_url":"https://api.github.com/users/rperezb/events{/privacy}","received_events_url":"https://api.github.com/users/rperezb/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":14,"state":"open","created_at":"2016-05-06T10:09:11Z","updated_at":"2016-06-05T08:02:45Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/owncloud/ios/pulls/679/commits","review_comments_url":"https://api.github.com/repos/owncloud/ios/pulls/679/comments","review_comment_url":"https://api.github.com/repos/owncloud/ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/owncloud/ios/issues/679/comments","statuses_url":"https://api.github.com/repos/owncloud/ios/statuses/9c5e866b966dfce510188d6fdf7657e006e6125d","head":{"label":"owncloud:use_photo_framework_insetad_assets_library","ref":"use_photo_framework_insetad_assets_library","sha":"9c5e866b966dfce510188d6fdf7657e006e6125d","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":6402099,"name":"ios","full_name":"owncloud/ios","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/ios","description":":iphone: iOS app for ownCloud","fork":false,"url":"https://api.github.com/repos/owncloud/ios","forks_url":"https://api.github.com/repos/owncloud/ios/forks","keys_url":"https://api.github.com/repos/owncloud/ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/ios/teams","hooks_url":"https://api.github.com/repos/owncloud/ios/hooks","issue_events_url":"https://api.github.com/repos/owncloud/ios/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/ios/events","assignees_url":"https://api.github.com/repos/owncloud/ios/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/ios/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/ios/tags","blobs_url":"https://api.github.com/repos/owncloud/ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/ios/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/ios/languages","stargazers_url":"https://api.github.com/repos/owncloud/ios/stargazers","contributors_url":"https://api.github.com/repos/owncloud/ios/contributors","subscribers_url":"https://api.github.com/repos/owncloud/ios/subscribers","subscription_url":"https://api.github.com/repos/owncloud/ios/subscription","commits_url":"https://api.github.com/repos/owncloud/ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/ios/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/ios/merges","archive_url":"https://api.github.com/repos/owncloud/ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/ios/downloads","issues_url":"https://api.github.com/repos/owncloud/ios/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/ios/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/ios/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/ios/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/ios/releases{/id}","deployments_url":"https://api.github.com/repos/owncloud/ios/deployments","created_at":"2012-10-26T10:25:42Z","updated_at":"2016-06-05T05:12:38Z","pushed_at":"2016-06-06T12:38:56Z","git_url":"git://github.com/owncloud/ios.git","ssh_url":"git@github.com:owncloud/ios.git","clone_url":"https://github.com/owncloud/ios.git","svn_url":"https://github.com/owncloud/ios","homepage":"https://itunes.apple.com/app/owncloud/id543672169","size":76754,"stargazers_count":230,"watchers_count":230,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":386,"mirror_url":null,"open_issues_count":150,"forks":386,"open_issues":150,"watchers":230,"default_branch":"master"}},"base":{"label":"owncloud:master","ref":"master","sha":"55ccffca0fb829f79222c32628e7a7ccd839586d","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":6402099,"name":"ios","full_name":"owncloud/ios","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/ios","description":":iphone: iOS app for ownCloud","fork":false,"url":"https://api.github.com/repos/owncloud/ios","forks_url":"https://api.github.com/repos/owncloud/ios/forks","keys_url":"https://api.github.com/repos/owncloud/ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/ios/teams","hooks_url":"https://api.github.com/repos/owncloud/ios/hooks","issue_events_url":"https://api.github.com/repos/owncloud/ios/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/ios/events","assignees_url":"https://api.github.com/repos/owncloud/ios/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/ios/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/ios/tags","blobs_url":"https://api.github.com/repos/owncloud/ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/ios/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/ios/languages","stargazers_url":"https://api.github.com/repos/owncloud/ios/stargazers","contributors_url":"https://api.github.com/repos/owncloud/ios/contributors","subscribers_url":"https://api.github.com/repos/owncloud/ios/subscribers","subscription_url":"https://api.github.com/repos/owncloud/ios/subscription","commits_url":"https://api.github.com/repos/owncloud/ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/ios/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/ios/merges","archive_url":"https://api.github.com/repos/owncloud/ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/ios/downloads","issues_url":"https://api.github.com/repos/owncloud/ios/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/ios/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/ios/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/ios/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/ios/releases{/id}","deployments_url":"https://api.github.com/repos/owncloud/ios/deployments","created_at":"2012-10-26T10:25:42Z","updated_at":"2016-06-05T05:12:38Z","pushed_at":"2016-06-06T12:38:56Z","git_url":"git://github.com/owncloud/ios.git","ssh_url":"git@github.com:owncloud/ios.git","clone_url":"https://github.com/owncloud/ios.git","svn_url":"https://github.com/owncloud/ios","homepage":"https://itunes.apple.com/app/owncloud/id543672169","size":76754,"stargazers_count":230,"watchers_count":230,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":386,"mirror_url":null,"open_issues_count":150,"forks":386,"open_issues":150,"watchers":230,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/owncloud/ios/pulls/679"},"html":{"href":"https://github.com/owncloud/ios/pull/679"},"issue":{"href":"https://api.github.com/repos/owncloud/ios/issues/679"},"comments":{"href":"https://api.github.com/repos/owncloud/ios/issues/679/comments"},"review_comments":{"href":"https://api.github.com/repos/owncloud/ios/pulls/679/comments"},"review_comment":{"href":"https://api.github.com/repos/owncloud/ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/owncloud/ios/pulls/679/commits"},"statuses":{"href":"https://api.github.com/repos/owncloud/ios/statuses/9c5e866b966dfce510188d6fdf7657e006e6125d"}}}}
{"actor":{"display_login":"mRoRo"}}