Skip to content

Commit

Permalink
feat: add string set for muted and frozen when sending a voice message
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 committed Nov 3, 2023
1 parent 9e9c2e1 commit 0c8d1f5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,28 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
};

const sendVoiceMessage = (file: FileType, durationMills: number) => {
onPressSendFileMessage({
file,
metaArrays: [
new MessageMetaArray({
key: VOICE_MESSAGE_META_ARRAY_DURATION_KEY,
value: [String(durationMills)],
}),
new MessageMetaArray({
key: VOICE_MESSAGE_META_ARRAY_MESSAGE_TYPE_KEY,
value: [`voice/${recorderService.options.extension}`],
}),
],
...messageReplyParams,
}).catch(onFailureToSend);
if (inputMuted) {
toast.show(STRINGS.TOAST.USER_MUTED_ERROR, 'error');
Logger.error(STRINGS.TOAST.USER_MUTED_ERROR);
} else if (inputFrozen) {
toast.show(STRINGS.TOAST.CHANNEL_FROZEN_ERROR, 'error');
Logger.error(STRINGS.TOAST.CHANNEL_FROZEN_ERROR);
} else {
onPressSendFileMessage({
file,
metaArrays: [
new MessageMetaArray({
key: VOICE_MESSAGE_META_ARRAY_DURATION_KEY,
value: [String(durationMills)],
}),
new MessageMetaArray({
key: VOICE_MESSAGE_META_ARRAY_MESSAGE_TYPE_KEY,
value: [`voice/${recorderService.options.extension}`],
}),
],
...messageReplyParams,
}).catch(onFailureToSend);
}

onChangeText('');
setMessageToReply?.();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ export interface StringSet {
RESEND_MSG_ERROR: string;
DELETE_MSG_ERROR: string;
SEND_MSG_ERROR: string;
USER_MUTED_ERROR: string;
CHANNEL_FROZEN_ERROR: string;
UPDATE_MSG_ERROR: string;
TURN_ON_NOTIFICATIONS_ERROR: string;
TURN_OFF_NOTIFICATIONS_ERROR: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ export const createBaseStringSet = ({ dateLocale, overrides }: StringSetCreateOp
DELETE_MSG_ERROR: "Couldn't delete message.",
RESEND_MSG_ERROR: "Couldn't send message.",
SEND_MSG_ERROR: "Couldn't send message.",
USER_MUTED_ERROR: "You're muted by the operator.",
CHANNEL_FROZEN_ERROR: 'Channel is frozen.',
UPDATE_MSG_ERROR: "Couldn't edit message.",
TURN_ON_NOTIFICATIONS_ERROR: "Couldn't turn on notifications.",
TURN_OFF_NOTIFICATIONS_ERROR: "Couldn't turn off notifications.",
Expand Down

0 comments on commit 0c8d1f5

Please sign in to comment.