mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-09 12:19:46 -04:00
Messaging for Safari, IE11 and Edge using dropdown
This commit is contained in:
parent
62909c08c2
commit
ad78bf16ae
@ -1399,7 +1399,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
|
||||
settingsStore.setItem('hideActiveContentWarning', params.hideActiveContentWarning, Infinity);
|
||||
refreshCacheStatus();
|
||||
});
|
||||
// Run lockDisplayOrientation on startup
|
||||
// Check lockDisplayOrientation on startup
|
||||
document.getElementById('lockDisplayOrientationDrop').value = params.lockDisplayOrientation || '';
|
||||
var topArea = document.getElementById('search-article');
|
||||
var refreshFullScreen = function (evt) {
|
||||
@ -1434,8 +1434,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
|
||||
topArea.addEventListener('mouseup', refreshFullScreen);
|
||||
document.getElementById('lockDisplayOrientationDrop').addEventListener('change', function (event) {
|
||||
var that = this;
|
||||
var message = event.target.value ? ('<p>Attempting to set the orientation lock to: ' + event.target.value + '</p>') : '<p>Attempting to clear the orientation lock.</p>';
|
||||
if (event.target.value) message += '<p><i>Please be aware that this setting may only work in mobile contexts where the app is installed or in standalone mode.</i></p>'
|
||||
if (event.target.value) {
|
||||
return uiUtil.lockDisplayOrientation(event.target.value).then(function (rtn) {
|
||||
if (rtn === 'unsupported') {
|
||||
uiUtil.systemAlert('The Screen Orientation Lock API is not supported on this device!');
|
||||
@ -1443,6 +1442,11 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
|
||||
} else {
|
||||
params.lockDisplayOrientation = event.target.value || '';
|
||||
settingsStore.setItem('lockDisplayOrientation', params.lockDisplayOrientation, Infinity);
|
||||
if (rtn === 'click') {
|
||||
uiUtil.systemAlert('<p>Please click the <span class="glyphicon glyphicon-fullscreen"></span> button top-right to enter full-screen mode.</p>' + (params.PWAInstalled &&
|
||||
/iOS/.test(params.appType) ?'<p>In Safari on iOS, consider adding this app to your homescreen (Share --> Add to Home), which will give a better experience than full-screen mode.</p>' : '')
|
||||
);
|
||||
}
|
||||
}
|
||||
setDynamicIcons();
|
||||
}).catch(function (err) {
|
||||
@ -1460,7 +1464,16 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'cache', 'images
|
||||
}
|
||||
setDynamicIcons();
|
||||
});
|
||||
})
|
||||
} else {
|
||||
params.lockDisplayOrientation = '';
|
||||
settingsStore.setItem('lockDisplayOrientation', '', Infinity);
|
||||
uiUtil.lockDisplayOrientation().then(function () {
|
||||
setDynamicIcons();
|
||||
}).catch(function () {
|
||||
return;
|
||||
});
|
||||
}
|
||||
});
|
||||
document.getElementById('debugLibzimASMDrop').addEventListener('change', function (event) {
|
||||
var that = this;
|
||||
var message = '<p>App will reload to apply the new setting.</p>'
|
||||
|
@ -1009,7 +1009,7 @@ define(rqDef, function(util) {
|
||||
function requestOrCancelFullScreen(el) {
|
||||
// Don't do anything if already in full-screen mode, and user has not requested to exit full-screen mode
|
||||
if (el && appIsFullScreen()) {
|
||||
console.log('Display is already full screen');
|
||||
console.debug('Display is already full screen');
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
// Choose the correct method to request or cancel full-screen mode
|
||||
@ -1065,12 +1065,20 @@ define(rqDef, function(util) {
|
||||
return rtn;
|
||||
// return Promise.resolve(rtn);
|
||||
}
|
||||
} else {
|
||||
if (document.documentElement.webkitRequestFullscreen || document.documentElement.msRequestFullscreen) {
|
||||
// We are in a Safari browser or IE11, and a click is required to enter full-screen mode
|
||||
return 'click';
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// User wants to cancel full-screen mode and unlock the display orientation
|
||||
if (screen && screen.orientation && screen.orientation.unlock) {
|
||||
screen.orientation.unlock(); // NB This doesn't return a Promise
|
||||
}
|
||||
return requestOrCancelFullScreen();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user