Skip to content

Commit

Permalink
Add Skiff Mail recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
victorbnl committed Jul 19, 2023
1 parent e2f889c commit 5c2409c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions recipes/skiff-mail/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions recipes/skiff-mail/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = Ferdium => Ferdium;
9 changes: 9 additions & 0 deletions recipes/skiff-mail/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "skiff-mail",
"name": "Skiff Mail",
"version": "1.0.0",
"license": "MIT",
"config": {
"serviceURL": "https://app.skiff.com/mail/inbox"
}
}
17 changes: 17 additions & 0 deletions recipes/skiff-mail/webview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const _path = _interopRequireDefault(require('path'));

function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}

module.exports = Ferdium => {
const getMessages = () => {
const element = document.querySelector('div[href="/mail/inbox"]');
const matches = element.textContent.match(/\d+/);
const unreadCount = Ferdium.safeParseInt(matches ? matches[0] : 0);
Ferdium.setBadge(unreadCount);
};
Ferdium.loop(getMessages);

Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
};

0 comments on commit 5c2409c

Please sign in to comment.