diff options
author | Mario <mario@mariovavti.com> | 2021-08-27 18:41:52 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-08-27 18:41:52 +0000 |
commit | 5eaabbdb18b392478b6782fb580f22b3a1e666f2 (patch) | |
tree | ef72556613187c611f6b131210621cc4a11a108a /view/js | |
parent | d24fbb51fcb2f55ffa4c492d1264e394c361b687 (diff) | |
download | volse-hubzilla-5eaabbdb18b392478b6782fb580f22b3a1e666f2.tar.gz volse-hubzilla-5eaabbdb18b392478b6782fb580f22b3a1e666f2.tar.bz2 volse-hubzilla-5eaabbdb18b392478b6782fb580f22b3a1e666f2.zip |
slightly improve push notification handling for HQ and some app descriptions
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/main.js | 24 | ||||
-rw-r--r-- | view/js/mod_hq.js | 8 |
2 files changed, 19 insertions, 13 deletions
diff --git a/view/js/main.js b/view/js/main.js index d121913ea..f54dbf593 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -237,6 +237,13 @@ $(document).ready(function() { cache_next_page(); }); + $(document).on('hz:handleNetworkNotificationsItems', function(e, obj) { + push_notification( + obj.name, + $('<p>' + obj.message + '</p>').text(), + obj.b64mid + ); + }); }); function getConversationSettings() { @@ -899,7 +906,7 @@ function prepareLiveUpdate(b64mid, notify_id) { if (module == 'hq') { liveUpdate(notify_id); } - if (module == 'display'|| module == 'dm') { + if (module == 'display') { liveUpdate(); } } @@ -1728,16 +1735,23 @@ function push_notification_request(e) { } -function push_notification(title, body, href) { +function push_notification(title, body, b64mid) { let options = { body: body, - data: href, - icon: '/images/hz-64.png', + data: b64mid, + icon: '/images/app/hz-96.png', silent: false } let n = new Notification(title, options); n.onclick = function (e) { - window.location.href = e.target.data; + if(module === 'hq') { + prepareLiveUpdate(e.target.data); + } + else { + window.location.href = baseurl + '/hq/' + e.target.data; + } } } + + diff --git a/view/js/mod_hq.js b/view/js/mod_hq.js index ad77e0af0..5f8430b4d 100644 --- a/view/js/mod_hq.js +++ b/view/js/mod_hq.js @@ -14,12 +14,4 @@ $(document).ready(function() { $('#note-text').focus(); }); - $(document).on('hz:handleNetworkNotificationsItems', function(e, obj) { - push_notification( - obj.name, - $('<p>' + obj.message + '</p>').text(), - baseurl + '/hq/' + obj.b64mid - ); - }); - }); |