Fix riot-desktop manual update check getting stuck on Downloading...

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-06-07 13:18:34 +01:00
parent 6875ffe0d5
commit 34dab73150
1 changed files with 11 additions and 7 deletions

View File

@ -44,7 +44,7 @@ import {randomString} from "matrix-js-sdk/src/randomstring";
import {Action} from "matrix-react-sdk/src/dispatcher/actions"; import {Action} from "matrix-react-sdk/src/dispatcher/actions";
import {ActionPayload} from "matrix-react-sdk/src/dispatcher/payloads"; import {ActionPayload} from "matrix-react-sdk/src/dispatcher/payloads";
import {showToast as showUpdateToast} from "matrix-react-sdk/src/toasts/UpdateToast"; import {showToast as showUpdateToast} from "matrix-react-sdk/src/toasts/UpdateToast";
import { CheckUpdatesPayload } from 'matrix-react-sdk/src/dispatcher/payloads/CheckUpdatesPayload'; import {CheckUpdatesPayload} from "matrix-react-sdk/src/dispatcher/payloads/CheckUpdatesPayload";
const ipcRenderer = window.ipcRenderer; const ipcRenderer = window.ipcRenderer;
const isMac = navigator.platform.toUpperCase().includes('MAC'); const isMac = navigator.platform.toUpperCase().includes('MAC');
@ -228,8 +228,8 @@ export default class ElectronPlatform extends VectorBasePlatform {
rageshake.flush(); rageshake.flush();
}); });
ipcRenderer.on('ipcReply', this._onIpcReply.bind(this)); ipcRenderer.on('ipcReply', this._onIpcReply);
ipcRenderer.on('update-downloaded', this.onUpdateDownloaded.bind(this)); ipcRenderer.on('update-downloaded', this.onUpdateDownloaded);
ipcRenderer.on('preferences', () => { ipcRenderer.on('preferences', () => {
dis.fire(Action.ViewUserSettings); dis.fire(Action.ViewUserSettings);
@ -275,11 +275,15 @@ export default class ElectronPlatform extends VectorBasePlatform {
return this._ipcCall('getConfig'); return this._ipcCall('getConfig');
} }
async onUpdateDownloaded(ev, {releaseNotes, releaseName}) { onUpdateDownloaded = async (ev, {releaseNotes, releaseName}) => {
dis.dispatch<CheckUpdatesPayload>({
action: Action.CheckUpdates,
status: UpdateCheckStatus.Ready,
});
if (this.shouldShowUpdate(releaseName)) { if (this.shouldShowUpdate(releaseName)) {
showUpdateToast(await this.getAppVersion(), releaseName, releaseNotes); showUpdateToast(await this.getAppVersion(), releaseName, releaseNotes);
} }
} };
getHumanReadableName(): string { getHumanReadableName(): string {
return 'Electron Platform'; // no translation required: only used for analytics return 'Electron Platform'; // no translation required: only used for analytics
@ -426,7 +430,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
}); });
} }
_onIpcReply(ev, payload) { _onIpcReply = (ev, payload) => {
if (payload.id === undefined) { if (payload.id === undefined) {
console.warn("Ignoring IPC reply with no ID"); console.warn("Ignoring IPC reply with no ID");
return; return;
@ -444,7 +448,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
} else { } else {
callbacks.resolve(payload.reply); callbacks.resolve(payload.reply);
} }
} };
getEventIndexingManager(): BaseEventIndexManager | null { getEventIndexingManager(): BaseEventIndexManager | null {
return this.eventIndexManager; return this.eventIndexManager;