first iter of manual update control

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-06-03 15:10:05 +01:00
parent 9e0aca534c
commit 0f4dc5c072
3 changed files with 35 additions and 6 deletions

View file

@ -182,6 +182,7 @@ export default React.createClass({
const MatrixToolbar = sdk.getComponent('globals.MatrixToolbar');
const GuestWarningBar = sdk.getComponent('globals.GuestWarningBar');
const NewVersionBar = sdk.getComponent('globals.NewVersionBar');
const UpdateCheckBar = sdk.getComponent('globals.UpdateCheckBar');
let page_element;
let right_panel = '';
@ -249,16 +250,16 @@ export default React.createClass({
break;
}
var topBar;
let topBar;
if (this.props.hasNewVersion) {
topBar = <NewVersionBar version={this.props.version} newVersion={this.props.newVersion}
releaseNotes={this.props.newVersionReleaseNotes}
releaseNotes={this.props.newVersionReleaseNotes}
/>;
}
else if (this.props.matrixClient.isGuest()) {
} else if (this.props.checkingForUpdate) {
topBar = <UpdateCheckBar />;
} else if (this.props.matrixClient.isGuest()) {
topBar = <GuestWarningBar />;
}
else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
} else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
topBar = <MatrixToolbar />;
}

View file

@ -127,6 +127,7 @@ module.exports = React.createClass({
newVersion: null,
hasNewVersion: false,
newVersionReleaseNotes: null,
checkingForUpdate: false,
// The username to default to when upgrading an account from a guest
upgradeUsername: null,
@ -527,6 +528,9 @@ module.exports = React.createClass({
payload.releaseNotes,
);
break;
case 'check_updates':
this.setState({ checkingForUpdate: payload.value });
break;
}
},
@ -1107,6 +1111,7 @@ module.exports = React.createClass({
newVersion: latest,
hasNewVersion: current !== latest,
newVersionReleaseNotes: releaseNotes,
checkingForUpdate: false,
});
},

View file

@ -854,6 +854,27 @@ module.exports = React.createClass({
</div>;
},
_onCheckUpdates: function() {
dis.dispatch({
action: 'check_updates',
value: true,
});
},
_renderCheckUpdate: function() {
const platform = PlatformPeg.get();
if ('canSelfUpdate' in platform && platform.canSelfUpdate()) {
return <div>
<h3>Updates</h3>
<div className="mx_UserSettings_section">
<AccessibleButton className="mx_UserSettings_button danger" onClick={this._onCheckUpdates}>
Check for update
</AccessibleButton>
</div>
</div>;
}
},
_renderBulkOptions: function() {
const invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => {
return r.hasMembershipState(this._me, "invite");
@ -1246,6 +1267,8 @@ module.exports = React.createClass({
</div>
</div>
{this._renderCheckUpdate()}
{this._renderClearCache()}
{this._renderDeactivateAccount()}