plugins-legacy
plugins-legacy copied to clipboard
Added support for asana
Added asana plugin.
FWIW here is my webview.js. oauth works and alerts if you have new notifs (I think?). Mostly sharing for the oauth. Probably should have commented wtf I was doing when I created this. 😒
const path = require('path');
const icon = 'https://asanatraining.com/wp-content/uploads/2016/07/Asana-Logo.png'
var initialUnreadNotifs = 0;
module.exports = (Franz, options) => {
const getMessages = () => {
const googleButton = document.getElementById('google_auth_button');
if (googleButton) {
googleButton.onclick = function(){ return Dialog.Login.loginWithGoogle(true, 'https://app.asana.com/-/oauth2callback', 'https:\/\/app.asana.com\/') } ;
}
const inbox = document.querySelectorAll('.has-newNotifications');
const unreadNotifs = inbox.length;
if (unreadNotifs != initialUnreadNotifs) {
new windowNotifications( unreadNotifs + ' New Mangrove Asana Item', {
body : 'Asana',
icon : icon,
requireInteraction : true
})
initialUnreadNotifs = unreadNotifs
}
Franz.setBadge(unreadNotifs);
}
Franz.loop(getMessages);
Franz.injectCSS(path.join(__dirname, 'css', 'franz.css'));
}