[feat] [autoupdater] Introduce a new channel, "Nylas Mail" + let N1

specify a preferred channel.
This commit is contained in:
Karim Hamidou 2017-01-11 14:29:50 -08:00
parent 4eb9c49a21
commit b880ee981d
2 changed files with 15 additions and 3 deletions

View file

@ -40,10 +40,17 @@ class UpdateChannelSection extends React.Component {
// HACK: Temporarily do not allow users to move on to the Salesforce channel.
// In the future we could implement this server-side via a "public" flag.
const allowedNames = ["stable", "beta"]
const allowedNames = ["nylas-mail", "beta"]
if (NylasEnv.config.get("salesforce")) {
allowedNames.push("salesforce");
}
// Also a HACK: show the stable channel only for people who are on the stable
// channel.
if (current.name === "stable") {
allowedNames.push("stable");
}
const allowed = available.filter(c => {
return allowedNames.includes(c.name) || c.name === current.name
});
@ -51,7 +58,10 @@ class UpdateChannelSection extends React.Component {
const displayNameForChannel = (channel) => {
if (channel.name === 'beta') {
return 'Beta (Unstable)'
} else if (channel.name === 'nylas-mail') {
return 'Nylas Mail (Stable)'
}
return channel.name[0].toUpperCase() + channel.name.substr(1)
}

View file

@ -4,6 +4,7 @@ import {remote} from 'electron';
import {LegacyEdgehillAPI} from 'nylas-exports';
const autoUpdater = remote.getGlobal('application').autoUpdateManager;
const preferredChannel = 'nylas-mail';
class UpdateChannelStore extends NylasStore {
constructor() {
@ -32,7 +33,7 @@ class UpdateChannelStore extends NylasStore {
LegacyEdgehillAPI.makeRequest({
method: 'GET',
path: `/update-channel`,
qs: autoUpdater.parameters(),
qs: Object.assign({preferredChannel: preferredChannel}, autoUpdater.parameters()),
json: true,
}).then(({current, available} = {}) => {
this._current = current || {name: "Edgehill API Not Available"};
@ -46,7 +47,8 @@ class UpdateChannelStore extends NylasStore {
LegacyEdgehillAPI.makeRequest({
method: 'POST',
path: `/update-channel`,
qs: Object.assign({channel: channelName}, autoUpdater.parameters()),
qs: Object.assign({channel: channelName,
preferredChannel: preferredChannel}, autoUpdater.parameters()),
json: true,
}).then(({current, available} = {}) => {
this._current = current || {name: "Edgehill API Not Available"};