Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 097f27c

Browse files
authored
Merge pull request #4668 from matrix-org/t3chguy/toasts6
Give contextual feedback for manual update check instead of banner
2 parents 7750c95 + f8f1a99 commit 097f27c

File tree

17 files changed

+225
-212
lines changed

17 files changed

+225
-212
lines changed

.eslintignore.errorfiles

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ src/components/views/elements/AddressSelector.js
1414
src/components/views/elements/DirectorySearchBox.js
1515
src/components/views/elements/MemberEventListSummary.js
1616
src/components/views/elements/UserSelector.js
17-
src/components/views/globals/MatrixToolbar.js
1817
src/components/views/globals/NewVersionBar.js
19-
src/components/views/globals/UpdateCheckBar.js
2018
src/components/views/messages/MFileBody.js
2119
src/components/views/messages/TextualBody.js
2220
src/components/views/room_settings/ColorSettings.js

res/css/_components.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
@import "./views/elements/_TooltipButton.scss";
124124
@import "./views/elements/_Validation.scss";
125125
@import "./views/emojipicker/_EmojiPicker.scss";
126-
@import "./views/globals/_MatrixToolbar.scss";
127126
@import "./views/groups/_GroupPublicityToggle.scss";
128127
@import "./views/groups/_GroupRoomList.scss";
129128
@import "./views/groups/_GroupUserSettings.scss";
@@ -202,6 +201,7 @@
202201
@import "./views/settings/_ProfileSettings.scss";
203202
@import "./views/settings/_SetIdServer.scss";
204203
@import "./views/settings/_SetIntegrationManager.scss";
204+
@import "./views/settings/_UpdateCheckButton.scss";
205205
@import "./views/settings/tabs/_SettingsTab.scss";
206206
@import "./views/settings/tabs/room/_GeneralRoomSettingsTab.scss";
207207
@import "./views/settings/tabs/room/_RolesRoomSettingsTab.scss";

res/css/structures/_MatrixChat.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ limitations under the License.
4141
height: 40px;
4242
}
4343

44-
.mx_MatrixChat_toolbarShowing {
45-
height: auto;
46-
}
47-
4844
.mx_MatrixChat {
4945
width: 100%;
5046
height: 100%;

res/css/views/globals/_MatrixToolbar.scss

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Copyright 2020 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
.mx_UpdateCheckButton_summary {
18+
margin-left: 16px;
19+
20+
.mx_AccessibleButton_kind_link {
21+
padding: 0;
22+
}
23+
}

src/BasePlatform.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ import {MatrixClient} from "matrix-js-sdk/src/client";
2121
import dis from './dispatcher/dispatcher';
2222
import BaseEventIndexManager from './indexing/BaseEventIndexManager';
2323
import {ActionPayload} from "./dispatcher/payloads";
24+
import {CheckUpdatesPayload} from "./dispatcher/payloads/CheckUpdatesPayload";
25+
import {Action} from "./dispatcher/actions";
26+
27+
export enum UpdateCheckStatus {
28+
Checking = "CHECKING",
29+
Error = "ERROR",
30+
NotAvailable = "NOTAVAILABLE",
31+
Downloading = "DOWNLOADING",
32+
Ready = "READY",
33+
}
2434

2535
/**
2636
* Base class for classes that provide platform-specific functionality
@@ -56,6 +66,20 @@ export default abstract class BasePlatform {
5666
this.errorDidOccur = errorDidOccur;
5767
}
5868

69+
/**
70+
* Whether we can call checkForUpdate on this platform build
71+
*/
72+
async canSelfUpdate(): Promise<boolean> {
73+
return false;
74+
}
75+
76+
startUpdateCheck() {
77+
dis.dispatch<CheckUpdatesPayload>({
78+
action: Action.CheckUpdates,
79+
status: UpdateCheckStatus.Checking,
80+
});
81+
}
82+
5983
/**
6084
* Returns true if the platform supports displaying
6185
* notifications, otherwise false.

src/components/structures/LoggedInView.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ interface IProps {
8181
currentRoomId: string;
8282
ConferenceHandler?: object;
8383
collapseLhs: boolean;
84-
checkingForUpdate: boolean;
8584
config: {
8685
piwik: {
8786
policyUrl: string;
@@ -177,15 +176,6 @@ class LoggedInView extends React.PureComponent<IProps, IState> {
177176
this._loadResizerPreferences();
178177
}
179178

180-
componentDidUpdate(prevProps, prevState) {
181-
// attempt to guess when a banner was opened or closed
182-
if (
183-
(prevProps.checkingForUpdate !== this.props.checkingForUpdate)
184-
) {
185-
this.props.resizeNotifier.notifyBannersChanged();
186-
}
187-
}
188-
189179
componentWillUnmount() {
190180
document.removeEventListener('keydown', this._onNativeKeyDown, false);
191181
this._matrixClient.removeListener("accountData", this.onAccountData);
@@ -617,7 +607,6 @@ class LoggedInView extends React.PureComponent<IProps, IState> {
617607
const GroupView = sdk.getComponent('structures.GroupView');
618608
const MyGroups = sdk.getComponent('structures.MyGroups');
619609
const ToastContainer = sdk.getComponent('structures.ToastContainer');
620-
const UpdateCheckBar = sdk.getComponent('globals.UpdateCheckBar');
621610

622611
let pageElement;
623612

@@ -661,15 +650,7 @@ class LoggedInView extends React.PureComponent<IProps, IState> {
661650
break;
662651
}
663652

664-
let topBar;
665-
if (this.props.checkingForUpdate) {
666-
topBar = <UpdateCheckBar {...this.props.checkingForUpdate} />;
667-
}
668-
669653
let bodyClasses = 'mx_MatrixChat';
670-
if (topBar) {
671-
bodyClasses += ' mx_MatrixChat_toolbarShowing';
672-
}
673654
if (this.state.useCompactLayout) {
674655
bodyClasses += ' mx_MatrixChat_useCompactLayout';
675656
}
@@ -684,7 +665,6 @@ class LoggedInView extends React.PureComponent<IProps, IState> {
684665
onMouseDown={this._onMouseDown}
685666
onMouseUp={this._onMouseUp}
686667
>
687-
{ topBar }
688668
<ToastContainer />
689669
<DragDropContext onDragEnd={this._onDragEnd}>
690670
<div ref={this._resizeContainer} className={bodyClasses}>

src/components/structures/MatrixChat.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ interface IState {
173173
leftDisabled: boolean;
174174
middleDisabled: boolean;
175175
// the right panel's disabled state is tracked in its store.
176-
checkingForUpdate?: string; // updateCheckStatusEnum
177176
// Parameters used in the registration dance with the IS
178177
register_client_secret?: string;
179178
register_session_id?: string;
@@ -226,8 +225,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
226225
leftDisabled: false,
227226
middleDisabled: false,
228227

229-
checkingForUpdate: null,
230-
231228
hideToSRUsers: false,
232229

233230
syncError: null, // If the current syncing status is ERROR, the error object, otherwise null.
@@ -720,9 +717,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
720717
case 'client_started':
721718
this.onClientStarted();
722719
break;
723-
case 'check_updates':
724-
this.setState({ checkingForUpdate: payload.value });
725-
break;
726720
case 'send_event':
727721
this.onSendEvent(payload.room_id, payload.event);
728722
break;

src/components/views/globals/UpdateCheckBar.js

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)