2021-03-10 20:36:58 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import { MessageAudio } from '../../components/conversation/MessageAudio';
|
2021-04-15 21:02:24 +00:00
|
|
|
import { ComputePeaksResult } from '../../components/GlobalAudioContext';
|
2021-03-10 20:36:58 +00:00
|
|
|
|
|
|
|
import { mapDispatchToProps } from '../actions';
|
|
|
|
import { StateType } from '../reducer';
|
|
|
|
import { LocalizerType } from '../../types/Util';
|
2021-03-16 00:59:48 +00:00
|
|
|
import { AttachmentType } from '../../types/Attachment';
|
2021-07-09 20:27:16 +00:00
|
|
|
import type {
|
|
|
|
DirectionType,
|
|
|
|
MessageStatusType,
|
|
|
|
} from '../../components/conversation/Message';
|
2021-03-10 20:36:58 +00:00
|
|
|
|
|
|
|
export type Props = {
|
|
|
|
audio: HTMLAudioElement;
|
|
|
|
|
2021-06-29 19:58:29 +00:00
|
|
|
renderingContext: string;
|
2021-03-10 20:36:58 +00:00
|
|
|
i18n: LocalizerType;
|
2021-03-16 00:59:48 +00:00
|
|
|
attachment: AttachmentType;
|
2021-03-10 20:36:58 +00:00
|
|
|
withContentAbove: boolean;
|
|
|
|
withContentBelow: boolean;
|
|
|
|
|
2021-07-09 20:27:16 +00:00
|
|
|
direction: DirectionType;
|
|
|
|
expirationLength?: number;
|
|
|
|
expirationTimestamp?: number;
|
|
|
|
id: string;
|
2021-07-27 15:42:25 +00:00
|
|
|
played: boolean;
|
2021-07-09 20:27:16 +00:00
|
|
|
showMessageDetail: (id: string) => void;
|
|
|
|
status?: MessageStatusType;
|
|
|
|
textPending?: boolean;
|
|
|
|
timestamp: number;
|
|
|
|
|
2021-03-10 20:36:58 +00:00
|
|
|
buttonRef: React.RefObject<HTMLButtonElement>;
|
2021-04-15 21:02:24 +00:00
|
|
|
|
|
|
|
computePeaks(url: string, barCount: number): Promise<ComputePeaksResult>;
|
2021-03-16 00:59:48 +00:00
|
|
|
kickOffAttachmentDownload(): void;
|
2021-03-22 18:51:53 +00:00
|
|
|
onCorrupted(): void;
|
2021-08-12 18:15:55 +00:00
|
|
|
onFirstPlayed(): void;
|
2021-03-10 20:36:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const mapStateToProps = (state: StateType, props: Props) => {
|
|
|
|
return {
|
|
|
|
...props,
|
|
|
|
...state.audioPlayer,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
export const SmartMessageAudio = smart(MessageAudio);
|