Exemplo n.º 1
0
    .then(shouldDonate => {
      if (shouldDonate) {
        browser.browserAction.setBadgeBackgroundColor({
          color: 'ForestGreen',
        });
        browser.browserAction.setBadgeText({ text: '🔔' });
        browser.browserAction.setTitle({
          title: 'Thankful: Reminder to donate',
        });

        if (new Date() - lastToast > toastInterval) {
          // TODO: Add the logo to the notification
          browser.notifications.create({
            type: 'basic',
            title: 'Thankful: Reminder to donate 🔔',
            message:
              "You haven't donated in a while, click here to go to the donation dashboard",
          });

          lastToast = new Date();
        }
      } else {
        browser.browserAction.setBadgeText({ text: '' });
        browser.browserAction.setTitle({ title: 'Thankful' });
      }
    })
Exemplo n.º 2
0
export function sendRecordNotification(command, target, value) {
  if (UiState.options.recordNotifications) {
    // In Chrome, notification.create must have "iconUrl" key in notificationOptions
    browser.notifications.create({
      "type": "basic",
      "iconUrl": "/icons/icon128.png",
      "title": "Command was recorded",
      "message": `command: ${command} \ntarget: ${tacPreprocess(target[0][0])} \nvalue: ${value}`
    }).then(id => {
      setTimeout(function() {
        browser.notifications.clear(id);
      }, 1500);
    });
  }
}
Exemplo n.º 3
0
 setTimeout(function() {
   browser.notifications.clear(id);
 }, 1500);
Exemplo n.º 4
0
    this._logError(error, "Unable to add this item to Trello. It doesn't look like a bug.");
  },

  onTrelloError(error) {
    this._logError(error, "Error communicating with Trello, check the extension console for more information.");
  },

  _logError(error, userMessage) {
    console.error(error);
    this._showNotification("Error", userMessage);
  },

  _showNotification(title, message) {
    browser.notifications.create(null, {
      "type": "basic",
      "iconUrl": browser.extension.getURL("icons/icon-32.png"),
      "title": title,
      "message": message
    });
  },

  trelloLogout() {
    this.loggedIn = false;
    this._purgeSelect(this.listsSelect);
    this._purgeSelect(this.boardsSelect);
    this.addBugEnabled = false;
    Trello.deauthorize();
  },

  _purgeSelect(select) {
    for (let option of [...select.options]) {
      // Keep the first option