From 911d1ded846165a4b420efa2b58668ad27c9f2c7 Mon Sep 17 00:00:00 2001 From: Amine Date: Wed, 22 Apr 2020 07:13:51 +0000 Subject: Use GitHub notifications center and direct notifications (#133) --- uncompressed/github/package.json | 8 ++++---- uncompressed/github/webview.js | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'uncompressed') diff --git a/uncompressed/github/package.json b/uncompressed/github/package.json index 38ec914..535c1d9 100644 --- a/uncompressed/github/package.json +++ b/uncompressed/github/package.json @@ -1,15 +1,15 @@ { "id": "github", "name": "GitHub", - "version": "1.0.4", + "version": "2.0.0", "description": "GitHub", "main": "index.js", - "author": "Sudhir Ganesan", + "author": "Amine Mouafik", "license": "MIT", "config": { - "serviceURL": "https://github.com/", + "serviceURL": "https://github.com/notifications", "hasNotificationSound": false, - "hasDirectMessages": false, + "hasDirectMessages": true, "hasIndirectMessages": true } } diff --git a/uncompressed/github/webview.js b/uncompressed/github/webview.js index 0543d1f..c3e8729 100644 --- a/uncompressed/github/webview.js +++ b/uncompressed/github/webview.js @@ -2,9 +2,19 @@ module.exports = Franz => { const getMessages = function getMessages() { - Franz.setBadge(document.querySelector('[class*="mail-status unread"]') !== null ? 1 : 0); + const directCountElement = document.querySelector('.filter-list .count'); + const indirectCountElement = document.querySelector('[class*="mail-status unread"]') + let directCount, indirectCount + if (directCountElement) { + directCount = parseInt(directCountElement.innerHTML, 10); + } else { + if (indirectCountElement) { + indirectCount = 1; + } + } + Franz.setBadge(directCount, indirectCount); }; - Franz.loop(0, getMessages); + Franz.loop(getMessages); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJnaXRodWIvd2Vidmlldy5qcyIsInNvdXJjZXNDb250ZW50IjpbXX0= \ No newline at end of file -- cgit v1.2.3-70-g09d2