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

View File

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

View File

@ -854,6 +854,27 @@ module.exports = React.createClass({
</div>; </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() { _renderBulkOptions: function() {
const invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => { const invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => {
return r.hasMembershipState(this._me, "invite"); return r.hasMembershipState(this._me, "invite");
@ -1246,6 +1267,8 @@ module.exports = React.createClass({
</div> </div>
</div> </div>
{this._renderCheckUpdate()}
{this._renderClearCache()} {this._renderClearCache()}
{this._renderDeactivateAccount()} {this._renderDeactivateAccount()}