mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
match ENUM style to others in project
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> (cherry picked from commit a871815) Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
efc68c078e
commit
b95ad701af
@ -39,18 +39,18 @@ export default React.createClass({
|
|||||||
console.log('checkForUpdate done, ', state);
|
console.log('checkForUpdate done, ', state);
|
||||||
|
|
||||||
// We will be replaced by NewVersionBar
|
// We will be replaced by NewVersionBar
|
||||||
if (state === updateStateEnum.Ready) return;
|
if (state === updateStateEnum.READY) return;
|
||||||
|
|
||||||
let done = true;
|
let done = true;
|
||||||
let message;
|
let message;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case updateStateEnum.Error:
|
case updateStateEnum.ERROR:
|
||||||
message = 'Error encountered when checking for an update';
|
message = 'Error encountered when checking for an update';
|
||||||
break;
|
break;
|
||||||
case updateStateEnum.NotAvailable:
|
case updateStateEnum.NOTAVAILABLE:
|
||||||
message = 'No update found';
|
message = 'No update found';
|
||||||
break;
|
break;
|
||||||
case updateStateEnum.Downloading:
|
case updateStateEnum.DOWNLOADING:
|
||||||
message = 'Update is being downloaded';
|
message = 'Update is being downloaded';
|
||||||
done = false;
|
done = false;
|
||||||
break;
|
break;
|
||||||
|
@ -143,12 +143,12 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||||||
|
|
||||||
const _onUpdateAvailable = function() {
|
const _onUpdateAvailable = function() {
|
||||||
electron.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
electron.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
||||||
deferred.resolve(updateStateEnum.Downloading);
|
deferred.resolve(updateStateEnum.DOWNLOADING);
|
||||||
}
|
}
|
||||||
|
|
||||||
const _onUpdateNotAvailable = function() {
|
const _onUpdateNotAvailable = function() {
|
||||||
electron.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
electron.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
||||||
deferred.resolve(updateStateEnum.NotAvailable);
|
deferred.resolve(updateStateEnum.NOTAVAILABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
electron.autoUpdater.once('update-available', _onUpdateAvailable);
|
electron.autoUpdater.once('update-available', _onUpdateAvailable);
|
||||||
@ -158,7 +158,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||||||
return deferred.promise.timeout(10000).catch(() => {
|
return deferred.promise.timeout(10000).catch(() => {
|
||||||
electron.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
electron.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
||||||
electron.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
electron.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
||||||
return updateStateEnum.Error;
|
return updateStateEnum.ERROR;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ import { _t } from 'matrix-react-sdk/lib/languageHandler';
|
|||||||
import Favico from 'favico.js';
|
import Favico from 'favico.js';
|
||||||
|
|
||||||
export const updateStateEnum = {
|
export const updateStateEnum = {
|
||||||
Error: -1,
|
ERROR: 'ERROR',
|
||||||
NotAvailable: 0,
|
NOTAVAILABLE: 'NOTAVAILABLE',
|
||||||
Downloading: 1,
|
DOWNLOADING: 'DOWNLOADING',
|
||||||
Ready: 2,
|
READY: 'READY',
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,12 +149,12 @@ export default class WebPlatform extends VectorBasePlatform {
|
|||||||
currentVersion: this.runningVersion,
|
currentVersion: this.runningVersion,
|
||||||
newVersion: ver,
|
newVersion: ver,
|
||||||
});
|
});
|
||||||
return updateStateEnum.Ready;
|
return updateStateEnum.READY;
|
||||||
}
|
}
|
||||||
return updateStateEnum.NotAvailable;
|
return updateStateEnum.NOTAVAILABLE;
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
console.error("Failed to poll for update", err);
|
console.error("Failed to poll for update", err);
|
||||||
return updateStateEnum.Error;
|
return updateStateEnum.ERROR;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user