<Timeline>
only needs whether someone is typing, not who
This commit is contained in:
parent
0b5e2e6768
commit
fd72385b9f
3 changed files with 9 additions and 15 deletions
|
@ -24,7 +24,6 @@ import { ContactSpoofingType } from '../../util/contactSpoofing';
|
||||||
import { ReadStatus } from '../../messages/MessageReadStatus';
|
import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||||
import type { WidthBreakpoint } from '../_util';
|
import type { WidthBreakpoint } from '../_util';
|
||||||
import { ThemeType } from '../../types/Util';
|
import { ThemeType } from '../../types/Util';
|
||||||
import { UUID } from '../../types/UUID';
|
|
||||||
|
|
||||||
const i18n = setupI18n('en', enMessages);
|
const i18n = setupI18n('en', enMessages);
|
||||||
|
|
||||||
|
@ -525,7 +524,7 @@ const useProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
|
||||||
renderItem,
|
renderItem,
|
||||||
renderHeroRow,
|
renderHeroRow,
|
||||||
renderTypingBubble,
|
renderTypingBubble,
|
||||||
typingContactId: overrideProps.typingContactId,
|
isSomeoneTyping: overrideProps.isSomeoneTyping || false,
|
||||||
|
|
||||||
...actions(),
|
...actions(),
|
||||||
});
|
});
|
||||||
|
@ -596,9 +595,7 @@ story.add('Target Index to Top', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
story.add('Typing Indicator', () => {
|
story.add('Typing Indicator', () => {
|
||||||
const props = useProps({
|
const props = useProps({ isSomeoneTyping: true });
|
||||||
typingContactId: UUID.generate().toString(),
|
|
||||||
});
|
|
||||||
|
|
||||||
return <Timeline {...props} />;
|
return <Timeline {...props} />;
|
||||||
});
|
});
|
||||||
|
|
|
@ -93,7 +93,7 @@ type PropsHousekeepingType = {
|
||||||
isConversationSelected: boolean;
|
isConversationSelected: boolean;
|
||||||
isGroupV1AndDisabled?: boolean;
|
isGroupV1AndDisabled?: boolean;
|
||||||
isIncomingMessageRequest: boolean;
|
isIncomingMessageRequest: boolean;
|
||||||
typingContactId?: string;
|
isSomeoneTyping: boolean;
|
||||||
unreadCount?: number;
|
unreadCount?: number;
|
||||||
|
|
||||||
selectedMessageId?: string;
|
selectedMessageId?: string;
|
||||||
|
@ -517,18 +517,18 @@ export class Timeline extends React.Component<
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isLoadingMessages: wasLoadingMessages,
|
isLoadingMessages: wasLoadingMessages,
|
||||||
|
isSomeoneTyping: wasSomeoneTyping,
|
||||||
items: oldItems,
|
items: oldItems,
|
||||||
scrollToIndexCounter: oldScrollToIndexCounter,
|
scrollToIndexCounter: oldScrollToIndexCounter,
|
||||||
typingContactId: oldTypingContactId,
|
|
||||||
} = prevProps;
|
} = prevProps;
|
||||||
const {
|
const {
|
||||||
isIncomingMessageRequest,
|
isIncomingMessageRequest,
|
||||||
isLoadingMessages,
|
isLoadingMessages,
|
||||||
|
isSomeoneTyping,
|
||||||
items: newItems,
|
items: newItems,
|
||||||
oldestUnreadIndex,
|
oldestUnreadIndex,
|
||||||
scrollToIndex,
|
scrollToIndex,
|
||||||
scrollToIndexCounter: newScrollToIndexCounter,
|
scrollToIndexCounter: newScrollToIndexCounter,
|
||||||
typingContactId,
|
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const isDoingInitialLoad = isLoadingMessages && newItems.length === 0;
|
const isDoingInitialLoad = isLoadingMessages && newItems.length === 0;
|
||||||
|
@ -557,10 +557,7 @@ export class Timeline extends React.Component<
|
||||||
return { scrollBottom: 0 };
|
return { scrollBottom: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (isSomeoneTyping !== wasSomeoneTyping && this.isAtBottom()) {
|
||||||
Boolean(typingContactId) !== Boolean(oldTypingContactId) &&
|
|
||||||
this.isAtBottom()
|
|
||||||
) {
|
|
||||||
return { scrollBottom: 0 };
|
return { scrollBottom: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,6 +739,7 @@ export class Timeline extends React.Component<
|
||||||
isConversationSelected,
|
isConversationSelected,
|
||||||
isGroupV1AndDisabled,
|
isGroupV1AndDisabled,
|
||||||
isLoadingMessages,
|
isLoadingMessages,
|
||||||
|
isSomeoneTyping,
|
||||||
items,
|
items,
|
||||||
oldestUnreadIndex,
|
oldestUnreadIndex,
|
||||||
onBlock,
|
onBlock,
|
||||||
|
@ -757,7 +755,6 @@ export class Timeline extends React.Component<
|
||||||
showContactModal,
|
showContactModal,
|
||||||
theme,
|
theme,
|
||||||
totalUnread,
|
totalUnread,
|
||||||
typingContactId,
|
|
||||||
unblurAvatar,
|
unblurAvatar,
|
||||||
unreadCount,
|
unreadCount,
|
||||||
updateSharedGroups,
|
updateSharedGroups,
|
||||||
|
@ -1057,7 +1054,7 @@ export class Timeline extends React.Component<
|
||||||
|
|
||||||
{messageNodes}
|
{messageNodes}
|
||||||
|
|
||||||
{typingContactId && renderTypingBubble(id)}
|
{isSomeoneTyping && renderTypingBubble(id)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,6 @@ const mapStateToProps = (state: StateType, props: ExternalProps) => {
|
||||||
...pick(conversation, [
|
...pick(conversation, [
|
||||||
'areWeAdmin',
|
'areWeAdmin',
|
||||||
'unreadCount',
|
'unreadCount',
|
||||||
'typingContactId',
|
|
||||||
'isGroupV1AndDisabled',
|
'isGroupV1AndDisabled',
|
||||||
]),
|
]),
|
||||||
isConversationSelected: state.conversations.selectedConversationId === id,
|
isConversationSelected: state.conversations.selectedConversationId === id,
|
||||||
|
@ -295,6 +294,7 @@ const mapStateToProps = (state: StateType, props: ExternalProps) => {
|
||||||
conversation.messageRequestsEnabled &&
|
conversation.messageRequestsEnabled &&
|
||||||
!conversation.acceptedMessageRequest
|
!conversation.acceptedMessageRequest
|
||||||
),
|
),
|
||||||
|
isSomeoneTyping: Boolean(conversation.typingContactId),
|
||||||
...conversationMessages,
|
...conversationMessages,
|
||||||
invitedContactsForNewlyCreatedGroup:
|
invitedContactsForNewlyCreatedGroup:
|
||||||
getInvitedContactsForNewlyCreatedGroup(state),
|
getInvitedContactsForNewlyCreatedGroup(state),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue