diff --git a/lib/learn-ide.js b/lib/learn-ide.js index 0d670f9..2233568 100644 --- a/lib/learn-ide.js +++ b/lib/learn-ide.js @@ -112,17 +112,32 @@ export default { 'learn-ide:clear-terminal': () => this.term.send(' ') })); - atom.config.onDidChange(`${name}.terminalColors.basic`, () => colors.apply()) - - atom.config.onDidChange(`${name}.terminalColors.ansi`, () => colors.apply()) - - atom.config.onDidChange(`${name}.terminalColors.json`, ({newValue}) => { - colors.parseJSON(newValue); - }); - - atom.config.onDidChange(`${name}.notifier`, ({newValue}) => { - newValue ? this.activateNotifier() : this.notifier.deactivate() - }); + this.subscriptions.add( + atom.config.onDidChange(`${name}.bleedingUpdates`, ({newValue}) => { + if (!newValue) { localStorage.set('didUnsubscribeFromBleedingUpdates', Date.now()) } + updater.checkForUpdate() + }) + ) + + this.subscriptions.add( + atom.config.onDidChange(`${name}.notifier`, ({newValue}) => { + newValue ? this.activateNotifier() : this.notifier.deactivate() + }) + ) + + this.subscriptions.add( + atom.config.onDidChange(`${name}.terminalColors.basic`, () => colors.apply()) + ) + + this.subscriptions.add( + atom.config.onDidChange(`${name}.terminalColors.ansi`, () => colors.apply()) + ) + + this.subscriptions.add( + atom.config.onDidChange(`${name}.terminalColors.json`, ({newValue}) => { + colors.parseJSON(newValue); + }) + ) var openPath = localStorage.get('learnOpenLabOnActivation'); if (openPath) { diff --git a/lib/updater.js b/lib/updater.js index 6f1fb04..a860e53 100644 --- a/lib/updater.js +++ b/lib/updater.js @@ -10,7 +10,11 @@ import {learnCo} from './config' import {name} from '../package.json' var helpCenterUrl = `${learnCo}/ide/faq`; -var latestVersionUrl = `${learnCo}/api/v1/learn_ide/latest_version`; + +function latestVersionUrl() { + var bleedingUpdates = atom.config.get(`${name}.bleedingUpdates`); + return bleedingUpdates ? `${learnCo}/api/v1/learn_ide/bleeding_version` : `${learnCo}/api/v1/learn_ide/latest_version` +} export default { autoCheck() { @@ -79,7 +83,7 @@ export default { }, _fetchLatestVersionData() { - return fetch(latestVersionUrl).then(latestVersionData => { + return fetch(latestVersionUrl()).then(latestVersionData => { this.latestVersionData = latestVersionData; return this.latestVersionData; }); @@ -100,6 +104,10 @@ export default { _shouldUpdate(latestVersion) { var {version} = require('../package.json'); + if (localStorage.remove('didUnsubscribeFromBleedingUpdates')) { + return !semver.eq(latestVersion, version) + } + if (semver.gt(latestVersion, version)) { return true; } diff --git a/package.json b/package.json index 93ea875..8f1599a 100644 --- a/package.json +++ b/package.json @@ -51,15 +51,22 @@ "underscore-plus": "^1.6.6" }, "configSchema": { - "notifier": { + "bleedingUpdates": { "order": 0, "type": "boolean", + "default": false, + "title": "Subscribe to Bleeding Updates", + "description": "Recieve update notifications as beta and early releases of the Learn IDE become available. Learn more on the [help center](https://learn.co/ide/bleeding)." + }, + "notifier": { + "order": 1, + "type": "boolean", "default": true, "title": "Learn Status Notifications", - "description": "Receive desktop notifications that correspond to the lights on Learn.co" + "description": "Receive desktop notifications that correspond to the lights on Learn.co." }, "terminalColors": { - "order": 1, + "order": 2, "type": "object", "properties": { "basic": {