forked from matrix/element-web
Merge pull request #13776 from vector-im/t3chguy/toasts3_2
Replace New Version Bar with a Toast
This commit is contained in:
commit
c68f35060a
|
@ -42,6 +42,7 @@ import React from "react";
|
||||||
import {randomString} from "matrix-js-sdk/src/randomstring";
|
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";
|
||||||
|
|
||||||
const ipcRenderer = window.ipcRenderer;
|
const ipcRenderer = window.ipcRenderer;
|
||||||
const isMac = navigator.platform.toUpperCase().includes('MAC');
|
const isMac = navigator.platform.toUpperCase().includes('MAC');
|
||||||
|
@ -275,12 +276,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
async onUpdateDownloaded(ev, updateInfo) {
|
async onUpdateDownloaded(ev, updateInfo) {
|
||||||
dis.dispatch({
|
showUpdateToast(await this.getAppVersion(), updateInfo, updateInfo.releaseNotes);
|
||||||
action: 'new_version',
|
|
||||||
currentVersion: await this.getAppVersion(),
|
|
||||||
newVersion: updateInfo,
|
|
||||||
releaseNotes: updateInfo.releaseNotes,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getHumanReadableName(): string {
|
getHumanReadableName(): string {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import request from 'browser-request';
|
||||||
import dis from 'matrix-react-sdk/src/dispatcher/dispatcher';
|
import dis from 'matrix-react-sdk/src/dispatcher/dispatcher';
|
||||||
import { _t } from 'matrix-react-sdk/src/languageHandler';
|
import { _t } from 'matrix-react-sdk/src/languageHandler';
|
||||||
import {Room} from "matrix-js-sdk/src/models/room";
|
import {Room} from "matrix-js-sdk/src/models/room";
|
||||||
|
import { showToast as showUpdateToast, hideToast as hideUpdateToast } from "matrix-react-sdk/src/toasts/UpdateToast";
|
||||||
|
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
import UAParser from 'ua-parser-js';
|
import UAParser from 'ua-parser-js';
|
||||||
|
@ -135,15 +136,17 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
return this._getVersion().then((ver) => {
|
return this._getVersion().then((ver) => {
|
||||||
if (this.runningVersion === null) {
|
if (this.runningVersion === null) {
|
||||||
this.runningVersion = ver;
|
this.runningVersion = ver;
|
||||||
} else if (this.runningVersion !== ver) {
|
|
||||||
dis.dispatch({
|
|
||||||
action: 'new_version',
|
|
||||||
currentVersion: this.runningVersion,
|
|
||||||
newVersion: ver,
|
|
||||||
});
|
|
||||||
// Return to skip a MatrixChat state update
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.runningVersion !== ver) {
|
||||||
|
showUpdateToast(this.runningVersion, ver);
|
||||||
|
// Return to skip a MatrixChat state update
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
hideUpdateToast();
|
||||||
|
}
|
||||||
|
|
||||||
return { status: updateCheckStatusEnum.NOTAVAILABLE };
|
return { status: updateCheckStatusEnum.NOTAVAILABLE };
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
console.error("Failed to poll for update", err);
|
console.error("Failed to poll for update", err);
|
||||||
|
|
Loading…
Reference in New Issue