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

Add setting to allow hiding of typing indicator #4047

Merged
merged 1 commit into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/components/structures/MessagePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default class MessagePanel extends React.Component {
// previous positions the read marker has been in, so we can
// display 'ghost' read markers that are animating away
ghostReadMarkers: [],
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
};

// opaque readreceipt info for each userId; used by ReadReceiptMarker
Expand Down Expand Up @@ -164,6 +165,9 @@ export default class MessagePanel extends React.Component {
this._readMarkerNode = createRef();
this._whoIsTyping = createRef();
this._scrollPanel = createRef();

this._showTypingNotificationsWatcherRef =
SettingsStore.watchSetting("showTypingNotifications", this.onShowTypingNotificationsChange);
}

componentDidMount() {
Expand All @@ -172,6 +176,7 @@ export default class MessagePanel extends React.Component {

componentWillUnmount() {
this._isMounted = false;
SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef);
}

componentDidUpdate(prevProps, prevState) {
Expand All @@ -184,6 +189,12 @@ export default class MessagePanel extends React.Component {
}
}

onShowTypingNotificationsChange = () => {
this.setState({
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
});
};

/* get the DOM node representing the given event */
getNodeForEventId(eventId) {
if (!this.eventNodes) {
Expand Down Expand Up @@ -921,7 +932,7 @@ export default class MessagePanel extends React.Component {
);

let whoIsTyping;
if (this.props.room && !this.props.tileShape) {
if (this.props.room && !this.props.tileShape && this.state.showTypingNotifications) {
whoIsTyping = (<WhoIsTypingTile
room={this.props.room}
onShown={this._onTypingShown}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
];

static TIMELINE_SETTINGS = [
'showTypingNotifications',
'autoplayGifsAndVideos',
'urlPreviewsEnabled',
'TextualBody.enableBigEmoji',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@
"Show avatars in user and room mentions": "Show avatars in user and room mentions",
"Enable big emoji in chat": "Enable big emoji in chat",
"Send typing notifications": "Send typing notifications",
"Show typing notifications": "Show typing notifications",
"Automatically replace plain text Emoji": "Automatically replace plain text Emoji",
"Mirror local video feed": "Mirror local video feed",
"Enable Community Filter Panel": "Enable Community Filter Panel",
Expand Down
5 changes: 5 additions & 0 deletions src/settings/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ export const SETTINGS = {
default: true,
invertedSettingName: 'dontSendTypingNotifications',
},
"showTypingNotifications": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Show typing notifications"),
default: true,
},
"MessageComposerInput.autoReplaceEmoji": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Automatically replace plain text Emoji'),
Expand Down