Skip to content

Commit 38f2a1b

Browse files
committed
Merge pull request #487 from dpalou/MOBILE-1543
Mobile 1543
2 parents 41483c1 + 944afe6 commit 38f2a1b

File tree

30 files changed

+798
-291
lines changed

30 files changed

+798
-291
lines changed

upgrade.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
This files describes API changes in the Moodle Mobile app,
22
information provided here is intended especially for developers.
33

4+
=== 3.1.0 ===
5+
6+
* A new param "single" is passed to the prefetch functions of handlers registered in $mmCoursePrefetchDelegateProvider. Please notice that the download of sections will always send false/undefined, if you use this function somewhere else to download a single module then you should pass single=true.
7+
48
=== 3.0 ===
59

610
* The function $mmaModBook#getChapterContent now requires to receive the result of $mmaModBook#getContentsMap instead of module.contents.

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/accessrules/delaybetweenattempts/handlers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ angular.module('mm.addons.mod_quiz')
3737
/**
3838
* Check if a preflight check is required.
3939
*
40+
* @param {Object} quiz Quiz.
4041
* @param {Object} [attempt] Attempt to continue. Not defined if starting a new attempt.
42+
* @param {Boolean} prefetch True if prefetching, false if attempting the quiz.
43+
* @param {String} [siteId] Site ID. If not defined, current site.
4144
* @return {Boolean} True if preflight check required.
4245
*/
43-
self.isPreflightCheckRequired = function(attempt) {
46+
self.isPreflightCheckRequired = function(quiz, attempt, prefetch, siteId) {
4447
return false;
4548
};
4649

www/addons/mod_quiz/accessrules/ipaddress/handlers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ angular.module('mm.addons.mod_quiz')
3737
/**
3838
* Check if a preflight check is required.
3939
*
40+
* @param {Object} quiz Quiz.
4041
* @param {Object} [attempt] Attempt to continue. Not defined if starting a new attempt.
42+
* @param {Boolean} prefetch True if prefetching, false if attempting the quiz.
43+
* @param {String} [siteId] Site ID. If not defined, current site.
4144
* @return {Boolean} True if preflight check required.
4245
*/
43-
self.isPreflightCheckRequired = function(attempt) {
46+
self.isPreflightCheckRequired = function(quiz, attempt, prefetch, siteId) {
4447
return false;
4548
};
4649

www/addons/mod_quiz/accessrules/numattempts/handlers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ angular.module('mm.addons.mod_quiz')
3737
/**
3838
* Check if a preflight check is required.
3939
*
40+
* @param {Object} quiz Quiz.
4041
* @param {Object} [attempt] Attempt to continue. Not defined if starting a new attempt.
42+
* @param {Boolean} prefetch True if prefetching, false if attempting the quiz.
43+
* @param {String} [siteId] Site ID. If not defined, current site.
4144
* @return {Boolean} True if preflight check required.
4245
*/
43-
self.isPreflightCheckRequired = function(attempt) {
46+
self.isPreflightCheckRequired = function(quiz, attempt, prefetch, siteId) {
4447
return false;
4548
};
4649

www/addons/mod_quiz/accessrules/offlineattempts/handlers.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,17 @@ angular.module('mm.addons.mod_quiz')
3737
/**
3838
* Check if a preflight check is required.
3939
*
40+
* @param {Object} quiz Quiz.
4041
* @param {Object} [attempt] Attempt to continue. Not defined if starting a new attempt.
42+
* @param {Boolean} prefetch True if prefetching, false if attempting the quiz.
43+
* @param {String} [siteId] Site ID. If not defined, current site.
4144
* @return {Boolean} True if preflight check required.
4245
*/
43-
self.isPreflightCheckRequired = function(attempt) {
46+
self.isPreflightCheckRequired = function(quiz, attempt, prefetch, siteId) {
47+
if (prefetch) {
48+
return false;
49+
}
50+
4451
if (!attempt) {
4552
return true;
4653
}
@@ -52,14 +59,14 @@ angular.module('mm.addons.mod_quiz')
5259
/**
5360
* Get fixed preflight data (data that doesn't require user interaction).
5461
*
55-
* @module mm.addons.mod_quiz
56-
* @ngdoc method
57-
* @name $mmaModQuizAccessRulesDelegate#getFixedPreflightData
62+
* @param {Object} quiz Quiz.
5863
* @param {Object} attempt Attempt.
5964
* @param {Object} preflightData Object where to store the preflight data.
65+
* @param {Boolean} prefetch True if prefetching, false if attempting the quiz.
66+
* @param {String} [siteId] Site ID. If not defined, current site.
6067
* @return {Void}
6168
*/
62-
self.getFixedPreflightData = function(attempt, preflightData) {
69+
self.getFixedPreflightData = function(quiz, attempt, preflightData, prefetch, siteId) {
6370
preflightData.confirmdatasaved = 1;
6471
};
6572

www/addons/mod_quiz/accessrules/openclosedate/handlers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ angular.module('mm.addons.mod_quiz')
3737
/**
3838
* Check if a preflight check is required.
3939
*
40+
* @param {Object} quiz Quiz.
4041
* @param {Object} [attempt] Attempt to continue. Not defined if starting a new attempt.
42+
* @param {Boolean} prefetch True if prefetching, false if attempting the quiz.
43+
* @param {String} [siteId] Site ID. If not defined, current site.
4144
* @return {Boolean} True if preflight check required.
4245
*/
43-
self.isPreflightCheckRequired = function(attempt) {
46+
self.isPreflightCheckRequired = function(quiz, attempt, prefetch, siteId) {
4447
return false;
4548
};
4649

0 commit comments

Comments
 (0)