Apply missing props, fix lint and ts, run prettier

This commit is contained in:
Diego Mello 2024-02-29 11:40:53 -03:00
parent 36c66b5c73
commit e7c38b52e8
6 changed files with 22 additions and 14 deletions

View File

@ -95,16 +95,21 @@ export const RecordAudio = (): ReactElement | null => {
try {
if (!rid) return;
setRecordingAudio(false);
const fileURI = recordingRef.current?.getURI();
const fileData = await getInfoAsync(fileURI as string);
const fileInfo = {
const fileURI = recordingRef.current?.getURI() as string;
const fileData = await getInfoAsync(fileURI);
if (!fileData.exists) {
return;
}
const fileInfo: IUpload = {
rid,
name: `${Date.now()}${RECORDING_EXTENSION}`,
mime: 'audio/aac',
type: 'audio/aac',
store: 'Uploads',
path: fileURI,
size: fileData.exists ? fileData.size : null
} as IUpload;
size: fileData.size
};
if (fileInfo) {
if (permissionToUpload) {

View File

@ -54,8 +54,8 @@ const AttachedActions = ({ attachment, getCustomEmoji }: { attachment: IAttachme
};
const Attachments: React.FC<IMessageAttachments> = React.memo(
({ attachments, timeFormat, showAttachment, style, getCustomEmoji, isReply, author, isEncrypted }: IMessageAttachments) => {
const { translateLanguage } = useContext(MessageContext);
({ attachments, timeFormat, showAttachment, style, getCustomEmoji, isReply, author }: IMessageAttachments) => {
const { translateLanguage, isEncrypted } = useContext(MessageContext);
if (!attachments || attachments.length === 0) {
return null;

View File

@ -428,7 +428,8 @@ class MessageContainer extends React.Component<IMessageContainerProps, IMessageC
threadBadgeColor,
toggleFollowThread,
replies,
translateLanguage: canTranslateMessage ? autoTranslateLanguage : undefined
translateLanguage: canTranslateMessage ? autoTranslateLanguage : undefined,
isEncrypted: this.isEncrypted
}}
>
{/* @ts-ignore*/}

View File

@ -12,7 +12,6 @@ export interface IMessageAttachments {
timeFormat?: string;
style?: StyleProp<TextStyle>[];
isReply?: boolean;
isEncrypted: boolean;
showAttachment?: (file: IAttachment) => void;
getCustomEmoji: TGetCustomEmoji;
author?: IUserMessage;

View File

@ -45,7 +45,7 @@ describe('SwitchItemEncrypted', () => {
const component = screen.queryByTestId(testEncrypted.testSwitchID);
expect(component).toBeTruthy();
});
it('should change value of switch', () => {
render(
<SwitchItemEncrypted
@ -62,7 +62,7 @@ describe('SwitchItemEncrypted', () => {
expect(onPressMock).toHaveReturnedWith({ value: !testEncrypted.encrypted });
}
});
it('label when encrypted and isTeam are false and is a public channel', () => {
render(
<SwitchItemEncrypted
@ -76,7 +76,7 @@ describe('SwitchItemEncrypted', () => {
const component = screen.queryByTestId(testEncrypted.testLabelID);
expect(component?.props.children).toBe(i18n.t('Channel_hint_encrypted_not_available'));
});
it('label when encrypted and isTeam are true and is a private team', () => {
testEncrypted.isTeam = true;
testEncrypted.type = true;

View File

@ -126,7 +126,9 @@ class ShareView extends Component<IShareViewProps, IShareViewState> {
// if is share extension show default back button
if (!this.isShareExtension) {
options.headerLeft = () => <HeaderButton.CloseModal navigation={navigation} color={themes[theme].previewTintColor} testID='share-view-close' />;
options.headerLeft = () => (
<HeaderButton.CloseModal navigation={navigation} color={themes[theme].previewTintColor} testID='share-view-close' />
);
}
if (!attachments.length && !readOnly) {
@ -255,6 +257,7 @@ class ShareView extends Component<IShareViewProps, IShareViewState> {
return sendFileMessage(
room.rid,
{
rid: room.rid,
name,
description,
size,