remove typing notifications from status bar
This commit is contained in:
parent
7df47cbc87
commit
465d767bf1
2 changed files with 2 additions and 78 deletions
|
@ -62,10 +62,6 @@ module.exports = React.createClass({
|
||||||
// more interesting)
|
// more interesting)
|
||||||
hasActiveCall: PropTypes.bool,
|
hasActiveCall: PropTypes.bool,
|
||||||
|
|
||||||
// Number of names to display in typing indication. E.g. set to 3, will
|
|
||||||
// result in "X, Y, Z and 100 others are typing."
|
|
||||||
whoIsTypingLimit: PropTypes.number,
|
|
||||||
|
|
||||||
// true if the room is being peeked at. This affects components that shouldn't
|
// true if the room is being peeked at. This affects components that shouldn't
|
||||||
// logically be shown when peeking, such as a prompt to invite people to a room.
|
// logically be shown when peeking, such as a prompt to invite people to a room.
|
||||||
isPeeking: PropTypes.bool,
|
isPeeking: PropTypes.bool,
|
||||||
|
@ -103,24 +99,16 @@ module.exports = React.createClass({
|
||||||
onVisible: PropTypes.func,
|
onVisible: PropTypes.func,
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
|
||||||
return {
|
|
||||||
whoIsTypingLimit: 3,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
return {
|
||||||
syncState: MatrixClientPeg.get().getSyncState(),
|
syncState: MatrixClientPeg.get().getSyncState(),
|
||||||
syncStateData: MatrixClientPeg.get().getSyncStateData(),
|
syncStateData: MatrixClientPeg.get().getSyncStateData(),
|
||||||
usersTyping: WhoIsTyping.usersTypingApartFromMe(this.props.room),
|
|
||||||
unsentMessages: getUnsentMessages(this.props.room),
|
unsentMessages: getUnsentMessages(this.props.room),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
MatrixClientPeg.get().on("sync", this.onSyncStateChange);
|
MatrixClientPeg.get().on("sync", this.onSyncStateChange);
|
||||||
MatrixClientPeg.get().on("RoomMember.typing", this.onRoomMemberTyping);
|
|
||||||
MatrixClientPeg.get().on("Room.localEchoUpdated", this._onRoomLocalEchoUpdated);
|
MatrixClientPeg.get().on("Room.localEchoUpdated", this._onRoomLocalEchoUpdated);
|
||||||
|
|
||||||
this._checkSize();
|
this._checkSize();
|
||||||
|
@ -135,7 +123,6 @@ module.exports = React.createClass({
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
if (client) {
|
if (client) {
|
||||||
client.removeListener("sync", this.onSyncStateChange);
|
client.removeListener("sync", this.onSyncStateChange);
|
||||||
client.removeListener("RoomMember.typing", this.onRoomMemberTyping);
|
|
||||||
client.removeListener("Room.localEchoUpdated", this._onRoomLocalEchoUpdated);
|
client.removeListener("Room.localEchoUpdated", this._onRoomLocalEchoUpdated);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -150,12 +137,6 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onRoomMemberTyping: function(ev, member) {
|
|
||||||
this.setState({
|
|
||||||
usersTyping: WhoIsTyping.usersTypingApartFromMeAndIgnored(this.props.room),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
_onSendWithoutVerifyingClick: function() {
|
_onSendWithoutVerifyingClick: function() {
|
||||||
cryptodevices.getUnknownDevicesForRoom(MatrixClientPeg.get(), this.props.room).then((devices) => {
|
cryptodevices.getUnknownDevicesForRoom(MatrixClientPeg.get(), this.props.room).then((devices) => {
|
||||||
cryptodevices.markAllDevicesKnown(MatrixClientPeg.get(), devices);
|
cryptodevices.markAllDevicesKnown(MatrixClientPeg.get(), devices);
|
||||||
|
@ -199,7 +180,6 @@ module.exports = React.createClass({
|
||||||
// indicate other sizes.
|
// indicate other sizes.
|
||||||
_getSize: function() {
|
_getSize: function() {
|
||||||
if (this._shouldShowConnectionError() ||
|
if (this._shouldShowConnectionError() ||
|
||||||
(this.state.usersTyping.length > 0) ||
|
|
||||||
this.props.numUnreadMessages ||
|
this.props.numUnreadMessages ||
|
||||||
!this.props.atEndOfLiveTimeline ||
|
!this.props.atEndOfLiveTimeline ||
|
||||||
this.props.hasActiveCall ||
|
this.props.hasActiveCall ||
|
||||||
|
@ -213,10 +193,7 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
// return suitable content for the image on the left of the status bar.
|
// return suitable content for the image on the left of the status bar.
|
||||||
//
|
_getIndicator: function() {
|
||||||
// if wantPlaceholder is true, we include a "..." placeholder if
|
|
||||||
// there is nothing better to put in.
|
|
||||||
_getIndicator: function(wantPlaceholder) {
|
|
||||||
if (this.props.numUnreadMessages) {
|
if (this.props.numUnreadMessages) {
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomStatusBar_scrollDownIndicator"
|
<div className="mx_RoomStatusBar_scrollDownIndicator"
|
||||||
|
@ -250,49 +227,9 @@ module.exports = React.createClass({
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wantPlaceholder) {
|
|
||||||
return (
|
|
||||||
<div className="mx_RoomStatusBar_typingIndicatorAvatars">
|
|
||||||
{ this._renderTypingIndicatorAvatars(this.props.whoIsTypingLimit) }
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderTypingIndicatorAvatars: function(limit) {
|
|
||||||
let users = this.state.usersTyping;
|
|
||||||
|
|
||||||
let othersCount = 0;
|
|
||||||
if (users.length > limit) {
|
|
||||||
othersCount = users.length - limit + 1;
|
|
||||||
users = users.slice(0, limit - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const avatars = users.map((u) => {
|
|
||||||
return (
|
|
||||||
<MemberAvatar
|
|
||||||
key={u.userId}
|
|
||||||
member={u}
|
|
||||||
width={24}
|
|
||||||
height={24}
|
|
||||||
resizeMethod="crop"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (othersCount > 0) {
|
|
||||||
avatars.push(
|
|
||||||
<span className="mx_RoomStatusBar_typingIndicatorRemaining" key="others">
|
|
||||||
+{ othersCount }
|
|
||||||
</span>,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return avatars;
|
|
||||||
},
|
|
||||||
|
|
||||||
_shouldShowConnectionError: function() {
|
_shouldShowConnectionError: function() {
|
||||||
// no conn bar trumps unread count since you can't get unread messages
|
// no conn bar trumps unread count since you can't get unread messages
|
||||||
// without a connection! (technically may already have some but meh)
|
// without a connection! (technically may already have some but meh)
|
||||||
|
@ -440,18 +377,6 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const typingString = WhoIsTyping.whoIsTypingString(
|
|
||||||
this.state.usersTyping,
|
|
||||||
this.props.whoIsTypingLimit,
|
|
||||||
);
|
|
||||||
if (typingString) {
|
|
||||||
return (
|
|
||||||
<div className="mx_RoomStatusBar_typingBar">
|
|
||||||
<EmojiText>{ typingString }</EmojiText>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.props.hasActiveCall) {
|
if (this.props.hasActiveCall) {
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomStatusBar_callBar">
|
<div className="mx_RoomStatusBar_callBar">
|
||||||
|
@ -483,7 +408,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const content = this._getContent();
|
const content = this._getContent();
|
||||||
const indicator = this._getIndicator(this.state.usersTyping.length > 0);
|
const indicator = this._getIndicator();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomStatusBar">
|
<div className="mx_RoomStatusBar">
|
||||||
|
|
|
@ -1613,7 +1613,6 @@ module.exports = React.createClass({
|
||||||
onResize={this.onChildResize}
|
onResize={this.onChildResize}
|
||||||
onVisible={this.onStatusBarVisible}
|
onVisible={this.onStatusBarVisible}
|
||||||
onHidden={this.onStatusBarHidden}
|
onHidden={this.onStatusBarHidden}
|
||||||
whoIsTypingLimit={3}
|
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue