Skip to content

Commit 803fb4f

Browse files
committed
MOBILE-1543 prefetch: Add 'single' param to prefetch handlers
1 parent 91a3aef commit 803fb4f

File tree

9 files changed

+43
-30
lines changed

9 files changed

+43
-30
lines changed

www/addons/mod_book/services/prefetch_handler.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ angular.module('mm.addons.mod_book')
8282
* @module mm.addons.mod_book
8383
* @ngdoc method
8484
* @name $mmaModBookPrefetchHandler#prefetch
85-
* @param {Object} module The module object returned by WS.
86-
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
85+
* @param {Object} module The module object returned by WS.
86+
* @param {Number} courseId Course ID the module belongs to.
87+
* @param {Boolean} single True if we're downloading a single module, false if we're downloading a whole section.
88+
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
8789
*/
88-
self.prefetch = function(module) {
90+
self.prefetch = function(module, courseId, single) {
8991
return $mmaModBook.prefetchContent(module);
9092
};
9193

www/addons/mod_folder/services/prefetch_handler.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ angular.module('mm.addons.mod_folder')
6464
* @module mm.addons.mod_folder
6565
* @ngdoc method
6666
* @name $mmaModFolderPrefetchHandler#prefetch
67-
* @param {Object} module The module object returned by WS.
68-
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
67+
* @param {Object} module The module object returned by WS.
68+
* @param {Number} courseId Course ID the module belongs to.
69+
* @param {Boolean} single True if we're downloading a single module, false if we're downloading a whole section.
70+
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
6971
*/
70-
self.prefetch = function(module) {
72+
self.prefetch = function(module, courseId, single) {
7173
return $mmaModFolder.prefetchContent(module);
7274
};
7375

www/addons/mod_imscp/services/prefetch_handler.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ angular.module('mm.addons.mod_imscp')
6464
* @module mm.addons.mod_imscp
6565
* @ngdoc method
6666
* @name $mmaModImscpPrefetchHandler#prefetch
67-
* @param {Object} module The module object returned by WS.
68-
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
67+
* @param {Object} module The module object returned by WS.
68+
* @param {Number} courseId Course ID the module belongs to.
69+
* @param {Boolean} single True if we're downloading a single module, false if we're downloading a whole section.
70+
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
6971
*/
70-
self.prefetch = function(module) {
72+
self.prefetch = function(module, courseId, single) {
7173
return $mmaModImscp.prefetchContent(module);
7274
};
7375

www/addons/mod_page/services/prefetch_handler.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ angular.module('mm.addons.mod_page')
6464
* @module mm.addons.mod_page
6565
* @ngdoc method
6666
* @name $mmaModPagePrefetchHandler#prefetch
67-
* @param {Object} module The module object returned by WS.
68-
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
67+
* @param {Object} module The module object returned by WS.
68+
* @param {Number} courseId Course ID the module belongs to.
69+
* @param {Boolean} single True if we're downloading a single module, false if we're downloading a whole section.
70+
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
6971
*/
70-
self.prefetch = function(module) {
72+
self.prefetch = function(module, courseId, single) {
7173
return $mmaModPage.prefetchContent(module);
7274
};
7375

www/addons/mod_quiz/services/prefetch_handler.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,13 @@ angular.module('mm.addons.mod_quiz')
136136
* @module mm.addons.mod_quiz
137137
* @ngdoc method
138138
* @name $mmaModQuizPrefetchHandler#prefetch
139-
* @param {Object} module The module object returned by WS.
140-
* @param {Number} courseId Course ID the module belongs to.
141-
* @return {Promise} Promise resolved when the prefetch is finished. Data returned is not reliable.
139+
* @param { Object} module The module object returned by WS.
140+
* @param {Number} courseId Course ID the module belongs to.
141+
* @param {Boolean} single True if we're downloading a single module, false if we're downloading a whole section.
142+
* @return {Promise} Promise resolved when the prefetch is finished. Data returned is not reliable.
142143
*/
143-
self.prefetch = function(module, courseId) {
144-
return $mmaModQuiz.prefetch(module, courseId);
144+
self.prefetch = function(module, courseId, single) {
145+
return $mmaModQuiz.prefetch(module, courseId, single);
145146
};
146147

147148
return self;

www/addons/mod_resource/services/prefetch_handler.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ angular.module('mm.addons.mod_resource')
6464
* @module mm.addons.mod_resource
6565
* @ngdoc method
6666
* @name $mmaModResourcePrefetchHandler#prefetch
67-
* @param {Object} module The module object returned by WS.
68-
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
67+
* @param {Object} module The module object returned by WS.
68+
* @param {Number} courseId Course ID the module belongs to.
69+
* @param {Boolean} single True if we're downloading a single module, false if we're downloading a whole section.
70+
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
6971
*/
70-
self.prefetch = function(module) {
72+
self.prefetch = function(module, courseId, single) {
7173
return $mmaModResource.prefetchContent(module);
7274
};
7375

www/addons/mod_scorm/services/prefetch_handler.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,13 @@ angular.module('mm.addons.mod_scorm')
117117
* @module mm.addons.mod_scorm
118118
* @ngdoc method
119119
* @name $mmaModScormPrefetchHandler#prefetch
120-
* @param {Object} module The module object returned by WS.
121-
* @param {Number} courseid Course ID the module belongs to.
122-
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
120+
* @param {Object} module The module object returned by WS.
121+
* @param {Number} courseId Course ID the module belongs to.
122+
* @param {Boolean} single True if we're downloading a single module, false if we're downloading a whole section.
123+
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
123124
*/
124-
self.prefetch = function(module, courseid) {
125-
return $mmaModScorm.getScorm(courseid, module.id, module.url).then(function(scorm) {
125+
self.prefetch = function(module, courseId, single) {
126+
return $mmaModScorm.getScorm(courseId, module.id, module.url).then(function(scorm) {
126127
return $mmaModScorm.prefetch(scorm);
127128
});
128129
};

www/addons/mod_wiki/services/prefetch_handler.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,12 @@ angular.module('mm.addons.mod_wiki')
176176
* @module mm.addons.mod_wiki
177177
* @ngdoc method
178178
* @name $mmaModWikiPrefetchHandler#prefetch
179-
* @param {Object} module The module object returned by WS.
180-
* @param {Number} courseId Course ID the module belongs to.
181-
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
179+
* @param {Object} module The module object returned by WS.
180+
* @param {Number} courseId Course ID the module belongs to.
181+
* @param {Boolean} single True if we're downloading a single module, false if we're downloading a whole section.
182+
* @return {Promise} Promise resolved when all files have been downloaded. Data returned is not reliable.
182183
*/
183-
self.prefetch = function(module, courseId) {
184+
self.prefetch = function(module, courseId, single) {
184185
var siteId = $mmSite.getId(),
185186
userid = userid || $mmSite.getUserId();
186187

www/core/components/course/services/prefetchdelegate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ angular.module('mm.core')
4747
* - component (String) Handler's component.
4848
* - getDownloadSize(module, courseid) (Number|Promise) Get the download size of a module.
4949
* - isEnabled() (Boolean|Promise) Whether or not the handler is enabled on a site level.
50-
* - prefetch(module, courseid) (Promise) Prefetches a module.
50+
* - prefetch(module, courseid, single) (Promise) Prefetches a module.
5151
* - (Optional) getFiles(module, courseid) (Object[]|Promise) Get list of files. If not defined,
5252
* we'll assume they're in module.contents.
5353
* - (Optional) determineStatus(status) (String) Returns status to show based on current. E.g. for

0 commit comments

Comments
 (0)