[Libreoffice-commits] online.git: 2 commits - loleaflet/html loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Sep 18 15:09:29 UTC 2018
loleaflet/html/loleaflet.html.m4 | 3 +++
loleaflet/src/core/Socket.js | 21 ++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
New commits:
commit 7ea91e1c6b236da7cd59ccb6e8e2aa1f1e75f661
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Sep 18 18:07:42 2018 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Sep 18 18:07:59 2018 +0300
More hacking on the FakeWebSocket for the iOS app
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 5dc77629f..7d4cf0152 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -1,4 +1,4 @@
-/* -*- js-indent-level: 8 -*- */
+/* -*- js-indent-level: 8; fill-column: 100 -*- */
/*
* L.Socket contains methods for the communication with the server
*/
@@ -14,7 +14,7 @@ function FakeWebSocket() {
this.readyState = 1;
this.id = window.fakeWebSocketCounter++;
this.sendCounter = 0;
- console.log('>>>>>> Created FakeWebSocket#' + this.id);
+ window.webkit.messageHandlers.debug.postMessage('>>>>> Created FakeWebSocket #' + this.id);
this.onclose = function() {
};
this.onerror = function() {
@@ -26,11 +26,11 @@ function FakeWebSocket() {
}
FakeWebSocket.prototype.close = function() {
- console.log('>>>>>> Closing FakeWebSocket#' + this.id);
+ window.webkit.messageHandlers.debug.postMessage('>>>>>> Closing FakeWebSocket#' + this.id);
}
FakeWebSocket.prototype.send = function(data) {
- console.log('>>>>>> Sending data on FakeWebSocket#' + this.id + ' (' + this.sendCounter + '): "' + data + '"');
+ window.webkit.messageHandlers.debug.postMessage('>>>>>> Sending data on FakeWebSocket#' + this.id + ' (' + this.sendCounter + '): "' + data + '"');
this.sendCounter++;
window.webkit.messageHandlers.lool.postMessage(data, '*');
}
@@ -91,7 +91,17 @@ L.Socket = L.Class.extend({
this.socket.onopen = L.bind(this._onSocketOpen, this);
this.socket.onmessage = L.bind(this._onMessage, this);
this.socket.binaryType = 'arraybuffer';
-
+ if (window.ThisIsTheiOSApp) {
+ // This corresponds to the initial GET request when creating a WebSocket
+ // connection and tells the app's code that it is OK to start invoking
+ // TheFakeWebSocket's onmessage handler. Should we also include the
+ // map.options.doc, as in the websocketURI above? On the other hand, the app
+ // code that handles this special message knows the document to be edited
+ // anyway, and can send it on as necessary to the Online code.
+ window.webkit.messageHandlers.lool.postMessage('HULLO', '*');
+ // A FakeWebSocket is immediately open.
+ this.socket.onopen();
+ }
if (map.options.docParams.access_token && parseInt(map.options.docParams.access_token_ttl)) {
var tokenExpiryWarning = 900 * 1000; // Warn when 15 minutes remain
clearTimeout(this._accessTokenExpireTimeout);
@@ -186,6 +196,7 @@ L.Socket = L.Class.extend({
_onSocketOpen: function () {
console.debug('_onSocketOpen:');
+ window.webkit.messageHandlers.debug.postMessage('>>>>>> _onSocketOpen');
this._map._serverRecycling = false;
this._map._documentIdle = false;
commit e1978621f31855aa5486688abeebcd18dc739792
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Sep 18 11:43:40 2018 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Sep 18 18:07:59 2018 +0300
No need for WOPI stuff in iOS app
diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index 4322121d4..88b33009a 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -11,6 +11,7 @@ define([_foreachq],[ifelse([$#],[3],[],[define([$1],[$4])$2[]$0([$1],[$2],shift(
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
+ifelse(IOSAPP,[],
<script>
// Start listening for Host_PostmessageReady message and save the
// result for future
@@ -28,6 +29,8 @@ define([_foreachq],[ifelse([$#],[3],[],[define([$1],[$4])$2[]$0([$1],[$2],shift(
};
window.addEventListener('message', PostMessageReadyListener, false);
</script>
+)dnl
+
ifelse(IOSAPP,[true],
ifelse(DEBUG,[true],
foreachq([fileCSS],[LOLEAFLET_CSS],[<link rel="stylesheet" href="fileCSS" />
More information about the Libreoffice-commits
mailing list