diff options
author | 2021-11-20 21:49:47 +0100 | |
---|---|---|
committer | 2021-11-21 02:19:47 +0530 | |
commit | ada14e8b8e45d6246bd8b7b273c044b215365377 (patch) | |
tree | 3ae5d0aad645b8705be3c7dce3a2b1cb37e233c6 /recipes/toggl/webview-unsafe.js | |
parent | Revamped github Issue templates (new yml syntax) [skip ci] (diff) | |
download | ferdium-recipes-ada14e8b8e45d6246bd8b7b273c044b215365377.tar.gz ferdium-recipes-ada14e8b8e45d6246bd8b7b273c044b215365377.tar.zst ferdium-recipes-ada14e8b8e45d6246bd8b7b273c044b215365377.zip |
Toggl recipe: Display 'unread' badge when a timer is running (#767)
Diffstat (limited to 'recipes/toggl/webview-unsafe.js')
-rw-r--r-- | recipes/toggl/webview-unsafe.js | 11 |
1 files changed, 11 insertions, 0 deletions
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 | } | ||