Peek group calls when opening conversations and leaving calls

This commit is contained in:
Evan Hahn 2022-02-08 13:18:51 -06:00 committed by GitHub
parent 5ce26eb91a
commit f5a4cd9ce8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 202 additions and 373 deletions

View file

@ -170,6 +170,7 @@ export type PropsActionsType = {
onBlockAndReportSpam: (conversationId: string) => unknown;
onDelete: (conversationId: string) => unknown;
onUnblock: (conversationId: string) => unknown;
peekGroupCallForTheFirstTime: (conversationId: string) => unknown;
removeMember: (conversationId: string) => unknown;
selectMessage: (messageId: string, conversationId: string) => unknown;
clearSelectedMessage: () => unknown;
@ -263,6 +264,7 @@ const getActions = createSelector(
'onBlockAndReportSpam',
'onDelete',
'onUnblock',
'peekGroupCallForTheFirstTime',
'removeMember',
'selectMessage',
'clearSelectedMessage',
@ -327,6 +329,8 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
private hasRecentlyScrolledTimeout?: NodeJS.Timeout;
private delayedPeekTimeout?: NodeJS.Timeout;
private containerRefMerger = createRefMerger();
constructor(props: PropsType) {
@ -958,10 +962,21 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
public override componentDidMount(): void {
this.updateWithVisibleRows();
window.registerForActive(this.updateWithVisibleRows);
this.delayedPeekTimeout = setTimeout(() => {
const { id, peekGroupCallForTheFirstTime } = this.props;
peekGroupCallForTheFirstTime(id);
}, 500);
}
public override componentWillUnmount(): void {
const { delayedPeekTimeout } = this;
window.unregisterForActive(this.updateWithVisibleRows);
if (delayedPeekTimeout) {
clearTimeout(delayedPeekTimeout);
}
}
public override componentDidUpdate(