Replace New Version Bar with a Toast

discards the `new_version` dispatch

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-05-22 23:08:46 +01:00
parent b4284b4c68
commit 48a618264a
2 changed files with 12 additions and 13 deletions

View file

@ -21,6 +21,7 @@ import request from 'browser-request';
import dis from 'matrix-react-sdk/src/dispatcher/dispatcher';
import { _t } from 'matrix-react-sdk/src/languageHandler';
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 UAParser from 'ua-parser-js';
@ -135,15 +136,17 @@ export default class WebPlatform extends VectorBasePlatform {
return this._getVersion().then((ver) => {
if (this.runningVersion === null) {
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;
}
if (this.runningVersion !== ver) {
showUpdateToast(this.runningVersion, ver);
// Return to skip a MatrixChat state update
return;
} else {
hideUpdateToast();
}
return { status: updateCheckStatusEnum.NOTAVAILABLE };
}, (err) => {
console.error("Failed to poll for update", err);