android: Actually override window.open to always send the HYPERLINK on mobile.

To cover potential future developers adding window.open without knowing
it might break mobile...

Change-Id: Iadad985ac6fad9b9f068f224fd8fb21f073bead6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88732
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
Jan Holesovsky 2020-02-14 17:08:56 +01:00 committed by Michael Meeks
parent 1f04f15532
commit ceec4f0505
4 changed files with 6 additions and 16 deletions

View file

@ -40,6 +40,9 @@ dnl# and window.ThisIsTheGtkApp
ifelse(MOBILEAPP,[true],
[ window.ThisIsAMobileApp = true;
window.open = function (url, windowName, windowFeatures) {
window.postMobileMessage('HYPERLINK ' + url); /* don't call the 'normal' window.open on mobile at all */
}
window.MobileAppName='MOBILEAPPNAME';],
[ window.ThisIsAMobileApp = false;]
)

View file

@ -62,11 +62,7 @@ L.Control.AlertDialog = L.Control.extend({
type: 'button',
className: 'vex-dialog-button-primary',
click: function openClick () {
if (window.ThisIsAMobileApp) {
window.postMobileMessage('HYPERLINK ' + url);
} else {
window.open(url, '_blank');
}
window.open(url, '_blank');
vex.closeAll();
}
});

View file

@ -22,11 +22,7 @@ L.Control.Infobar = L.Control.extend({
return;
if (e.action.startsWith('http')) { // We have a link
if (window.ThisIsAMobileApp) {
window.postMobileMessage('HYPERLINK ' + e.action);
} else {
var win = window.open(e.action, '_blank');
}
var win = window.open(e.action, '_blank');
win.focus();
}
};

View file

@ -1155,12 +1155,7 @@ L.Control.Menubar = L.Control.extend({
} else if (id === 'about') {
this._map.showLOAboutDialog();
} else if (id === 'report-an-issue') {
var bugLink = 'https://bugs.documentfoundation.org/enter_bug.cgi?product=LibreOffice%20Online';
if (window.ThisIsAMobileApp) {
window.postMobileMessage('HYPERLINK ' + bugLink);
} else {
window.open(bugLink, '_blank');
}
window.open('https://bugs.documentfoundation.org/enter_bug.cgi?product=LibreOffice%20Online', '_blank');
} else if (id === 'inserthyperlink') {
this._map.showHyperlinkDialog();
} else if (id === 'keyboard-shortcuts' || id === 'online-help') {