From a363b98e38b7b3091cb2ba11cebed0cc53bedc6b Mon Sep 17 00:00:00 2001 From: Edgars Date: Tue, 10 Nov 2020 12:50:46 +0200 Subject: Nextcloud Talk: Hide unrelated notifications and fix notifications count `service.css` was updated to: - unhide contacts menu; - hide notifications that are not related to Nextcloud Talk; - hide "Dismiss all notifications" as this action would also dismiss hidden notifications. `webview.js` was updated to fix notifications (both direct and indirect) count retrieval. `README.md` was added. --- recipes/nextcloud-talk/README.md | 21 +++++++++++++++++++++ recipes/nextcloud-talk/package.json | 2 +- recipes/nextcloud-talk/service.css | 12 +++++++++--- recipes/nextcloud-talk/webview.js | 23 +++++++++++++++++------ 4 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 recipes/nextcloud-talk/README.md diff --git a/recipes/nextcloud-talk/README.md b/recipes/nextcloud-talk/README.md new file mode 100644 index 0000000..e6194c2 --- /dev/null +++ b/recipes/nextcloud-talk/README.md @@ -0,0 +1,21 @@ +# Ferdi recipe for Nextcloud Talk + +Nextcloud Talk - Chat, video & audio-conferencing using WebRTC. + +To add Nextcloud Talk to Ferdi, Nextcloud server address should be provided in the field "Custom server". + +## Credits + +This recipe is based on [`recipe-nextcloud-talk`](https://github.com/meetfranz/recipe-nextcloud-talk). + +## Links + +Ferdi: + +- [Ferdi](https://getferdi.com/) +- [Ferdi recipes](https://github.com/getferdi/recipes) + +Nextcloud: + +- [Nextcloud](https://nextcloud.com/) +- [Nextcloud Talk](https://apps.nextcloud.com/apps/spreed) diff --git a/recipes/nextcloud-talk/package.json b/recipes/nextcloud-talk/package.json index dcb5508..9a25f10 100644 --- a/recipes/nextcloud-talk/package.json +++ b/recipes/nextcloud-talk/package.json @@ -2,7 +2,7 @@ "id": "nextcloud-talk", "name": "Nextcloud Talk", "version": "1.0.2", - "description": "Nextcloud Talk", + "description": "Nextcloud Talk - chat, video & audio-conferencing using WebRTC", "main": "index.js", "author": "Stefan Malzner ", "license": "MIT", diff --git a/recipes/nextcloud-talk/service.css b/recipes/nextcloud-talk/service.css index 82dde75..f4f08bc 100644 --- a/recipes/nextcloud-talk/service.css +++ b/recipes/nextcloud-talk/service.css @@ -15,7 +15,13 @@ settings links and disable them */ display: none !important; } -/* Hide contacts in the top menu */ -#contactsmenu { - display: none; +/* Hide notifications that are not related to calendar */ +.notifications .notification-wrapper .notification {display: none;} +.notifications .notification-wrapper .notification[object_type="chat"], +.notifications .notification-wrapper .notification[object_type="room"] { + display: initial; } + +/* Hide "Dismiss all notifications" as this action will dismiss also hidden +notifications */ +.notification-wrapper .dismiss-all {display: none;} diff --git a/recipes/nextcloud-talk/webview.js b/recipes/nextcloud-talk/webview.js index c180d4d..42b1e49 100644 --- a/recipes/nextcloud-talk/webview.js +++ b/recipes/nextcloud-talk/webview.js @@ -6,13 +6,24 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = Franz => { +module.exports = Ferdi => { const getMessages = function getMessages() { - const direct = document.querySelectorAll('.app-navigation-entry-utils-counter.highlighted').length; - const indirect = document.querySelectorAll('.app-navigation-entry-utils-counter:not(.highlighted)').length; - Franz.setBadge(direct, indirect); + const direct = document.querySelector( + '.notifications .notification-wrapper' + ).querySelectorAll( + '.notification[object_type="chat"], .notification[object_type="room"' + ).length; + + var indirect = 0; + + document.querySelectorAll('.app-navigation-entry__counter').forEach( + function(counter) { + indirect += Number(counter.textContent) + } + ); + Ferdi.setBadge(direct, indirect); }; - Franz.loop(getMessages); - Franz.injectCSS(_path.default.join(__dirname, 'service.css')); + Ferdi.loop(getMessages); + Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); }; -- cgit v1.2.3-70-g09d2 From 8b7e59d64dc080f8b5c2d91b72aade4545d26c49 Mon Sep 17 00:00:00 2001 From: Edgars Date: Wed, 11 Nov 2020 10:14:02 +0200 Subject: Nextcloud Talk: Fine-tuning for `webview.js` `webview.js` was updated to get direct notifications count only when notification wrapper has been loaded. --- recipes/nextcloud-talk/webview.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/recipes/nextcloud-talk/webview.js b/recipes/nextcloud-talk/webview.js index 42b1e49..0dfb6ea 100644 --- a/recipes/nextcloud-talk/webview.js +++ b/recipes/nextcloud-talk/webview.js @@ -8,17 +8,22 @@ function _interopRequireDefault(obj) { module.exports = Ferdi => { const getMessages = function getMessages() { - const direct = document.querySelector( + let direct = 0; + const notificationWrapper = document.querySelector( '.notifications .notification-wrapper' - ).querySelectorAll( - '.notification[object_type="chat"], .notification[object_type="room"' - ).length; + ); + + if (notificationWrapper) { + direct = notificationWrapper.querySelectorAll( + '.notification[object_type="chat"], .notification[object_type="room"' + ).length; + } - var indirect = 0; + let indirect = 0; document.querySelectorAll('.app-navigation-entry__counter').forEach( function(counter) { - indirect += Number(counter.textContent) + indirect += Number(counter.textContent); } ); Ferdi.setBadge(direct, indirect); -- cgit v1.2.3-70-g09d2 From dc454f374286536719fd7c7e6f5ed9078de9038d Mon Sep 17 00:00:00 2001 From: Edgars Date: Wed, 11 Nov 2020 10:14:32 +0200 Subject: Nextcloud Talk: `package.json` was updated to increase version to 1.0.3 --- recipes/nextcloud-talk/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/nextcloud-talk/package.json b/recipes/nextcloud-talk/package.json index 9a25f10..abbdd5a 100644 --- a/recipes/nextcloud-talk/package.json +++ b/recipes/nextcloud-talk/package.json @@ -1,7 +1,7 @@ { "id": "nextcloud-talk", "name": "Nextcloud Talk", - "version": "1.0.2", + "version": "1.0.3", "description": "Nextcloud Talk - chat, video & audio-conferencing using WebRTC", "main": "index.js", "author": "Stefan Malzner ", -- cgit v1.2.3-70-g09d2