{"action":"created","comment":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments/38024453","id":38024453,"diff_hunk":"@@ -242,53 +279,62 @@ define(function (require, exports) {\n             currentLayers = currentDocument.layers.selected,\n             currentLayer = currentLayers.first();\n \n-        if (!currentLibrary || currentLayers.size !== 1 ||\n+        if (!currentLibrary ||\n+            currentLayers.size !== 1 ||\n             !currentLayer || !currentLayer.isTextLayer()) {\n             return Promise.resolve();\n         }\n \n-        // FIXME: All constants like this should be described in one location for later\n-        var CHARACTERSTYLE_TYPE = \"application/vnd.adobe.element.characterstyle+dcx\",\n-            REPRESENTATION_TYPE = \"application/vnd.adobe.characterstyle+json\";\n-\n-        currentLibrary.beginOperation();\n-\n-        // FIXME: We should build this name correctly, instead of layer name\n-        var newElement = currentLibrary.createElement(currentLayer.name, CHARACTERSTYLE_TYPE),\n-            representation = newElement.createRepresentation(REPRESENTATION_TYPE, \"primary\"),\n-            imageRepresentation = newElement.createRepresentation(\"image/png\", \"rendition\"),\n-            typeData = fontStore.getTypeObjectFromLayer(currentLayer),\n-            // FIXME: Mac/Win temporary locations!\n-            filepath = \"/tmp/textThumbnailPreview.png\";\n-\n-        // Where magic happens\n-        representation.setValue(\"characterstyle\", \"data\", typeData);\n-\n-        // FIXME: Make sure this reflects the character style we're recreating\n-        // check to see how CEP Panel does it.\n-        var exportObj = libraryAdapter.createTextThumbnail(filepath,\n-            typeData.adbeFont.postScriptName,\n-            \"Aa\",\n-            36,\n-            colorAdapter.colorObject([0, 0, 0]));\n-\n-        return descriptor.playObject(exportObj)\n-            .bind(this)\n-            .then(function () {\n-                return Promise.fromNode(function (cb) {\n-                    imageRepresentation.updateContentFromPath(filepath, false, cb);\n-                });\n+        var typeData = fontStore.getTypeObjectFromLayer(currentLayer),\n+            tempPreviewPath;\n+        \n+        return _getTempPaths().bind(this)\n+            .then(function (paths) {\n+                // Create Character Style preview \n+                \n+                tempPreviewPath = paths.tempPreviewPath;\n+                \n+                // FIXME: Make sure this reflects the character style we're recreating\n+                // check to see how CEP Panel does it.\n+                var exportObj = libraryAdapter.createTextThumbnail(\n+                    tempPreviewPath,\n+                    typeData.adbeFont.postScriptName,\n+                    \"Aa\",\n+                    RENDITION_SIZE,\n+                    colorAdapter.colorObject([0, 0, 0])\n+                );\n+                \n+                return descriptor.playObject(exportObj);\n             })\n             .then(function () {\n-                // FIXME: Constant here\n-                newElement.setRenditionCache(104, filepath, function () {\n-                    // FIXME: In CEP Panel, they delete the temporary file afterwards\n-                });\n+                // Create new character style using the CC Libraries api. \n+                \n+                // FIXME: All constants like this should be described in one location for later","path":"src/js/actions/libraries.js","position":245,"original_position":245,"commit_id":"efe4520fcd4a0eb042572c582a4f54b4d9cbe14e","original_commit_id":"efe4520fcd4a0eb042572c582a4f54b4d9cbe14e","user":{"login":"volfied","id":386714,"avatar_url":"https://avatars.githubusercontent.com/u/386714?v=3","gravatar_id":"","url":"https://api.github.com/users/volfied","html_url":"https://github.com/volfied","followers_url":"https://api.github.com/users/volfied/followers","following_url":"https://api.github.com/users/volfied/following{/other_user}","gists_url":"https://api.github.com/users/volfied/gists{/gist_id}","starred_url":"https://api.github.com/users/volfied/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volfied/subscriptions","organizations_url":"https://api.github.com/users/volfied/orgs","repos_url":"https://api.github.com/users/volfied/repos","events_url":"https://api.github.com/users/volfied/events{/privacy}","received_events_url":"https://api.github.com/users/volfied/received_events","type":"User","site_admin":false},"body":"Another codecleanup issue for this one would be great.","created_at":"2015-08-26T19:30:54Z","updated_at":"2015-08-26T19:30:54Z","html_url":"https://github.com/adobe-photoshop/spaces-design/pull/2225#discussion_r38024453","pull_request_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2225","_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments/38024453"},"html":{"href":"https://github.com/adobe-photoshop/spaces-design/pull/2225#discussion_r38024453"},"pull_request":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2225"}}},"pull_request":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2225","id":43435464,"html_url":"https://github.com/adobe-photoshop/spaces-design/pull/2225","diff_url":"https://github.com/adobe-photoshop/spaces-design/pull/2225.diff","patch_url":"https://github.com/adobe-photoshop/spaces-design/pull/2225.patch","issue_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/2225","number":2225,"state":"open","locked":false,"title":"CC Libraries: improve asset previews and implement libraries sync status","user":{"login":"shaoshing","id":118264,"avatar_url":"https://avatars.githubusercontent.com/u/118264?v=3","gravatar_id":"","url":"https://api.github.com/users/shaoshing","html_url":"https://github.com/shaoshing","followers_url":"https://api.github.com/users/shaoshing/followers","following_url":"https://api.github.com/users/shaoshing/following{/other_user}","gists_url":"https://api.github.com/users/shaoshing/gists{/gist_id}","starred_url":"https://api.github.com/users/shaoshing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaoshing/subscriptions","organizations_url":"https://api.github.com/users/shaoshing/orgs","repos_url":"https://api.github.com/users/shaoshing/repos","events_url":"https://api.github.com/users/shaoshing/events{/privacy}","received_events_url":"https://api.github.com/users/shaoshing/received_events","type":"User","site_admin":false},"body":"This PR includes:\r\n\r\n##### asset preview\r\n\r\n* Improve the performance of new asset's preview image; it cuts the wait time of fetching remote image by using local preview file instead (related to #2011)\r\n* Show loader icon when downloading preview from remote server.\r\n* Double the rendition size to improve preview image quality for retina screen.\r\n\r\n##### sync status\r\n\r\nNow the libraries panel will respond to all sync events (change of library or asset, sign in / out in the Creative Cloud app) and update itself accordingly. \r\n\r\n##### Issues addressed by the new changes\r\n\r\n* #2124 \r\n* #2105 \r\n* #2163 \r\n* #2011  \r\n* #2219\r\n* #2199 \r\n","created_at":"2015-08-26T18:30:22Z","updated_at":"2015-08-26T19:30:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"514806d633d3285d692dad32e221145a17e21754","assignee":{"login":"volfied","id":386714,"avatar_url":"https://avatars.githubusercontent.com/u/386714?v=3","gravatar_id":"","url":"https://api.github.com/users/volfied","html_url":"https://github.com/volfied","followers_url":"https://api.github.com/users/volfied/followers","following_url":"https://api.github.com/users/volfied/following{/other_user}","gists_url":"https://api.github.com/users/volfied/gists{/gist_id}","starred_url":"https://api.github.com/users/volfied/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volfied/subscriptions","organizations_url":"https://api.github.com/users/volfied/orgs","repos_url":"https://api.github.com/users/volfied/repos","events_url":"https://api.github.com/users/volfied/events{/privacy}","received_events_url":"https://api.github.com/users/volfied/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2225/commits","review_comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2225/comments","review_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/2225/comments","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/efe4520fcd4a0eb042572c582a4f54b4d9cbe14e","head":{"label":"adobe-photoshop:shao/libraries-fixes","ref":"shao/libraries-fixes","sha":"efe4520fcd4a0eb042572c582a4f54b4d9cbe14e","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":37291353,"name":"spaces-design","full_name":"adobe-photoshop/spaces-design","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-design","description":"Adobe Photoshop Design Space","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-design","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/releases{/id}","created_at":"2015-06-11T23:23:47Z","updated_at":"2015-08-25T17:23:41Z","pushed_at":"2015-08-26T19:17:53Z","git_url":"git://github.com/adobe-photoshop/spaces-design.git","ssh_url":"git@github.com:adobe-photoshop/spaces-design.git","clone_url":"https://github.com/adobe-photoshop/spaces-design.git","svn_url":"https://github.com/adobe-photoshop/spaces-design","homepage":"http://adobe-photoshop.github.io/","size":18600,"stargazers_count":603,"watchers_count":603,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":235,"forks":42,"open_issues":235,"watchers":603,"default_branch":"master"}},"base":{"label":"adobe-photoshop:master","ref":"master","sha":"b3ceed71e1f9ad8dc9e9e8c6ecec9316e247bddf","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":37291353,"name":"spaces-design","full_name":"adobe-photoshop/spaces-design","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-design","description":"Adobe Photoshop Design Space","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-design","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/releases{/id}","created_at":"2015-06-11T23:23:47Z","updated_at":"2015-08-25T17:23:41Z","pushed_at":"2015-08-26T19:17:53Z","git_url":"git://github.com/adobe-photoshop/spaces-design.git","ssh_url":"git@github.com:adobe-photoshop/spaces-design.git","clone_url":"https://github.com/adobe-photoshop/spaces-design.git","svn_url":"https://github.com/adobe-photoshop/spaces-design","homepage":"http://adobe-photoshop.github.io/","size":18600,"stargazers_count":603,"watchers_count":603,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":235,"forks":42,"open_issues":235,"watchers":603,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2225"},"html":{"href":"https://github.com/adobe-photoshop/spaces-design/pull/2225"},"issue":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/2225"},"comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/2225/comments"},"review_comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2225/comments"},"review_comment":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/2225/commits"},"statuses":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/efe4520fcd4a0eb042572c582a4f54b4d9cbe14e"}}}}