plugins-legacy icon indicating copy to clipboard operation
plugins-legacy copied to clipboard

Added support for asana

Open enriquebrgn opened this issue 7 years ago • 1 comments

Added asana plugin.

enriquebrgn avatar Apr 27 '17 01:04 enriquebrgn

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'));
}

tayvano avatar Aug 25 '17 04:08 tayvano