Merge pull request #13946 from vector-im/t3chguy/remember-updates

Fix riot-desktop manual update check getting stuck on Downloading...
pull/13952/head
Michael Telatynski 2020-06-08 09:44:22 +01:00 committed by GitHub
commit 3bc6b08cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {ActionPayload} from "matrix-react-sdk/src/dispatcher/payloads";
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 isMac = navigator.platform.toUpperCase().includes('MAC');
@ -228,8 +228,8 @@ export default class ElectronPlatform extends VectorBasePlatform {
rageshake.flush();
});
ipcRenderer.on('ipcReply', this._onIpcReply.bind(this));
ipcRenderer.on('update-downloaded', this.onUpdateDownloaded.bind(this));
ipcRenderer.on('ipcReply', this._onIpcReply);
ipcRenderer.on('update-downloaded', this.onUpdateDownloaded);
ipcRenderer.on('preferences', () => {
dis.fire(Action.ViewUserSettings);
@ -275,11 +275,15 @@ export default class ElectronPlatform extends VectorBasePlatform {
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)) {
showUpdateToast(await this.getAppVersion(), releaseName, releaseNotes);
}
}
};
getHumanReadableName(): string {
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) {
console.warn("Ignoring IPC reply with no ID");
return;
@ -444,7 +448,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
} else {
callbacks.resolve(payload.reply);
}
}
};
getEventIndexingManager(): BaseEventIndexManager | null {
return this.eventIndexManager;