{"action":"created","comment":{"url":"https://api.github.com/repos/textileio/textile-mobile/pulls/comments/218493767","pull_request_review_id":156444495,"id":218493767,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODQ5Mzc2Nw==","diff_hunk":"@@ -85,25 +85,31 @@ - (dispatch_queue_t)methodQueue {\n       PHFetchResult *allPhotosResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:onlyImagesOptions];\n       [allPhotosResult enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL *stop) {\n \n-        // Get our path right away while we are in Obj-c\n-        [asset requestContentEditingInputWithOptions:nil completionHandler:^(PHContentEditingInput * _Nullable contentEditingInput, NSDictionary * _Nonnull info) {\n-\n-          // get rid of file://\n-          NSString *uri = contentEditingInput.fullSizeImageURL.absoluteString;\n-          NSString *path = [uri substringFromIndex:7];\n-          NSNumber *orientation = contentEditingInput.fullSizeImageOrientation ? [NSNumber numberWithInt:contentEditingInput.fullSizeImageOrientation] : [NSNumber numberWithInt:1];\n-          NSFileManager *fileManager = [NSFileManager defaultManager];\n-          BOOL isExist = [fileManager fileExistsAtPath:path];\n-          if (isExist) {\n+        // Get the image data for copying\n+        [[PHImageManager defaultManager] requestImageDataForAsset:asset options:nil resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation imageOrientation, NSDictionary * _Nullable info) {\n+\n+          if (imageData) {\n+            // Get the original filename to keep it straight on the system.\n+            // Alternatively could probably just use timestamp, but this doesn't seem to have any lag\n+            NSArray *resources = [PHAssetResource assetResourcesForAsset:asset];\n+            NSString *orgFilename = ((PHAssetResource*)resources[0]).originalFilename;\n+\n+            // Get our path in the tmp directory\n+            NSString *path = [[NSTemporaryDirectory()stringByStandardizingPath] stringByAppendingPathComponent:orgFilename];\n+\n+            // Write the data to the temp file\n+            [imageData writeToFile:path atomically:YES];\n+\n             // creationDate is also available, but seems to be pure exif date\n             NSDate *newDate = asset.modificationDate;\n             NSDate *creationDate = asset.creationDate;\n             // dataWithJSONObject cannot include NSDate\n             NSString *dateString = [dateFormatter stringFromDate:newDate];\n             NSString *creationDateString = [dateFormatter stringFromDate:creationDate];\n+            // get an int\n+            NSNumber *orientation = imageOrientation ? [NSNumber numberWithInt:imageOrientation] : [NSNumber numberWithInt:1];\n \n-            // Create an event paylod\n-            NSDictionary *payload = @{ @\"uri\": uri, @\"path\": path, @\"modificationDate\": dateString, @\"creationDate\": creationDateString, @\"assetId\": asset.localIdentifier, @\"orientation\": orientation};\n+            NSDictionary *payload = @{ @\"uri\": path, @\"path\": path, @\"modificationDate\": dateString, @\"creationDate\": creationDateString, @\"assetId\": asset.localIdentifier, @\"orientation\": orientation, @\"canDelete\": @true};","path":"ios/NativeModules/TextileNode.m","position":40,"original_position":40,"commit_id":"ca2c4360a9e1f2fe3727de86a843177adf0ce43c","original_commit_id":"ca2c4360a9e1f2fe3727de86a843177adf0ce43c","user":{"login":"andrewxhill","id":370259,"node_id":"MDQ6VXNlcjM3MDI1OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/370259?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewxhill","html_url":"https://github.com/andrewxhill","followers_url":"https://api.github.com/users/andrewxhill/followers","following_url":"https://api.github.com/users/andrewxhill/following{/other_user}","gists_url":"https://api.github.com/users/andrewxhill/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewxhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewxhill/subscriptions","organizations_url":"https://api.github.com/users/andrewxhill/orgs","repos_url":"https://api.github.com/users/andrewxhill/repos","events_url":"https://api.github.com/users/andrewxhill/events{/privacy}","received_events_url":"https://api.github.com/users/andrewxhill/received_events","type":"User","site_admin":false},"body":"for sure... here you go https://github.com/textileio/textile-mobile/pull/535","created_at":"2018-09-18T15:59:54Z","updated_at":"2018-09-18T15:59:54Z","html_url":"https://github.com/textileio/textile-mobile/pull/528#discussion_r218493767","pull_request_url":"https://api.github.com/repos/textileio/textile-mobile/pulls/528","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/textileio/textile-mobile/pulls/comments/218493767"},"html":{"href":"https://github.com/textileio/textile-mobile/pull/528#discussion_r218493767"},"pull_request":{"href":"https://api.github.com/repos/textileio/textile-mobile/pulls/528"}},"in_reply_to_id":218473003},"pull_request":{"url":"https://api.github.com/repos/textileio/textile-mobile/pulls/528","id":215736241,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NzM2MjQx","html_url":"https://github.com/textileio/textile-mobile/pull/528","diff_url":"https://github.com/textileio/textile-mobile/pull/528.diff","patch_url":"https://github.com/textileio/textile-mobile/pull/528.patch","issue_url":"https://api.github.com/repos/textileio/textile-mobile/issues/528","number":528,"state":"closed","locked":false,"title":"Sync photo roll","user":{"login":"andrewxhill","id":370259,"node_id":"MDQ6VXNlcjM3MDI1OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/370259?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewxhill","html_url":"https://github.com/andrewxhill","followers_url":"https://api.github.com/users/andrewxhill/followers","following_url":"https://api.github.com/users/andrewxhill/following{/other_user}","gists_url":"https://api.github.com/users/andrewxhill/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewxhill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewxhill/subscriptions","organizations_url":"https://api.github.com/users/andrewxhill/orgs","repos_url":"https://api.github.com/users/andrewxhill/repos","events_url":"https://api.github.com/users/andrewxhill/events{/privacy}","received_events_url":"https://api.github.com/users/andrewxhill/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-15T00:00:37Z","updated_at":"2018-09-18T15:59:54Z","closed_at":"2018-09-17T19:45:05Z","merged_at":"2018-09-17T19:45:05Z","merge_commit_sha":"e17d9626cd233e97c4a0e39b233c81d90e4bb285","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1054851044,"node_id":"MDU6TGFiZWwxMDU0ODUxMDQ0","url":"https://api.github.com/repos/textileio/textile-mobile/labels/in%20progress","name":"in progress","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/textileio/textile-mobile/pulls/528/commits","review_comments_url":"https://api.github.com/repos/textileio/textile-mobile/pulls/528/comments","review_comment_url":"https://api.github.com/repos/textileio/textile-mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/textileio/textile-mobile/issues/528/comments","statuses_url":"https://api.github.com/repos/textileio/textile-mobile/statuses/ca2c4360a9e1f2fe3727de86a843177adf0ce43c","head":{"label":"textileio:andrew/photo-roll","ref":"andrew/photo-roll","sha":"ca2c4360a9e1f2fe3727de86a843177adf0ce43c","user":{"login":"textileio","id":35050041,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MDUwMDQx","avatar_url":"https://avatars3.githubusercontent.com/u/35050041?v=4","gravatar_id":"","url":"https://api.github.com/users/textileio","html_url":"https://github.com/textileio","followers_url":"https://api.github.com/users/textileio/followers","following_url":"https://api.github.com/users/textileio/following{/other_user}","gists_url":"https://api.github.com/users/textileio/gists{/gist_id}","starred_url":"https://api.github.com/users/textileio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/textileio/subscriptions","organizations_url":"https://api.github.com/users/textileio/orgs","repos_url":"https://api.github.com/users/textileio/repos","events_url":"https://api.github.com/users/textileio/events{/privacy}","received_events_url":"https://api.github.com/users/textileio/received_events","type":"Organization","site_admin":false},"repo":{"id":128835983,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg4MzU5ODM=","name":"textile-mobile","full_name":"textileio/textile-mobile","private":false,"owner":{"login":"textileio","id":35050041,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MDUwMDQx","avatar_url":"https://avatars3.githubusercontent.com/u/35050041?v=4","gravatar_id":"","url":"https://api.github.com/users/textileio","html_url":"https://github.com/textileio","followers_url":"https://api.github.com/users/textileio/followers","following_url":"https://api.github.com/users/textileio/following{/other_user}","gists_url":"https://api.github.com/users/textileio/gists{/gist_id}","starred_url":"https://api.github.com/users/textileio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/textileio/subscriptions","organizations_url":"https://api.github.com/users/textileio/orgs","repos_url":"https://api.github.com/users/textileio/repos","events_url":"https://api.github.com/users/textileio/events{/privacy}","received_events_url":"https://api.github.com/users/textileio/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/textileio/textile-mobile","description":"Encrypted, secure, decentralized personal data wallet -- technology behind textile.photos","fork":false,"url":"https://api.github.com/repos/textileio/textile-mobile","forks_url":"https://api.github.com/repos/textileio/textile-mobile/forks","keys_url":"https://api.github.com/repos/textileio/textile-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/textileio/textile-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/textileio/textile-mobile/teams","hooks_url":"https://api.github.com/repos/textileio/textile-mobile/hooks","issue_events_url":"https://api.github.com/repos/textileio/textile-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/textileio/textile-mobile/events","assignees_url":"https://api.github.com/repos/textileio/textile-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/textileio/textile-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/textileio/textile-mobile/tags","blobs_url":"https://api.github.com/repos/textileio/textile-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/textileio/textile-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/textileio/textile-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/textileio/textile-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/textileio/textile-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/textileio/textile-mobile/languages","stargazers_url":"https://api.github.com/repos/textileio/textile-mobile/stargazers","contributors_url":"https://api.github.com/repos/textileio/textile-mobile/contributors","subscribers_url":"https://api.github.com/repos/textileio/textile-mobile/subscribers","subscription_url":"https://api.github.com/repos/textileio/textile-mobile/subscription","commits_url":"https://api.github.com/repos/textileio/textile-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/textileio/textile-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/textileio/textile-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/textileio/textile-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/textileio/textile-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/textileio/textile-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/textileio/textile-mobile/merges","archive_url":"https://api.github.com/repos/textileio/textile-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/textileio/textile-mobile/downloads","issues_url":"https://api.github.com/repos/textileio/textile-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/textileio/textile-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/textileio/textile-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/textileio/textile-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/textileio/textile-mobile/labels{/name}","releases_url":"https://api.github.com/repos/textileio/textile-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/textileio/textile-mobile/deployments","created_at":"2018-04-09T21:28:41Z","updated_at":"2018-09-17T19:45:07Z","pushed_at":"2018-09-18T15:58:22Z","git_url":"git://github.com/textileio/textile-mobile.git","ssh_url":"git@github.com:textileio/textile-mobile.git","clone_url":"https://github.com/textileio/textile-mobile.git","svn_url":"https://github.com/textileio/textile-mobile","homepage":"https://www.textile.photos/","size":57700,"stargazers_count":82,"watchers_count":82,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":56,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":56,"watchers":82,"default_branch":"master"}},"base":{"label":"textileio:master","ref":"master","sha":"ef157269061f0472bdaecbe4e542ae774a00f8df","user":{"login":"textileio","id":35050041,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MDUwMDQx","avatar_url":"https://avatars3.githubusercontent.com/u/35050041?v=4","gravatar_id":"","url":"https://api.github.com/users/textileio","html_url":"https://github.com/textileio","followers_url":"https://api.github.com/users/textileio/followers","following_url":"https://api.github.com/users/textileio/following{/other_user}","gists_url":"https://api.github.com/users/textileio/gists{/gist_id}","starred_url":"https://api.github.com/users/textileio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/textileio/subscriptions","organizations_url":"https://api.github.com/users/textileio/orgs","repos_url":"https://api.github.com/users/textileio/repos","events_url":"https://api.github.com/users/textileio/events{/privacy}","received_events_url":"https://api.github.com/users/textileio/received_events","type":"Organization","site_admin":false},"repo":{"id":128835983,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg4MzU5ODM=","name":"textile-mobile","full_name":"textileio/textile-mobile","private":false,"owner":{"login":"textileio","id":35050041,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MDUwMDQx","avatar_url":"https://avatars3.githubusercontent.com/u/35050041?v=4","gravatar_id":"","url":"https://api.github.com/users/textileio","html_url":"https://github.com/textileio","followers_url":"https://api.github.com/users/textileio/followers","following_url":"https://api.github.com/users/textileio/following{/other_user}","gists_url":"https://api.github.com/users/textileio/gists{/gist_id}","starred_url":"https://api.github.com/users/textileio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/textileio/subscriptions","organizations_url":"https://api.github.com/users/textileio/orgs","repos_url":"https://api.github.com/users/textileio/repos","events_url":"https://api.github.com/users/textileio/events{/privacy}","received_events_url":"https://api.github.com/users/textileio/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/textileio/textile-mobile","description":"Encrypted, secure, decentralized personal data wallet -- technology behind textile.photos","fork":false,"url":"https://api.github.com/repos/textileio/textile-mobile","forks_url":"https://api.github.com/repos/textileio/textile-mobile/forks","keys_url":"https://api.github.com/repos/textileio/textile-mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/textileio/textile-mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/textileio/textile-mobile/teams","hooks_url":"https://api.github.com/repos/textileio/textile-mobile/hooks","issue_events_url":"https://api.github.com/repos/textileio/textile-mobile/issues/events{/number}","events_url":"https://api.github.com/repos/textileio/textile-mobile/events","assignees_url":"https://api.github.com/repos/textileio/textile-mobile/assignees{/user}","branches_url":"https://api.github.com/repos/textileio/textile-mobile/branches{/branch}","tags_url":"https://api.github.com/repos/textileio/textile-mobile/tags","blobs_url":"https://api.github.com/repos/textileio/textile-mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/textileio/textile-mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/textileio/textile-mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/textileio/textile-mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/textileio/textile-mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/textileio/textile-mobile/languages","stargazers_url":"https://api.github.com/repos/textileio/textile-mobile/stargazers","contributors_url":"https://api.github.com/repos/textileio/textile-mobile/contributors","subscribers_url":"https://api.github.com/repos/textileio/textile-mobile/subscribers","subscription_url":"https://api.github.com/repos/textileio/textile-mobile/subscription","commits_url":"https://api.github.com/repos/textileio/textile-mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/textileio/textile-mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/textileio/textile-mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/textileio/textile-mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/textileio/textile-mobile/contents/{+path}","compare_url":"https://api.github.com/repos/textileio/textile-mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/textileio/textile-mobile/merges","archive_url":"https://api.github.com/repos/textileio/textile-mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/textileio/textile-mobile/downloads","issues_url":"https://api.github.com/repos/textileio/textile-mobile/issues{/number}","pulls_url":"https://api.github.com/repos/textileio/textile-mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/textileio/textile-mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/textileio/textile-mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/textileio/textile-mobile/labels{/name}","releases_url":"https://api.github.com/repos/textileio/textile-mobile/releases{/id}","deployments_url":"https://api.github.com/repos/textileio/textile-mobile/deployments","created_at":"2018-04-09T21:28:41Z","updated_at":"2018-09-17T19:45:07Z","pushed_at":"2018-09-18T15:58:22Z","git_url":"git://github.com/textileio/textile-mobile.git","ssh_url":"git@github.com:textileio/textile-mobile.git","clone_url":"https://github.com/textileio/textile-mobile.git","svn_url":"https://github.com/textileio/textile-mobile","homepage":"https://www.textile.photos/","size":57700,"stargazers_count":82,"watchers_count":82,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":56,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":56,"watchers":82,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/textileio/textile-mobile/pulls/528"},"html":{"href":"https://github.com/textileio/textile-mobile/pull/528"},"issue":{"href":"https://api.github.com/repos/textileio/textile-mobile/issues/528"},"comments":{"href":"https://api.github.com/repos/textileio/textile-mobile/issues/528/comments"},"review_comments":{"href":"https://api.github.com/repos/textileio/textile-mobile/pulls/528/comments"},"review_comment":{"href":"https://api.github.com/repos/textileio/textile-mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/textileio/textile-mobile/pulls/528/commits"},"statuses":{"href":"https://api.github.com/repos/textileio/textile-mobile/statuses/ca2c4360a9e1f2fe3727de86a843177adf0ce43c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"andrewxhill"}}