feat: moved PropsForExpiringMessage to state ducks

pull/2660/head
William Grant 2 years ago
parent 07af0dfe0e
commit 2d6d6b4134

@ -5,22 +5,14 @@ import styled from 'styled-components';
import { Data } from '../../../../data/data';
import { MessageModelType } from '../../../../models/messageType';
import { getConversationController } from '../../../../session/conversations';
import { messagesExpired } from '../../../../state/ducks/conversations';
import { messagesExpired, PropsForExpiringMessage } from '../../../../state/ducks/conversations';
import { getIncrement } from '../../../../util/timer';
import { ExpireTimer } from '../../ExpireTimer';
import { ReadableMessage, ReadableMessageProps } from './ReadableMessage';
const EXPIRATION_CHECK_MINIMUM = 2000;
type ExpiringProps = {
isExpired?: boolean;
expirationTimestamp?: number | null;
expirationLength?: number | null;
convoId?: string;
messageId: string;
};
function useIsExpired(props: ExpiringProps) {
function useIsExpired(props: PropsForExpiringMessage) {
const {
convoId,
messageId,
@ -78,7 +70,9 @@ const StyledReadableMessage = styled(ReadableMessage)`
width: 100%;
`;
export interface ExpirableReadableMessageProps extends ReadableMessageProps, ExpiringProps {
export interface ExpirableReadableMessageProps
extends ReadableMessageProps,
PropsForExpiringMessage {
direction: MessageModelType;
}
@ -93,10 +87,10 @@ export const ExpirableReadableMessage = (props: ExpirableReadableMessageProps) =
expirationTimestamp,
} = props;
const expiringProps: ExpiringProps = {
const expiringProps: PropsForExpiringMessage = {
convoId,
expirationLength,
messageId: messageId,
expirationLength,
expirationTimestamp,
isExpired: props.isExpired,
};

@ -14,7 +14,7 @@ import {
import { MessageContentWithStatuses } from '../message-content/MessageContentWithStatus';
import { ReadableMessage } from './ReadableMessage';
import styled, { keyframes } from 'styled-components';
import { ExpirableReadableMessage } from './ExpirableReadableMEssage';
import { ExpirableReadableMessage } from './ExpirableReadableMessage';
export type GenericReadableMessageSelectorProps = Pick<
MessageRenderingProps,

@ -75,6 +75,14 @@ export type FindAndFormatContactType = {
isMe: boolean;
};
export type PropsForExpiringMessage = {
convoId?: string;
messageId: string;
expirationTimestamp?: number | null;
expirationLength?: number | null;
isExpired?: boolean;
};
export type PropsForExpirationTimer = {
expirationType: DisappearingMessageConversationType;
timespan: string;
@ -128,7 +136,7 @@ export type PropsForGroupUpdate = {
isUnread: boolean;
};
export type PropsForGroupInvitation = {
export interface PropsForGroupInvitation extends PropsForExpiringMessage {
serverName: string;
url: string;
direction: MessageModelType;
@ -136,7 +144,7 @@ export type PropsForGroupInvitation = {
messageId: string;
receivedAt?: number;
isUnread: boolean;
};
}
export type PropsForAttachment = {
id: number;

Loading…
Cancel
Save