Skip to content

Commit

Permalink
MDL-66775 tool_mobile: New force minimum app version setting
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva committed Oct 3, 2019
1 parent 9528b1f commit 4bf08f5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions admin/tool/mobile/classes/api.php
Expand Up @@ -177,6 +177,7 @@ public static function get_public_config() {
'langmenu' => $CFG->langmenu,
'langlist' => $CFG->langlist,
'locale' => $CFG->locale,
'tool_mobile_minimumversion' => get_config('tool_mobile', 'minimumversion'),
);

$typeoflogin = get_config('tool_mobile', 'typeoflogin');
Expand Down
2 changes: 2 additions & 0 deletions admin/tool/mobile/classes/external.php
Expand Up @@ -179,6 +179,8 @@ public static function get_public_config_returns() {
'langmenu' => new external_value(PARAM_INT, 'Whether the language menu should be displayed.', VALUE_OPTIONAL),
'langlist' => new external_value(PARAM_RAW, 'Languages on language menu.', VALUE_OPTIONAL),
'locale' => new external_value(PARAM_RAW, 'Sitewide locale.', VALUE_OPTIONAL),
'tool_mobile_minimumversion' => new external_value(PARAM_NOTAGS, 'Minimum required version to access.',
VALUE_OPTIONAL),
'warnings' => new external_warnings(),
)
);
Expand Down
2 changes: 2 additions & 0 deletions admin/tool/mobile/lang/en/tool_mobile.php
Expand Up @@ -75,6 +75,8 @@
$string['logininthebrowser'] = 'Via a browser window (for SSO plugins)';
$string['loginintheembeddedbrowser'] = 'Via an embedded browser (for SSO plugins)';
$string['mainmenu'] = 'Main menu';
$string['minimumversion'] = 'Require users to upgrade their apps to the minimum version indicated. Those using previous versions of the app will not be able to access to the site. This works since app version 3.8.0 onward.';
$string['minimumversion_key'] = 'Minimum app version required';
$string['mobileapp'] = 'Mobile app';
$string['mobileappconnected'] = 'Mobile app connected';
$string['mobileappenabled'] = 'This site has mobile app access enabled.<br /><a href="{$a}">Download the mobile app</a>.';
Expand Down
4 changes: 4 additions & 0 deletions admin/tool/mobile/settings.php
Expand Up @@ -65,6 +65,10 @@
new lang_string('forcedurlscheme_key', 'tool_mobile'),
new lang_string('forcedurlscheme', 'tool_mobile'), 'moodlemobile', PARAM_ALPHANUM));

$temp->add(new admin_setting_configtext('tool_mobile/minimumversion',
new lang_string('minimumversion_key', 'tool_mobile'),
new lang_string('minimumversion', 'tool_mobile'), '', PARAM_NOTAGS));

$ADMIN->add('mobileapp', $temp);

// Appearance related settings.
Expand Down
3 changes: 3 additions & 0 deletions admin/tool/mobile/tests/externallib_test.php
Expand Up @@ -95,6 +95,7 @@ public function test_get_public_config() {
'langmenu' => $CFG->langmenu,
'langlist' => $CFG->langlist,
'locale' => $CFG->locale,
'tool_mobile_minimumversion' => '',
'warnings' => array()
);
$this->assertEquals($expected, $result);
Expand All @@ -111,6 +112,7 @@ public function test_get_public_config() {
set_config('autolang', 1);
set_config('lang', 'a_b'); // Set invalid lang.
set_config('disabledfeatures', 'myoverview', 'tool_mobile');
set_config('minimumversion', '3.8.0', 'tool_mobile');

list($authinstructions, $notusedformat) = external_format_text($authinstructions, FORMAT_MOODLE, $context->id);
$expected['registerauth'] = 'email';
Expand All @@ -123,6 +125,7 @@ public function test_get_public_config() {
$expected['autolang'] = '1';
$expected['lang'] = ''; // Expect empty because it was set to an invalid lang.
$expected['tool_mobile_disabledfeatures'] = 'myoverview';
$expected['tool_mobile_minimumversion'] = '3.8.0';

if ($logourl = $OUTPUT->get_logo_url()) {
$expected['logourl'] = $logourl->out(false);
Expand Down
2 changes: 1 addition & 1 deletion version.php
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2019092700.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2019092700.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.

Expand Down

0 comments on commit 4bf08f5

Please sign in to comment.