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

Commit 640fc59

Browse files
authored
Merge pull request #6279 from matrix-org/gsouquet/deprecate-tinter
Deprecate Tinter and TintableSVG
2 parents 78f1748 + 6607294 commit 640fc59

File tree

13 files changed

+8
-607
lines changed

13 files changed

+8
-607
lines changed

src/Tinter.js

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

src/components/structures/GroupView.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,11 @@ class CategoryRoomList extends React.Component {
126126
};
127127

128128
render() {
129-
const TintableSvg = sdk.getComponent("elements.TintableSvg");
130129
const addButton = this.props.editing ?
131130
(<AccessibleButton className="mx_GroupView_featuredThings_addButton"
132131
onClick={this.onAddRoomsToSummaryClicked}
133132
>
134-
<TintableSvg src={require("../../../res/img/icons-create-room.svg")} width="64" height="64" />
133+
<img src={require("../../../res/img/icons-create-room.svg")} width="64" height="64" />
135134
<div className="mx_GroupView_featuredThings_addButton_label">
136135
{ _t('Add a Room') }
137136
</div>
@@ -300,10 +299,9 @@ class RoleUserList extends React.Component {
300299
};
301300

302301
render() {
303-
const TintableSvg = sdk.getComponent("elements.TintableSvg");
304302
const addButton = this.props.editing ?
305303
(<AccessibleButton className="mx_GroupView_featuredThings_addButton" onClick={this.onAddUsersClicked}>
306-
<TintableSvg src={require("../../../res/img/icons-create-room.svg")} width="64" height="64" />
304+
<img src={require("../../../res/img/icons-create-room.svg")} width="64" height="64" />
307305
<div className="mx_GroupView_featuredThings_addButton_label">
308306
{ _t('Add a User') }
309307
</div>
@@ -855,7 +853,6 @@ export default class GroupView extends React.Component {
855853
_getRoomsNode() {
856854
const RoomDetailList = sdk.getComponent('rooms.RoomDetailList');
857855
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
858-
const TintableSvg = sdk.getComponent('elements.TintableSvg');
859856
const Spinner = sdk.getComponent('elements.Spinner');
860857
const TooltipButton = sdk.getComponent('elements.TooltipButton');
861858

@@ -871,7 +868,7 @@ export default class GroupView extends React.Component {
871868
onClick={this._onAddRoomsClick}
872869
>
873870
<div className="mx_GroupView_rooms_header_addRow_button">
874-
<TintableSvg src={require("../../../res/img/icons-room-add.svg")} width="24" height="24" />
871+
<img src={require("../../../res/img/icons-room-add.svg")} width="24" height="24" />
875872
</div>
876873
<div className="mx_GroupView_rooms_header_addRow_label">
877874
{ _t('Add rooms to this community') }

src/components/structures/MatrixChat.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import dis from "../../dispatcher/dispatcher";
3434
import Notifier from '../../Notifier';
3535

3636
import Modal from "../../Modal";
37-
import Tinter from "../../Tinter";
3837
import * as sdk from '../../index';
3938
import { showRoomInviteDialog, showStartChatInviteDialog } from '../../RoomInvite';
4039
import * as Rooms from '../../Rooms';
@@ -283,11 +282,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
283282

284283
this.pageChanging = false;
285284

286-
// check we have the right tint applied for this theme.
287-
// N.B. we don't call the whole of setTheme() here as we may be
288-
// racing with the theme CSS download finishing from index.js
289-
Tinter.tint();
290-
291285
// For PersistentElement
292286
this.state.resizeNotifier.on("middlePanelResized", this.dispatchTimelineResize);
293287

@@ -1573,10 +1567,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
15731567
});
15741568
}
15751569
});
1576-
// Fire the tinter right on startup to ensure the default theme is applied
1577-
// A later sync can/will correct the tint to be the right value for the user
1578-
const colorScheme = SettingsStore.getValue("roomColor");
1579-
Tinter.tint(colorScheme.primary_color, colorScheme.secondary_color);
15801570
}
15811571

15821572
/**

src/components/structures/MyGroups.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class MyGroups extends React.Component {
123123
</div>
124124
{/*<div className="mx_MyGroups_joinBox mx_MyGroups_headerCard">
125125
<AccessibleButton className='mx_MyGroups_headerCard_button' onClick={this._onJoinGroupClick}>
126-
<TintableSvg src={require("../../../res/img/icons-create-room.svg")} width="50" height="50" />
126+
<img src={require("../../../res/img/icons-create-room.svg")} width="50" height="50" />
127127
</AccessibleButton>
128128
<div className="mx_MyGroups_headerCard_content">
129129
<div className="mx_MyGroups_headerCard_header">

src/components/structures/RoomView.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import Modal from '../../Modal';
3737
import * as sdk from '../../index';
3838
import CallHandler, { PlaceCallType } from '../../CallHandler';
3939
import dis from '../../dispatcher/dispatcher';
40-
import Tinter from '../../Tinter';
4140
import rateLimitedFunc from '../../ratelimitedfunc';
4241
import * as Rooms from '../../Rooms';
4342
import eventSearch, { searchPagination } from '../../Searching';
@@ -679,10 +678,6 @@ export default class RoomView extends React.Component<IProps, IState> {
679678
// cancel any pending calls to the rate_limited_funcs
680679
this.updateRoomMembers.cancelPendingCall();
681680

682-
// no need to do this as Dir & Settings are now overlays. It just burnt CPU.
683-
// console.log("Tinter.tint from RoomView.unmount");
684-
// Tinter.tint(); // reset colourscheme
685-
686681
for (const watcher of this.settingWatchers) {
687682
SettingsStore.unwatchSetting(watcher);
688683
}
@@ -1062,10 +1057,6 @@ export default class RoomView extends React.Component<IProps, IState> {
10621057
private updateTint() {
10631058
const room = this.state.room;
10641059
if (!room) return;
1065-
1066-
console.log("Tinter.tint from updateTint");
1067-
const colorScheme = SettingsStore.getValue("roomColor", room.roomId);
1068-
Tinter.tint(colorScheme.primary_color, colorScheme.secondary_color);
10691060
}
10701061

10711062
private onAccountData = (event: MatrixEvent) => {
@@ -1079,12 +1070,7 @@ export default class RoomView extends React.Component<IProps, IState> {
10791070
private onRoomAccountData = (event: MatrixEvent, room: Room) => {
10801071
if (room.roomId == this.state.roomId) {
10811072
const type = event.getType();
1082-
if (type === "org.matrix.room.color_scheme") {
1083-
const colorScheme = event.getContent();
1084-
// XXX: we should validate the event
1085-
console.log("Tinter.tint from onRoomAccountData");
1086-
Tinter.tint(colorScheme.primary_color, colorScheme.secondary_color);
1087-
} else if (type === "org.matrix.room.preview_urls" || type === "im.vector.web.settings") {
1073+
if (type === "org.matrix.room.preview_urls" || type === "im.vector.web.settings") {
10881074
// non-e2ee url previews are stored in legacy event type `org.matrix.room.preview_urls`
10891075
this.updatePreviewUrlVisibility(room);
10901076
}

src/components/views/elements/ActionButton.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,14 @@ export default class ActionButton extends React.Component {
6262
};
6363

6464
render() {
65-
const TintableSvg = sdk.getComponent("elements.TintableSvg");
66-
6765
let tooltip;
6866
if (this.state.showTooltip) {
6967
const Tooltip = sdk.getComponent("elements.Tooltip");
7068
tooltip = <Tooltip className="mx_RoleButton_tooltip" label={this.props.label} />;
7169
}
7270

7371
const icon = this.props.iconPath ?
74-
(<TintableSvg src={this.props.iconPath} width={this.props.size} height={this.props.size} />) :
72+
(<img src={this.props.iconPath} width={this.props.size} height={this.props.size} />) :
7573
undefined;
7674

7775
const classNames = ["mx_RoleButton"];

src/components/views/elements/AddressTile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export default class AddressTile extends React.Component {
5353
}
5454

5555
const BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
56-
const TintableSvg = sdk.getComponent("elements.TintableSvg");
5756

5857
const nameClasses = classNames({
5958
"mx_AddressTile_name": true,
@@ -124,7 +123,7 @@ export default class AddressTile extends React.Component {
124123
if (this.props.canDismiss) {
125124
dismiss = (
126125
<div className="mx_AddressTile_dismiss" onClick={this.props.onDismissed} >
127-
<TintableSvg src={require("../../../../res/img/icon-address-delete.svg")} width="9" height="9" />
126+
<img src={require("../../../../res/img/icon-address-delete.svg")} width="9" height="9" />
128127
</div>
129128
);
130129
}

src/components/views/elements/TintableSvg.js

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

src/components/views/rooms/SimpleRoomHeader.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
import React from 'react';
1818
import PropTypes from 'prop-types';
19-
import * as sdk from '../../../index';
2019
import {replaceableComponent} from "../../../utils/replaceableComponent";
2120

2221
/*
@@ -35,8 +34,7 @@ export default class SimpleRoomHeader extends React.Component {
3534
render() {
3635
let icon;
3736
if (this.props.icon) {
38-
const TintableSvg = sdk.getComponent('elements.TintableSvg');
39-
icon = <TintableSvg
37+
icon = <img
4038
className="mx_RoomHeader_icon" src={this.props.icon}
4139
width="25" height="25"
4240
/>;

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,6 @@
857857
"Enable inline URL previews by default": "Enable inline URL previews by default",
858858
"Enable URL previews for this room (only affects you)": "Enable URL previews for this room (only affects you)",
859859
"Enable URL previews by default for participants in this room": "Enable URL previews by default for participants in this room",
860-
"Room Colour": "Room Colour",
861860
"Enable widget screenshots on supported widgets": "Enable widget screenshots on supported widgets",
862861
"Prompt before sending invites to potentially invalid matrix IDs": "Prompt before sending invites to potentially invalid matrix IDs",
863862
"Show developer tools": "Show developer tools",

0 commit comments

Comments
 (0)