mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
fix type electron vs remote
don't break when running a non Squirrel Windows build that has an update url Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
5981887705
commit
93f148fca3
@ -142,22 +142,30 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||||||
const deferred = q.defer();
|
const deferred = q.defer();
|
||||||
|
|
||||||
const _onUpdateAvailable = function() {
|
const _onUpdateAvailable = function() {
|
||||||
electron.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
remote.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
||||||
|
remote.autoUpdater.removeListener('error', _onError);
|
||||||
deferred.resolve(updateStateEnum.DOWNLOADING);
|
deferred.resolve(updateStateEnum.DOWNLOADING);
|
||||||
}
|
}
|
||||||
|
|
||||||
const _onUpdateNotAvailable = function() {
|
const _onUpdateNotAvailable = function() {
|
||||||
electron.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
remote.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
||||||
|
remote.autoUpdater.removeListener('error', _onError);
|
||||||
deferred.resolve(updateStateEnum.NOTAVAILABLE);
|
deferred.resolve(updateStateEnum.NOTAVAILABLE);
|
||||||
}
|
}
|
||||||
|
const _onError = function() {
|
||||||
|
remote.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
||||||
|
remote.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
||||||
|
deferred.resolve(updateStateEnum.ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
electron.autoUpdater.once('update-available', _onUpdateAvailable);
|
remote.autoUpdater.once('update-available', _onUpdateAvailable);
|
||||||
electron.autoUpdater.once('update-not-available', _onUpdateNotAvailable);
|
remote.autoUpdater.once('update-not-available', _onUpdateNotAvailable);
|
||||||
|
remote.autoUpdater.once('error', _onError);
|
||||||
|
|
||||||
electron.ipcRenderer.send('checkForUpdates');
|
remote.ipcRenderer.send('checkForUpdates');
|
||||||
return deferred.promise.timeout(10000).catch(() => {
|
return deferred.promise.timeout(10000).catch(() => {
|
||||||
electron.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
remote.autoUpdater.removeListener('update-not-available', _onUpdateNotAvailable);
|
||||||
electron.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
remote.autoUpdater.removeListener('update-available', _onUpdateAvailable);
|
||||||
|
remote.autoUpdater.removeListener('error', _onError);
|
||||||
return updateStateEnum.TIMEOUT;
|
return updateStateEnum.TIMEOUT;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user