MOBILE-4475 ios: Enable native full screen in iOS 17+
parent
7f1c6b143d
commit
9be16e9636
|
@ -46,7 +46,7 @@
|
||||||
<preference name="iosPersistentFileLocation" value="Compatibility" />
|
<preference name="iosPersistentFileLocation" value="Compatibility" />
|
||||||
<preference name="iosScheme" value="moodleappfs" />
|
<preference name="iosScheme" value="moodleappfs" />
|
||||||
<preference name="WKWebViewOnly" value="true" />
|
<preference name="WKWebViewOnly" value="true" />
|
||||||
<preference name="WKFullScreenEnabled" value="false" />
|
<preference name="WKFullScreenEnabled" value="true" />
|
||||||
<preference name="AndroidXEnabled" value="true" />
|
<preference name="AndroidXEnabled" value="true" />
|
||||||
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
|
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
|
||||||
<preference name="GradlePluginGoogleServicesVersion" value="4.3.15" />
|
<preference name="GradlePluginGoogleServicesVersion" value="4.3.15" />
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
"@moodlehq/cordova-plugin-file-transfer": "2.0.0-moodle.2",
|
"@moodlehq/cordova-plugin-file-transfer": "2.0.0-moodle.2",
|
||||||
"@moodlehq/cordova-plugin-inappbrowser": "5.0.0-moodle.3",
|
"@moodlehq/cordova-plugin-inappbrowser": "5.0.0-moodle.3",
|
||||||
"@moodlehq/cordova-plugin-intent": "2.2.0-moodle.3",
|
"@moodlehq/cordova-plugin-intent": "2.2.0-moodle.3",
|
||||||
"@moodlehq/cordova-plugin-ionic-webview": "5.0.0-moodle.3",
|
"@moodlehq/cordova-plugin-ionic-webview": "5.0.0-moodle.4",
|
||||||
"@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.12",
|
"@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.12",
|
||||||
"@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.5",
|
"@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.5",
|
||||||
"@moodlehq/cordova-plugin-statusbar": "4.0.0-moodle.3",
|
"@moodlehq/cordova-plugin-statusbar": "4.0.0-moodle.3",
|
||||||
|
@ -5391,9 +5391,9 @@
|
||||||
"integrity": "sha512-sr5PPeGADRVM+z9JMGX4D5jhaAl4tD1s6SKrkChnEXxrONq9KZ7qkiZ68BsNsi962+PsRKMxLd0hfb8PZwphUg=="
|
"integrity": "sha512-sr5PPeGADRVM+z9JMGX4D5jhaAl4tD1s6SKrkChnEXxrONq9KZ7qkiZ68BsNsi962+PsRKMxLd0hfb8PZwphUg=="
|
||||||
},
|
},
|
||||||
"node_modules/@moodlehq/cordova-plugin-ionic-webview": {
|
"node_modules/@moodlehq/cordova-plugin-ionic-webview": {
|
||||||
"version": "5.0.0-moodle.3",
|
"version": "5.0.0-moodle.4",
|
||||||
"resolved": "https://registry.npmjs.org/@moodlehq/cordova-plugin-ionic-webview/-/cordova-plugin-ionic-webview-5.0.0-moodle.3.tgz",
|
"resolved": "https://registry.npmjs.org/@moodlehq/cordova-plugin-ionic-webview/-/cordova-plugin-ionic-webview-5.0.0-moodle.4.tgz",
|
||||||
"integrity": "sha512-iimL2zWbc7JqL/IEMh5lqzVlbf3R/bAabDRSQmUC+7rRlLB3479WVcZD8iJHok59GgjoaYpJ3W0lU6ySE+Asew==",
|
"integrity": "sha512-/vWlh0Ae5f0FmQifgQZmqrRzsx2yzNnrgoxd+HxxaPdNbuBvJ2yWHb0L+Q+wz9CC9LH59X/qqcfi1rfqYX1jmg==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"cordovaDependencies": {
|
"cordovaDependencies": {
|
||||||
"2.0.0": {
|
"2.0.0": {
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
"@moodlehq/cordova-plugin-file-transfer": "2.0.0-moodle.2",
|
"@moodlehq/cordova-plugin-file-transfer": "2.0.0-moodle.2",
|
||||||
"@moodlehq/cordova-plugin-inappbrowser": "5.0.0-moodle.3",
|
"@moodlehq/cordova-plugin-inappbrowser": "5.0.0-moodle.3",
|
||||||
"@moodlehq/cordova-plugin-intent": "2.2.0-moodle.3",
|
"@moodlehq/cordova-plugin-intent": "2.2.0-moodle.3",
|
||||||
"@moodlehq/cordova-plugin-ionic-webview": "5.0.0-moodle.3",
|
"@moodlehq/cordova-plugin-ionic-webview": "5.0.0-moodle.4",
|
||||||
"@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.12",
|
"@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.12",
|
||||||
"@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.5",
|
"@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.5",
|
||||||
"@moodlehq/cordova-plugin-statusbar": "4.0.0-moodle.3",
|
"@moodlehq/cordova-plugin-statusbar": "4.0.0-moodle.3",
|
||||||
|
|
|
@ -27,6 +27,8 @@ function isIOS() {
|
||||||
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document);
|
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let useFakeFullScreen = false;
|
||||||
|
|
||||||
// Detect if we support fullscreen, and what prefix to use.
|
// Detect if we support fullscreen, and what prefix to use.
|
||||||
if (document.documentElement.requestFullscreen) {
|
if (document.documentElement.requestFullscreen) {
|
||||||
/**
|
/**
|
||||||
|
@ -57,6 +59,7 @@ else if (document.documentElement.msRequestFullscreen) {
|
||||||
// This code has been added to allow a "fake" full screen in Moodle app.
|
// This code has been added to allow a "fake" full screen in Moodle app.
|
||||||
H5P.fullScreenBrowserPrefix = 'webkit';
|
H5P.fullScreenBrowserPrefix = 'webkit';
|
||||||
H5P.safariBrowser = 0;
|
H5P.safariBrowser = 0;
|
||||||
|
useFakeFullScreen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,7 +177,7 @@ H5P.init = function (target) {
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
if (isIOS()) {
|
if (useFakeFullScreen) {
|
||||||
// Register message listener to enter fullscreen.
|
// Register message listener to enter fullscreen.
|
||||||
window.addEventListener('message', function receiveMessage(event) {
|
window.addEventListener('message', function receiveMessage(event) {
|
||||||
if (event.data == 'enterFullScreen') {
|
if (event.data == 'enterFullScreen') {
|
||||||
|
@ -699,7 +702,7 @@ H5P.fullScreen = function ($element, instance, exitCallback, body, forceSemiFull
|
||||||
var method = (H5P.fullScreenBrowserPrefix === 'ms' ? 'msRequestFullscreen' : H5P.fullScreenBrowserPrefix + 'RequestFullScreen');
|
var method = (H5P.fullScreenBrowserPrefix === 'ms' ? 'msRequestFullscreen' : H5P.fullScreenBrowserPrefix + 'RequestFullScreen');
|
||||||
var params = (H5P.fullScreenBrowserPrefix === 'webkit' && H5P.safariBrowser === 0 ? Element.ALLOW_KEYBOARD_INPUT : undefined);
|
var params = (H5P.fullScreenBrowserPrefix === 'webkit' && H5P.safariBrowser === 0 ? Element.ALLOW_KEYBOARD_INPUT : undefined);
|
||||||
|
|
||||||
if (isIOS()) {
|
if (useFakeFullScreen) {
|
||||||
before('h5p-fullscreen-ios');
|
before('h5p-fullscreen-ios');
|
||||||
window.parent.postMessage('enterFullScreen', '*');
|
window.parent.postMessage('enterFullScreen', '*');
|
||||||
} else {
|
} else {
|
||||||
|
@ -718,7 +721,7 @@ H5P.fullScreen = function ($element, instance, exitCallback, body, forceSemiFull
|
||||||
else {
|
else {
|
||||||
done('h5p-fullscreen');
|
done('h5p-fullscreen');
|
||||||
document[H5P.fullScreenBrowserPrefix + 'ExitFullscreen'] && document[H5P.fullScreenBrowserPrefix + 'ExitFullscreen']();
|
document[H5P.fullScreenBrowserPrefix + 'ExitFullscreen'] && document[H5P.fullScreenBrowserPrefix + 'ExitFullscreen']();
|
||||||
if (isIOS()) {
|
if (useFakeFullScreen) {
|
||||||
done('h5p-fullscreen-ios');
|
done('h5p-fullscreen-ios');
|
||||||
window.parent.postMessage('exitFullScreen', '*');
|
window.parent.postMessage('exitFullScreen', '*');
|
||||||
}
|
}
|
||||||
|
@ -727,7 +730,7 @@ H5P.fullScreen = function ($element, instance, exitCallback, body, forceSemiFull
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isIOS()) {
|
if (useFakeFullScreen) {
|
||||||
// Pass fullscreen messages to child iframes.
|
// Pass fullscreen messages to child iframes.
|
||||||
window.addEventListener('message', function receiveMessage(event) {
|
window.addEventListener('message', function receiveMessage(event) {
|
||||||
if (event.data === 'enterFullScreen' || event.data === 'exitFullScreen') {
|
if (event.data === 'enterFullScreen' || event.data === 'exitFullScreen') {
|
||||||
|
|
|
@ -7,3 +7,4 @@ Changes:
|
||||||
2. The h5p.js file has been modified to simulate a fake full screen in iOS. The H5P file now sends post messages to the app, and also listens to messages sent by the app to enter/exit full screen.
|
2. The h5p.js file has been modified to simulate a fake full screen in iOS. The H5P file now sends post messages to the app, and also listens to messages sent by the app to enter/exit full screen.
|
||||||
3. The embed.js file has been modified to remove optional chaining because it isn't supported in some old devices.
|
3. The embed.js file has been modified to remove optional chaining because it isn't supported in some old devices.
|
||||||
4. The h5p.js has been modified to include a call to contentUserDataAjax (this change was done in LMS too).
|
4. The h5p.js has been modified to include a call to contentUserDataAjax (this change was done in LMS too).
|
||||||
|
5. The h5p.js has been modified so the fake sull screen (point 2) is only used if native full screen is not available (iOS 16 or older).
|
||||||
|
|
Loading…
Reference in New Issue