{"action":"created","comment":{"url":"https://api.github.com/repos/oppia/oppia/pulls/comments/191320074","pull_request_review_id":123866816,"id":191320074,"diff_hunk":"@@ -0,0 +1,197 @@\n+// Copyright 2017 The Oppia Authors. All Rights Reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//      http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS-IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+/**\n+ * @fileoverview Service to preload image into AssetsBackendApiService's cache.\n+ */\n+\n+oppia.factory('ImagePreloaderService', [\n+  '$q', '$uibModal', 'ExplorationContextService', 'AssetsBackendApiService',\n+  'ExplorationPlayerStateService', 'UrlInterpolationService',\n+  'ComputeGraphService', 'ExtractImageFilenamesFromStateService',\n+  function($q, $uibModal, ExplorationContextService, AssetsBackendApiService,\n+      ExplorationPlayerStateService, UrlInterpolationService,\n+      ComputeGraphService, ExtractImageFilenamesFromStateService) {\n+    var MAX_NUM_IMAGE_FILES_TO_DOWNLOAD_SIMULTANEOUSLY = 3;\n+\n+    var _filenamesOfImageCurrentlyDownloading = [];\n+    var _filenamesOfImageToBeDownloaded = [];\n+    var _exploration = null;\n+    // imageLoadedCallback is an object of objects (identified by the filenames\n+    // which are being downloaded at the time they are required by the\n+    // directive).The object contains the resolve method of the promise\n+    // attached with getInImageUrl method.\n+    var _imageLoadedCallback = {};\n+\n+    var _init = function(exploration) {\n+      _exploration = exploration;\n+      _states = exploration.states;\n+    };\n+\n+    /**\n+     * Gets the Url for the image file.\n+     * @param {string} filename - Filename of the image whose Url is to be\n+     *                            created.\n+     * @param {function} onLoadCallback - Function that is called when the\n+     *                                    Url of the loaded image is obtained.\n+     */\n+    var _getUrlUsingFileInCache = function(filename, onLoadCallback) {\n+      AssetsBackendApiService.loadImage(\n+        ExplorationContextService.getExplorationId(), filename)\n+        .then(function(loadedImageFile) {\n+          var objectUrl = URL.createObjectURL(loadedImageFile.data);\n+          if (onLoadCallback) {","path":"core/templates/dev/head/pages/exploration_player/ImagePreloaderService.js","position":54,"original_position":54,"commit_id":"3cbae18c06059e14d1e4345c8fa999de15c8f990","original_commit_id":"3cbae18c06059e14d1e4345c8fa999de15c8f990","user":{"login":"ishucr7","id":23234392,"avatar_url":"https://avatars1.githubusercontent.com/u/23234392?v=4","gravatar_id":"","url":"https://api.github.com/users/ishucr7","html_url":"https://github.com/ishucr7","followers_url":"https://api.github.com/users/ishucr7/followers","following_url":"https://api.github.com/users/ishucr7/following{/other_user}","gists_url":"https://api.github.com/users/ishucr7/gists{/gist_id}","starred_url":"https://api.github.com/users/ishucr7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishucr7/subscriptions","organizations_url":"https://api.github.com/users/ishucr7/orgs","repos_url":"https://api.github.com/users/ishucr7/repos","events_url":"https://api.github.com/users/ishucr7/events{/privacy}","received_events_url":"https://api.github.com/users/ishucr7/received_events","type":"User","site_admin":false},"body":"Done!","created_at":"2018-05-29T06:59:50Z","updated_at":"2018-05-29T06:59:50Z","html_url":"https://github.com/oppia/oppia/pull/4990#discussion_r191320074","pull_request_url":"https://api.github.com/repos/oppia/oppia/pulls/4990","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments/191320074"},"html":{"href":"https://github.com/oppia/oppia/pull/4990#discussion_r191320074"},"pull_request":{"href":"https://api.github.com/repos/oppia/oppia/pulls/4990"}},"in_reply_to_id":191251663},"pull_request":{"url":"https://api.github.com/repos/oppia/oppia/pulls/4990","id":190944892,"html_url":"https://github.com/oppia/oppia/pull/4990","diff_url":"https://github.com/oppia/oppia/pull/4990.diff","patch_url":"https://github.com/oppia/oppia/pull/4990.patch","issue_url":"https://api.github.com/repos/oppia/oppia/issues/4990","number":4990,"state":"open","locked":false,"title":"Added the ImagePreloaderService and edited the ImageDirective","user":{"login":"ishucr7","id":23234392,"avatar_url":"https://avatars1.githubusercontent.com/u/23234392?v=4","gravatar_id":"","url":"https://api.github.com/users/ishucr7","html_url":"https://github.com/ishucr7","followers_url":"https://api.github.com/users/ishucr7/followers","following_url":"https://api.github.com/users/ishucr7/following{/other_user}","gists_url":"https://api.github.com/users/ishucr7/gists{/gist_id}","starred_url":"https://api.github.com/users/ishucr7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishucr7/subscriptions","organizations_url":"https://api.github.com/users/ishucr7/orgs","repos_url":"https://api.github.com/users/ishucr7/repos","events_url":"https://api.github.com/users/ishucr7/events{/privacy}","received_events_url":"https://api.github.com/users/ishucr7/received_events","type":"User","site_admin":false},"body":"TODO : Add the tests for the ImagePreloaderService. (ImagePrelaoderServiceSpec.js)","created_at":"2018-05-28T14:31:12Z","updated_at":"2018-05-29T06:59:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cf1949da636215e51f4ff9518b6867f332863e69","assignee":{"login":"vojtechjelinek","id":10142938,"avatar_url":"https://avatars0.githubusercontent.com/u/10142938?v=4","gravatar_id":"","url":"https://api.github.com/users/vojtechjelinek","html_url":"https://github.com/vojtechjelinek","followers_url":"https://api.github.com/users/vojtechjelinek/followers","following_url":"https://api.github.com/users/vojtechjelinek/following{/other_user}","gists_url":"https://api.github.com/users/vojtechjelinek/gists{/gist_id}","starred_url":"https://api.github.com/users/vojtechjelinek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vojtechjelinek/subscriptions","organizations_url":"https://api.github.com/users/vojtechjelinek/orgs","repos_url":"https://api.github.com/users/vojtechjelinek/repos","events_url":"https://api.github.com/users/vojtechjelinek/events{/privacy}","received_events_url":"https://api.github.com/users/vojtechjelinek/received_events","type":"User","site_admin":false},"assignees":[{"login":"vojtechjelinek","id":10142938,"avatar_url":"https://avatars0.githubusercontent.com/u/10142938?v=4","gravatar_id":"","url":"https://api.github.com/users/vojtechjelinek","html_url":"https://github.com/vojtechjelinek","followers_url":"https://api.github.com/users/vojtechjelinek/followers","following_url":"https://api.github.com/users/vojtechjelinek/following{/other_user}","gists_url":"https://api.github.com/users/vojtechjelinek/gists{/gist_id}","starred_url":"https://api.github.com/users/vojtechjelinek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vojtechjelinek/subscriptions","organizations_url":"https://api.github.com/users/vojtechjelinek/orgs","repos_url":"https://api.github.com/users/vojtechjelinek/repos","events_url":"https://api.github.com/users/vojtechjelinek/events{/privacy}","received_events_url":"https://api.github.com/users/vojtechjelinek/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/oppia/oppia/pulls/4990/commits","review_comments_url":"https://api.github.com/repos/oppia/oppia/pulls/4990/comments","review_comment_url":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/4990/comments","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/3cbae18c06059e14d1e4345c8fa999de15c8f990","head":{"label":"ishucr7:Ml1.3","ref":"Ml1.3","sha":"3cbae18c06059e14d1e4345c8fa999de15c8f990","user":{"login":"ishucr7","id":23234392,"avatar_url":"https://avatars1.githubusercontent.com/u/23234392?v=4","gravatar_id":"","url":"https://api.github.com/users/ishucr7","html_url":"https://github.com/ishucr7","followers_url":"https://api.github.com/users/ishucr7/followers","following_url":"https://api.github.com/users/ishucr7/following{/other_user}","gists_url":"https://api.github.com/users/ishucr7/gists{/gist_id}","starred_url":"https://api.github.com/users/ishucr7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishucr7/subscriptions","organizations_url":"https://api.github.com/users/ishucr7/orgs","repos_url":"https://api.github.com/users/ishucr7/repos","events_url":"https://api.github.com/users/ishucr7/events{/privacy}","received_events_url":"https://api.github.com/users/ishucr7/received_events","type":"User","site_admin":false},"repo":{"id":121524464,"name":"oppia","full_name":"ishucr7/oppia","owner":{"login":"ishucr7","id":23234392,"avatar_url":"https://avatars1.githubusercontent.com/u/23234392?v=4","gravatar_id":"","url":"https://api.github.com/users/ishucr7","html_url":"https://github.com/ishucr7","followers_url":"https://api.github.com/users/ishucr7/followers","following_url":"https://api.github.com/users/ishucr7/following{/other_user}","gists_url":"https://api.github.com/users/ishucr7/gists{/gist_id}","starred_url":"https://api.github.com/users/ishucr7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ishucr7/subscriptions","organizations_url":"https://api.github.com/users/ishucr7/orgs","repos_url":"https://api.github.com/users/ishucr7/repos","events_url":"https://api.github.com/users/ishucr7/events{/privacy}","received_events_url":"https://api.github.com/users/ishucr7/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ishucr7/oppia","description":"Tool for collaboratively building interactive lessons.","fork":true,"url":"https://api.github.com/repos/ishucr7/oppia","forks_url":"https://api.github.com/repos/ishucr7/oppia/forks","keys_url":"https://api.github.com/repos/ishucr7/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ishucr7/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ishucr7/oppia/teams","hooks_url":"https://api.github.com/repos/ishucr7/oppia/hooks","issue_events_url":"https://api.github.com/repos/ishucr7/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/ishucr7/oppia/events","assignees_url":"https://api.github.com/repos/ishucr7/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/ishucr7/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/ishucr7/oppia/tags","blobs_url":"https://api.github.com/repos/ishucr7/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ishucr7/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ishucr7/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/ishucr7/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ishucr7/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/ishucr7/oppia/languages","stargazers_url":"https://api.github.com/repos/ishucr7/oppia/stargazers","contributors_url":"https://api.github.com/repos/ishucr7/oppia/contributors","subscribers_url":"https://api.github.com/repos/ishucr7/oppia/subscribers","subscription_url":"https://api.github.com/repos/ishucr7/oppia/subscription","commits_url":"https://api.github.com/repos/ishucr7/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/ishucr7/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/ishucr7/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/ishucr7/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/ishucr7/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/ishucr7/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ishucr7/oppia/merges","archive_url":"https://api.github.com/repos/ishucr7/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ishucr7/oppia/downloads","issues_url":"https://api.github.com/repos/ishucr7/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/ishucr7/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/ishucr7/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/ishucr7/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ishucr7/oppia/labels{/name}","releases_url":"https://api.github.com/repos/ishucr7/oppia/releases{/id}","deployments_url":"https://api.github.com/repos/ishucr7/oppia/deployments","created_at":"2018-02-14T15:10:32Z","updated_at":"2018-02-14T15:10:39Z","pushed_at":"2018-05-29T06:09:05Z","git_url":"git://github.com/ishucr7/oppia.git","ssh_url":"git@github.com:ishucr7/oppia.git","clone_url":"https://github.com/ishucr7/oppia.git","svn_url":"https://github.com/ishucr7/oppia","homepage":"https://www.oppia.org","size":103092,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"oppia:develop","ref":"develop","sha":"afe379255de9cc8f8c555595e389850b5412bae9","user":{"login":"oppia","id":11620230,"avatar_url":"https://avatars1.githubusercontent.com/u/11620230?v=4","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"repo":{"id":40687563,"name":"oppia","full_name":"oppia/oppia","owner":{"login":"oppia","id":11620230,"avatar_url":"https://avatars1.githubusercontent.com/u/11620230?v=4","gravatar_id":"","url":"https://api.github.com/users/oppia","html_url":"https://github.com/oppia","followers_url":"https://api.github.com/users/oppia/followers","following_url":"https://api.github.com/users/oppia/following{/other_user}","gists_url":"https://api.github.com/users/oppia/gists{/gist_id}","starred_url":"https://api.github.com/users/oppia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppia/subscriptions","organizations_url":"https://api.github.com/users/oppia/orgs","repos_url":"https://api.github.com/users/oppia/repos","events_url":"https://api.github.com/users/oppia/events{/privacy}","received_events_url":"https://api.github.com/users/oppia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/oppia/oppia","description":"Tool for collaboratively building interactive lessons.","fork":false,"url":"https://api.github.com/repos/oppia/oppia","forks_url":"https://api.github.com/repos/oppia/oppia/forks","keys_url":"https://api.github.com/repos/oppia/oppia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oppia/oppia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oppia/oppia/teams","hooks_url":"https://api.github.com/repos/oppia/oppia/hooks","issue_events_url":"https://api.github.com/repos/oppia/oppia/issues/events{/number}","events_url":"https://api.github.com/repos/oppia/oppia/events","assignees_url":"https://api.github.com/repos/oppia/oppia/assignees{/user}","branches_url":"https://api.github.com/repos/oppia/oppia/branches{/branch}","tags_url":"https://api.github.com/repos/oppia/oppia/tags","blobs_url":"https://api.github.com/repos/oppia/oppia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oppia/oppia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oppia/oppia/git/refs{/sha}","trees_url":"https://api.github.com/repos/oppia/oppia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oppia/oppia/statuses/{sha}","languages_url":"https://api.github.com/repos/oppia/oppia/languages","stargazers_url":"https://api.github.com/repos/oppia/oppia/stargazers","contributors_url":"https://api.github.com/repos/oppia/oppia/contributors","subscribers_url":"https://api.github.com/repos/oppia/oppia/subscribers","subscription_url":"https://api.github.com/repos/oppia/oppia/subscription","commits_url":"https://api.github.com/repos/oppia/oppia/commits{/sha}","git_commits_url":"https://api.github.com/repos/oppia/oppia/git/commits{/sha}","comments_url":"https://api.github.com/repos/oppia/oppia/comments{/number}","issue_comment_url":"https://api.github.com/repos/oppia/oppia/issues/comments{/number}","contents_url":"https://api.github.com/repos/oppia/oppia/contents/{+path}","compare_url":"https://api.github.com/repos/oppia/oppia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oppia/oppia/merges","archive_url":"https://api.github.com/repos/oppia/oppia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oppia/oppia/downloads","issues_url":"https://api.github.com/repos/oppia/oppia/issues{/number}","pulls_url":"https://api.github.com/repos/oppia/oppia/pulls{/number}","milestones_url":"https://api.github.com/repos/oppia/oppia/milestones{/number}","notifications_url":"https://api.github.com/repos/oppia/oppia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oppia/oppia/labels{/name}","releases_url":"https://api.github.com/repos/oppia/oppia/releases{/id}","deployments_url":"https://api.github.com/repos/oppia/oppia/deployments","created_at":"2015-08-14T00:16:14Z","updated_at":"2018-05-28T03:40:48Z","pushed_at":"2018-05-29T06:10:35Z","git_url":"git://github.com/oppia/oppia.git","ssh_url":"git@github.com:oppia/oppia.git","clone_url":"https://github.com/oppia/oppia.git","svn_url":"https://github.com/oppia/oppia","homepage":"https://www.oppia.org","size":103202,"stargazers_count":652,"watchers_count":652,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":630,"mirror_url":null,"archived":false,"open_issues_count":304,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":630,"open_issues":304,"watchers":652,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/oppia/oppia/pulls/4990"},"html":{"href":"https://github.com/oppia/oppia/pull/4990"},"issue":{"href":"https://api.github.com/repos/oppia/oppia/issues/4990"},"comments":{"href":"https://api.github.com/repos/oppia/oppia/issues/4990/comments"},"review_comments":{"href":"https://api.github.com/repos/oppia/oppia/pulls/4990/comments"},"review_comment":{"href":"https://api.github.com/repos/oppia/oppia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/oppia/oppia/pulls/4990/commits"},"statuses":{"href":"https://api.github.com/repos/oppia/oppia/statuses/3cbae18c06059e14d1e4345c8fa999de15c8f990"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ishucr7"}}