From 0f4dc5c0725ca92179b556a0cff4831a5d20d20d Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sat, 3 Jun 2017 15:10:05 +0100
Subject: [PATCH 1/4] first iter of manual update control
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/LoggedInView.js | 13 +++++++------
src/components/structures/MatrixChat.js | 5 +++++
src/components/structures/UserSettings.js | 23 +++++++++++++++++++++++
3 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js
index e2fdeb4687..f42c752bb9 100644
--- a/src/components/structures/LoggedInView.js
+++ b/src/components/structures/LoggedInView.js
@@ -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 = ;
- }
- else if (this.props.matrixClient.isGuest()) {
+ } else if (this.props.checkingForUpdate) {
+ topBar = ;
+ } else if (this.props.matrixClient.isGuest()) {
topBar = ;
- }
- else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
+ } else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
topBar = ;
}
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 0dedc02270..706f7d35dd 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -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,
});
},
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index 89debcb461..e914f64859 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -854,6 +854,27 @@ module.exports = React.createClass({
;
},
+ _onCheckUpdates: function() {
+ dis.dispatch({
+ action: 'check_updates',
+ value: true,
+ });
+ },
+
+ _renderCheckUpdate: function() {
+ const platform = PlatformPeg.get();
+ if ('canSelfUpdate' in platform && platform.canSelfUpdate()) {
+ return
;
+ }
+ },
+
_renderBulkOptions: function() {
const invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => {
return r.hasMembershipState(this._me, "invite");
@@ -1246,6 +1267,8 @@ module.exports = React.createClass({
+ {this._renderCheckUpdate()}
+
{this._renderClearCache()}
{this._renderDeactivateAccount()}
From 98e99d542b6bdbd0818ba9d92512dee93571b254 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sat, 3 Jun 2017 15:48:33 +0100
Subject: [PATCH 2/4] i18n things
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/UserSettings.js | 6 +++---
src/i18n/strings/en_EN.json | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index e914f64859..5af1ed42c6 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -865,10 +865,10 @@ module.exports = React.createClass({
const platform = PlatformPeg.get();
if ('canSelfUpdate' in platform && platform.canSelfUpdate()) {
return
-
Updates
+
{_t('Updates')}
-
- Check for update
+
+ {_t('Check for update')}
;
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index 92c6b74444..b9f3c6b36d 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -822,6 +822,8 @@
"Online": "Online",
"Idle": "Idle",
"Offline": "Offline",
+ "Updates": "Updates",
+ "Check for update": "Check for update",
"Disable URL previews for this room (affects only you)": "Disable URL previews for this room (affects only you)",
"$senderDisplayName changed the room avatar to ": "$senderDisplayName changed the room avatar to ",
"%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s removed the room avatar.",
From 6ead97c7a6979bda915dc09aae23924b22f639b3 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sun, 11 Jun 2017 19:12:40 +0100
Subject: [PATCH 3/4] change interface to UpdateCheckBar and change launching
mechanism
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/LoggedInView.js | 2 +-
src/components/structures/MatrixChat.js | 4 ++--
src/components/structures/UserSettings.js | 11 ++---------
3 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js
index f42c752bb9..f916e28024 100644
--- a/src/components/structures/LoggedInView.js
+++ b/src/components/structures/LoggedInView.js
@@ -256,7 +256,7 @@ export default React.createClass({
releaseNotes={this.props.newVersionReleaseNotes}
/>;
} else if (this.props.checkingForUpdate) {
- topBar = ;
+ topBar = ;
} else if (this.props.matrixClient.isGuest()) {
topBar = ;
} else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 706f7d35dd..6294201e13 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -127,7 +127,7 @@ module.exports = React.createClass({
newVersion: null,
hasNewVersion: false,
newVersionReleaseNotes: null,
- checkingForUpdate: false,
+ checkingForUpdate: null,
// The username to default to when upgrading an account from a guest
upgradeUsername: null,
@@ -1111,7 +1111,7 @@ module.exports = React.createClass({
newVersion: latest,
hasNewVersion: current !== latest,
newVersionReleaseNotes: releaseNotes,
- checkingForUpdate: false,
+ checkingForUpdate: null,
});
},
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index 5af1ed42c6..a2d9df4900 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -854,20 +854,13 @@ module.exports = React.createClass({
;
},
- _onCheckUpdates: function() {
- dis.dispatch({
- action: 'check_updates',
- value: true,
- });
- },
-
_renderCheckUpdate: function() {
const platform = PlatformPeg.get();
- if ('canSelfUpdate' in platform && platform.canSelfUpdate()) {
+ if ('canSelfUpdate' in platform && platform.canSelfUpdate() && 'startUpdateCheck' in platform) {
return
{_t('Updates')}
-
+
{_t('Check for update')}
From ccad1013a71161df34870346d8292b43425979ce Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Sun, 11 Jun 2017 23:42:22 +0100
Subject: [PATCH 4/4] don't return null in case it breaks things
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/structures/UserSettings.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index 52e2c7b0e4..7edeafe889 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -863,6 +863,7 @@ module.exports = React.createClass({
;
}
+ return ;
},
_renderBulkOptions: function() {