2022-01-27 22:12:26 +00:00
|
|
|
// Copyright 2021-2022 Signal Messenger, LLC
|
2021-02-23 20:34:28 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { ChangeEvent, ReactChild } from 'react';
|
2021-02-23 20:34:28 +00:00
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { Row } from '../ConversationList';
|
|
|
|
import type { LocalizerType } from '../../types/Util';
|
|
|
|
import type {
|
2021-08-06 00:17:05 +00:00
|
|
|
DeleteAvatarFromDiskActionType,
|
|
|
|
ReplaceAvatarActionType,
|
|
|
|
SaveAvatarToDiskActionType,
|
|
|
|
} from '../../types/Avatar';
|
2022-11-16 20:18:02 +00:00
|
|
|
import type { DurationInSeconds } from '../../util/durations';
|
2022-06-16 19:12:50 +00:00
|
|
|
import type { ShowConversationType } from '../../state/ducks/conversations';
|
2021-02-23 20:34:28 +00:00
|
|
|
|
|
|
|
export enum FindDirection {
|
|
|
|
Up,
|
|
|
|
Down,
|
|
|
|
}
|
|
|
|
|
|
|
|
export type ToFindType = {
|
|
|
|
direction: FindDirection;
|
|
|
|
unreadOnly: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export abstract class LeftPaneHelper<T> {
|
|
|
|
getHeaderContents(
|
|
|
|
_: Readonly<{
|
|
|
|
i18n: LocalizerType;
|
|
|
|
showInbox: () => void;
|
2021-03-03 20:09:58 +00:00
|
|
|
startComposing: () => void;
|
|
|
|
showChooseGroupMembers: () => void;
|
2022-01-27 22:12:26 +00:00
|
|
|
}>
|
|
|
|
): null | ReactChild {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
getSearchInput(
|
|
|
|
_: Readonly<{
|
|
|
|
clearConversationSearch: () => unknown;
|
|
|
|
clearSearch: () => unknown;
|
|
|
|
i18n: LocalizerType;
|
|
|
|
onChangeComposeSearchTerm: (
|
|
|
|
event: ChangeEvent<HTMLInputElement>
|
|
|
|
) => unknown;
|
|
|
|
updateSearchTerm: (searchTerm: string) => unknown;
|
2022-06-16 19:12:50 +00:00
|
|
|
showConversation: ShowConversationType;
|
2021-02-23 20:34:28 +00:00
|
|
|
}>
|
|
|
|
): null | ReactChild {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-04-02 21:43:39 +00:00
|
|
|
getBackAction(
|
|
|
|
_: Readonly<{
|
|
|
|
showInbox: () => void;
|
|
|
|
startComposing: () => void;
|
|
|
|
showChooseGroupMembers: () => void;
|
|
|
|
}>
|
|
|
|
): undefined | (() => void) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2021-02-23 20:34:28 +00:00
|
|
|
getPreRowsNode(
|
|
|
|
_: Readonly<{
|
2022-01-27 22:12:26 +00:00
|
|
|
clearConversationSearch: () => unknown;
|
2021-03-03 20:09:58 +00:00
|
|
|
clearGroupCreationError: () => void;
|
2022-01-27 22:12:26 +00:00
|
|
|
clearSearch: () => unknown;
|
2021-03-03 20:09:58 +00:00
|
|
|
closeMaximumGroupSizeModal: () => unknown;
|
|
|
|
closeRecommendedGroupSizeModal: () => unknown;
|
2021-08-06 00:17:05 +00:00
|
|
|
composeDeleteAvatarFromDisk: DeleteAvatarFromDiskActionType;
|
|
|
|
composeReplaceAvatar: ReplaceAvatarActionType;
|
|
|
|
composeSaveAvatarToDisk: SaveAvatarToDiskActionType;
|
2021-03-03 20:09:58 +00:00
|
|
|
createGroup: () => unknown;
|
2021-02-23 20:34:28 +00:00
|
|
|
i18n: LocalizerType;
|
2022-01-27 22:12:26 +00:00
|
|
|
removeSelectedContact: (_: string) => unknown;
|
2021-09-24 00:49:05 +00:00
|
|
|
setComposeGroupAvatar: (_: undefined | Uint8Array) => unknown;
|
2022-11-16 20:18:02 +00:00
|
|
|
setComposeGroupExpireTimer: (_: DurationInSeconds) => void;
|
2022-01-27 22:12:26 +00:00
|
|
|
setComposeGroupName: (_: string) => unknown;
|
2021-08-06 00:17:05 +00:00
|
|
|
toggleComposeEditingAvatar: () => unknown;
|
2021-03-03 20:09:58 +00:00
|
|
|
}>
|
|
|
|
): null | ReactChild {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
getFooterContents(
|
|
|
|
_: Readonly<{
|
|
|
|
i18n: LocalizerType;
|
|
|
|
startSettingGroupMetadata: () => void;
|
|
|
|
createGroup: () => unknown;
|
2021-02-23 20:34:28 +00:00
|
|
|
}>
|
|
|
|
): null | ReactChild {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract getRowCount(): number;
|
|
|
|
|
|
|
|
abstract getRow(rowIndex: number): undefined | Row;
|
|
|
|
|
|
|
|
getRowIndexToScrollTo(
|
|
|
|
_selectedConversationId: undefined | string
|
|
|
|
): undefined | number {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2021-04-02 22:32:55 +00:00
|
|
|
isScrollable(): boolean {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-10-12 23:59:08 +00:00
|
|
|
requiresFullWidth(): boolean {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-11-01 18:43:02 +00:00
|
|
|
onKeyDown(
|
|
|
|
_event: KeyboardEvent,
|
|
|
|
_options: Readonly<{
|
|
|
|
searchInConversation: (conversationId: string) => unknown;
|
|
|
|
selectedConversationId: undefined | string;
|
|
|
|
startSearch: () => unknown;
|
|
|
|
}>
|
|
|
|
): void {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2021-02-23 20:34:28 +00:00
|
|
|
abstract getConversationAndMessageAtIndex(
|
|
|
|
conversationIndex: number
|
|
|
|
): undefined | { conversationId: string; messageId?: string };
|
|
|
|
|
|
|
|
abstract getConversationAndMessageInDirection(
|
|
|
|
toFind: Readonly<ToFindType>,
|
|
|
|
selectedConversationId: undefined | string,
|
|
|
|
selectedMessageId: undefined | string
|
|
|
|
): undefined | { conversationId: string; messageId?: string };
|
|
|
|
|
|
|
|
abstract shouldRecomputeRowHeights(old: Readonly<T>): boolean;
|
|
|
|
}
|