mirror of https://github.com/vector-im/riot-web
Move 'new version' support into Platform
Also adds support for the platform providing a changelogpull/21833/head
parent
f433f9ca32
commit
3c4370c180
|
@ -38,4 +38,21 @@ export default class BasePlatform {
|
|||
|
||||
displayNotification(title: string, msg: string, avatarUrl: string) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for the availability of an update to the version of the
|
||||
* app that's currently running.
|
||||
* If an update is available, this function should dispatch the
|
||||
* 'new_version' action.
|
||||
*/
|
||||
pollForUpdate() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the currently running app to the latest available
|
||||
* version and replace this instance of the app with the
|
||||
* new version.
|
||||
*/
|
||||
installUpdate() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,8 @@ module.exports = React.createClass({
|
|||
|
||||
version: null,
|
||||
newVersion: null,
|
||||
hasNewVersion: false,
|
||||
newVersionReleaseNotes: null,
|
||||
|
||||
// The username to default to when upgrading an account from a guest
|
||||
upgradeUsername: null,
|
||||
|
@ -469,6 +471,12 @@ module.exports = React.createClass({
|
|||
case 'load_completed':
|
||||
this._onLoadCompleted();
|
||||
break;
|
||||
case 'new_version':
|
||||
this.onVersion(
|
||||
payload.currentVersion, payload.newVersion,
|
||||
payload.releaseNotes
|
||||
);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -961,11 +969,12 @@ module.exports = React.createClass({
|
|||
this.showScreen("settings");
|
||||
},
|
||||
|
||||
onVersion: function(current, latest) {
|
||||
onVersion: function(current, latest, releaseNotes) {
|
||||
this.setState({
|
||||
version: current,
|
||||
newVersion: latest,
|
||||
hasNewVersion: current !== latest
|
||||
hasNewVersion: current !== latest,
|
||||
newVersionReleaseNotes: releaseNotes,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1100,7 +1109,9 @@ module.exports = React.createClass({
|
|||
|
||||
var topBar;
|
||||
if (this.state.hasNewVersion) {
|
||||
topBar = <NewVersionBar version={this.state.version} newVersion={this.state.newVersion} />;
|
||||
topBar = <NewVersionBar version={this.state.version} newVersion={this.state.newVersion}
|
||||
releaseNotes={this.state.newVersionReleaseNotes}
|
||||
/>;
|
||||
}
|
||||
else if (MatrixClientPeg.get().isGuest()) {
|
||||
topBar = <GuestWarningBar />;
|
||||
|
|
Loading…
Reference in New Issue