Permalink
Browse files

Notify about LiveStyle campaign

  • Loading branch information...
1 parent 838f206 commit f290181720542ca068c6a9e2b7c8ae84aee6232a @sergeche sergeche committed Aug 23, 2016
Showing with 26 additions and 19 deletions.
  1. +1 −17 index.js
  2. +2 −2 lib/analyzer/config.js
  3. +23 −0 lib/analyzer/widget/registry.js
View
@@ -141,7 +141,7 @@ module.exports.config = {
title: 'Debug Mode',
description: 'Makes excessive logging into DevTools console, helps in finding bugs in plugin',
type: 'boolean',
- default: true
+ default: false
},
analyzer: require('./lib/analyzer/config')
};
@@ -245,22 +245,6 @@ function setupAnalyzer() {
}
})
);
-
- displayLiveStyleNotification();
- }
-}
-
-/**
- * Display notification about available LiveStyle Analyzer
- * @return {[type]} [description]
- */
-function displayLiveStyleNotification() {
- let key = `${pkg.name}.analyzer.notify`;
- if (atom.config.get(key)) {
- atom.notifications.addInfo(`**LiveStyle can help you with LESS and SCSS!**<br>A new [LiveStyle Analyzer experimental UI](https://github.com/livestyle/atom#livestyle-analyzer) displays instant code hints for LESS and SCSS stylesheets.`, {
- dismissable: true
- });
- atom.config.set(key, false);
}
}
@@ -26,10 +26,10 @@ module.exports = {
description: 'Automatically display resolved CSS selector tooltip when caret moves inside selector token. When disabled, use `livestyle:show-widget` command to display tooltip.',
order: 3
},
- notify: {
+ notifyCampaign: {
type: 'boolean',
default: true,
- title: 'Notify about available LiveStyle Analyzer',
+ title: 'Notify about LiveStyle Analyzer campaign',
description: 'Displays LiveStyle Analyzer notification when new window is opened. This config setting is automatically set to `false` after a new window is created and the notification is shown.',
order: 4
}
@@ -6,6 +6,7 @@
'use strict';
const hasWidgetClass = 'has-livestyle-widget';
+const pkg = require('../../../package.json');
module.exports = class WidgetRegistry {
constructor() {
@@ -22,6 +23,7 @@ module.exports = class WidgetRegistry {
widgets.add(widget);
atom.views.getView(editor).classList.add(hasWidgetClass);
widget.onDidDestroy(() => this.delete(editor, widget));
+ widget.onDidShow(notifyPromo);
}
}
@@ -64,3 +66,24 @@ module.exports = class WidgetRegistry {
// this._registry = null;
}
};
+
+
+var promoNotificationTimer = null;
+function notifyPromo() {
+ if (!promoNotificationTimer) {
+ promoNotificationTimer = setTimeout(displayPromoNotification, 15000);
+ }
+}
+
+/**
+ * Display notification about LiveStyle campaign
+ */
+function displayPromoNotification() {
+ let key = `${pkg.name}.analyzer.notifyCampaign`;
+ if (atom.config.get(key)) {
+ atom.notifications.addInfo(`**Do you like LiveStyle Analyzer?**<br>Help make this project better by supporting [crowdfunding campaign](https://www.indiegogo.com/projects/livestyle-analyzer/).`, {
+ dismissable: true
+ });
+ atom.config.set(key, false);
+ }
+}

0 comments on commit f290181

Please sign in to comment.