diff options
Diffstat (limited to 'recipes/toggl')
-rw-r--r-- | recipes/toggl/package.json | 2 | ||||
-rw-r--r-- | recipes/toggl/webview-unsafe.js | 11 | ||||
-rw-r--r-- | recipes/toggl/webview.js | 12 |
3 files changed, 23 insertions, 2 deletions
diff --git a/recipes/toggl/package.json b/recipes/toggl/package.json index f40b35e..09e5b64 100644 --- a/recipes/toggl/package.json +++ b/recipes/toggl/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "toggl", | 2 | "id": "toggl", |
3 | "name": "toggl", | 3 | "name": "toggl", |
4 | "version": "1.1.0", | 4 | "version": "1.2.0", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://www.toggl.com/app/timer", | 7 | "serviceURL": "https://www.toggl.com/app/timer", |
diff --git a/recipes/toggl/webview-unsafe.js b/recipes/toggl/webview-unsafe.js new file mode 100644 index 0000000..24b139f --- /dev/null +++ b/recipes/toggl/webview-unsafe.js | |||
@@ -0,0 +1,11 @@ | |||
1 | // only try to update badge once Ferdi API has finished loading | ||
2 | if (ferdi != undefined && ferdi.setBadge != undefined) { | ||
3 | var timerRunning = (window.toggl != undefined) && !!(window.toggl.store.getState().view.timer.timeEntry.start); | ||
4 | |||
5 | if (timerRunning) { | ||
6 | // Treat running timer as a "non-direct" notification (default blue dot instead of urgent red "1") | ||
7 | ferdi.setBadge(0, 1); | ||
8 | } else { | ||
9 | ferdi.setBadge(0); | ||
10 | } | ||
11 | } | ||
diff --git a/recipes/toggl/webview.js b/recipes/toggl/webview.js index 23607bd..199700a 100644 --- a/recipes/toggl/webview.js +++ b/recipes/toggl/webview.js | |||
@@ -1 +1,11 @@ | |||
1 | module.exports = Ferdi => Ferdi; | 1 | const _path = _interopRequireDefault(require('path')); |
2 | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
4 | |||
5 | module.exports = Ferdi => { | ||
6 | const updateBadge = function updateBadge() { | ||
7 | Ferdi.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js')); | ||
8 | }; | ||
9 | |||
10 | Ferdi.loop(updateBadge); | ||
11 | }; | ||