Skip to content

Commit

Permalink
MDL-55059 tool_mobile: Support Smart App Banners for iOs
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva authored and danpoltawski committed Oct 4, 2016
1 parent 43cb92b commit 5c6daf1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions admin/tool/mobile/lang/en/tool_mobile.php
Expand Up @@ -23,11 +23,16 @@
*/

$string['clickheretolaunchtheapp'] = 'Click here if the app does not open automatically.';
$string['enablesmartappbanners'] = 'Enable Smart App Banners';
$string['enablesmartappbanners_desc'] = 'This will display a banner promoting the Moodle Mobile app when visiting the site in Mobile Safari.';
$string['forcedurlscheme'] = 'The URL scheme allows to open the mobile app from other apps like the browser. Use this setting if you want to allow only your custom branded app to be opened by the browser.';
$string['forcedurlscheme_key'] = 'URL scheme';
$string['iosappid'] = 'App\'s unique identifier';
$string['iosappid_desc'] = 'You only need to change this value if you have a custom iOS app';
$string['loginintheapp'] = 'Via the app';
$string['logininthebrowser'] = 'Via a browser window (for SSO plugins)';
$string['loginintheembeddedbrowser'] = 'Via an embedded browser (for SSO plugins)';
$string['pluginname'] = 'Moodle Mobile tools';
$string['smartappbanners'] = 'Smart App Banners (iOS only)';
$string['typeoflogin'] = 'Type of login';
$string['typeoflogin_desc'] = 'Choose the type of login.';
10 changes: 10 additions & 0 deletions admin/tool/mobile/settings.php
Expand Up @@ -58,5 +58,15 @@
new lang_string('forcedurlscheme_key', 'tool_mobile'),
new lang_string('forcedurlscheme', 'tool_mobile'), '', PARAM_NOTAGS));

$temp->add(new admin_setting_heading('tool_mobile/smartappbanners',
new lang_string('smartappbanners', 'tool_mobile'), ''));

$temp->add(new admin_setting_configcheckbox('tool_mobile/enablesmartappbanners',
new lang_string('enablesmartappbanners', 'tool_mobile'),
new lang_string('enablesmartappbanners_desc', 'tool_mobile'), 0));

$temp->add(new admin_setting_configtext('tool_mobile/iosappid', new lang_string('iosappid', 'tool_mobile'),
new lang_string('iosappid_desc', 'tool_mobile'), '633359593', PARAM_ALPHANUM));

$ADMIN->add('webservicesettings', $temp);
}
2 changes: 1 addition & 1 deletion admin/tool/mobile/version.php
Expand Up @@ -23,6 +23,6 @@
*/

defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016052302; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2016052303; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2016051900; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
9 changes: 9 additions & 0 deletions lib/outputrenderers.php
Expand Up @@ -540,6 +540,15 @@ public function standard_head_html() {
$output .= '<meta http-equiv="refresh" content="'.$this->page->periodicrefreshdelay.';url='.$this->page->url->out().'" />';
}

// Smart App Banners meta tag is only displayed if mobile services are enabled and configured.
if ($CFG->enablemobilewebservice) {
$mobilesettings = get_config('tool_mobile');
if ($mobilesettings->enablesmartappbanners and $mobilesettings->iosappid) {
$output .= '<meta name="apple-itunes-app" content="app-id=' . s($mobilesettings->iosappid) . ', ';
$output .= 'app-argument=' . $this->page->url->out() . '"/>';
}
}

// flow player embedding support
$this->page->requires->js_function_call('M.util.load_flowplayer');

Expand Down

0 comments on commit 5c6daf1

Please sign in to comment.