Skip to content

Commit

Permalink
first version
Browse files Browse the repository at this point in the history
  • Loading branch information
Adondriel committed Mar 3, 2020
1 parent 52638a9 commit 9d5a34b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
// just pass through Franz
module.exports = Franz => Franz;
"use strict";

// module.exports = Franz => Franz;
module.exports = Franz => class Gmail extends Franz {
overrideUserAgent() {
const userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36";

return userAgent;
}
};
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
"description": "Gmail",
"main": "index.js",
"author": "Stefan Malzner <[email protected]>",
"contributors": ["Adam Pine <[email protected]>"],
"license": "MIT",
"repository": "https://github.com/meetfranz/recipe-gmail",
"config": {
"serviceURL": "https://mail.google.com"
"serviceURL": "https://mail.google.com",
"serviceName": "Gmail",
"hasNotificationSound": true,
"message": "You must login before you close Franz to ensure this service is able to be configured (otherwise it goes to the wrong url)"
}
}
16 changes: 9 additions & 7 deletions webview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import path from 'path';
"use strict";

module.exports = (Franz) => {
var _path = _interopRequireDefault(require("path"));

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

module.exports = Franz => {
const getMessages = function getMessages() {
let count = 0;

Expand All @@ -10,17 +14,15 @@ module.exports = (Franz) => {
}
}

// Just incase we don't end up with a number, set it back to zero (parseInt can return NaN)
count = parseInt(count, 10);

if (isNaN(count)) {
count = 0;
}

// set Franz badge
Franz.setBadge(count);
};

Franz.injectCSS(path.join(__dirname, 'service.css'));
// check for new messages every second and update Franz badge
Franz.injectCSS(_path.default.join(__dirname, 'service.css'));
Franz.loop(getMessages);
};
};

0 comments on commit 9d5a34b

Please sign in to comment.