[Libreoffice-commits] online.git: android/lib loleaflet/src
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 14 14:44:16 UTC 2020
android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java | 6 ++++++
loleaflet/src/control/Control.AlertDialog.js | 6 +++++-
loleaflet/src/control/Control.Infobar.js | 6 +++++-
loleaflet/src/control/Control.Menubar.js | 7 ++++++-
loleaflet/src/control/Toolbar.js | 2 +-
loleaflet/src/core/Socket.js | 4 ++--
6 files changed, 25 insertions(+), 6 deletions(-)
New commits:
commit 2174206de1a8f5a87efef934b208c8b95db03447
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Feb 14 15:22:46 2020 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Feb 14 15:43:58 2020 +0100
android: Don't hang after returning from a hyperlink.
It seems that it is actually the webview that gets into a weird state
after returning from the url. Unfortunately intercepting the calls via
shouldOverrideUrlLoading() in a WebViewClient does not help, so the only
way seems to be to make sure we actually don't have any clickable URL
anywhere, and for the rest, we issue a 'HYPERLINK' postMobileMessage...
Change-Id: I62dc2cfbe867e97aec7fac5f83c4399814ef2ce4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88720
Tested-by: Jan Holesovsky <kendy at collabora.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
index 424e0cd09..7033707e5 100644
--- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
+++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java
@@ -785,6 +785,12 @@ public class LOActivity extends AppCompatActivity {
}
return false;
}
+ case "HYPERLINK": {
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setData(Uri.parse(messageAndParam[1]));
+ startActivity(intent);
+ return false;
+ }
}
return true;
}
diff --git a/loleaflet/src/control/Control.AlertDialog.js b/loleaflet/src/control/Control.AlertDialog.js
index c73d87d92..20404dcb5 100644
--- a/loleaflet/src/control/Control.AlertDialog.js
+++ b/loleaflet/src/control/Control.AlertDialog.js
@@ -62,7 +62,11 @@ L.Control.AlertDialog = L.Control.extend({
type: 'button',
className: 'vex-dialog-button-primary',
click: function openClick () {
- window.open(url, '_blank');
+ if (window.ThisIsAMobileApp) {
+ window.postMobileMessage('HYPERLINK ' + url);
+ } else {
+ window.open(url, '_blank');
+ }
vex.closeAll();
}
});
diff --git a/loleaflet/src/control/Control.Infobar.js b/loleaflet/src/control/Control.Infobar.js
index b00d0cdb2..48b92c8a1 100644
--- a/loleaflet/src/control/Control.Infobar.js
+++ b/loleaflet/src/control/Control.Infobar.js
@@ -22,7 +22,11 @@ L.Control.Infobar = L.Control.extend({
return;
if (e.action.startsWith('http')) { // We have a link
- var win = window.open(e.action, '_blank');
+ if (window.ThisIsAMobileApp) {
+ window.postMobileMessage('HYPERLINK ' + e.action);
+ } else {
+ var win = window.open(e.action, '_blank');
+ }
win.focus();
}
};
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 1a5cdc19d..6ea82050f 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -1155,7 +1155,12 @@ L.Control.Menubar = L.Control.extend({
} else if (id === 'about') {
this._map.showLOAboutDialog();
} else if (id === 'report-an-issue') {
- window.open('https://bugs.documentfoundation.org/enter_bug.cgi?product=LibreOffice%20Online', '_blank');
+ var bugLink = 'https://bugs.documentfoundation.org/enter_bug.cgi?product=LibreOffice%20Online';
+ if (window.ThisIsAMobileApp) {
+ window.postMobileMessage('HYPERLINK ' + bugLink);
+ } else {
+ window.open(bugLink, '_blank');
+ }
} else if (id === 'inserthyperlink') {
this._map.showHyperlinkDialog();
} else if (id === 'keyboard-shortcuts' || id === 'online-help') {
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 2d9e007f2..e6316188a 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -358,7 +358,7 @@ L.Map.include({
content.find('#product-name').text(productName);
var productString = _('This version of %productName is powered by');
var productNameWithURL;
- if (!window.ThisIsTheiOSApp)
+ if (!window.ThisIsAMobileApp)
productNameWithURL = '<a href="' + sanitizeUrl.sanitizeUrl(productURL) +
'" target="_blank">' + productName + '</a>';
else
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 5978d5e81..49bdc41d5 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -278,7 +278,7 @@ L.Socket = L.Class.extend({
this.WSDServer = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
var h = this.WSDServer.Hash;
if (parseInt(h,16).toString(16) === h.toLowerCase().replace(/^0+/, '')) {
- if (!window.ThisIsTheiOSApp) {
+ if (!window.ThisIsAMobileApp) {
h = '<a target="_blank" href="https://hub.libreoffice.org/git-online/' + h + '">' + h + '</a>';
}
$('#loolwsd-version').html(this.WSDServer.Version + ' (git hash: ' + h + ')');
@@ -302,7 +302,7 @@ L.Socket = L.Class.extend({
else if (textMsg.startsWith('lokitversion ')) {
var lokitVersionObj = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
h = lokitVersionObj.BuildId.substring(0, 7);
- if (!window.ThisIsTheiOSApp && parseInt(h,16).toString(16) === h.toLowerCase().replace(/^0+/, '')) {
+ if (!window.ThisIsAMobileApp && parseInt(h,16).toString(16) === h.toLowerCase().replace(/^0+/, '')) {
h = '<a target="_blank" href="https://hub.libreoffice.org/git-core/' + h + '">' + h + '</a>';
}
$('#lokit-version').html(lokitVersionObj.ProductName + ' ' +
More information about the Libreoffice-commits
mailing list