MCPcopy Create free account
hub / github.com/VadimNotJustDev/SignalClone / sendAudio

Function sendAudio

components/MessageInput/MessageInput.tsx:255–282  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

253 }
254
255 const sendAudio = async () => {
256 if (!soundURI) {
257 return;
258 }
259 const uriParts = soundURI.split(".");
260 const extenstion = uriParts[uriParts.length - 1];
261 const blob = await getBlob(soundURI);
262 const { key } = await Storage.put(`${uuidv4()}.${extenstion}`, blob, {
263 progressCallback,
264 });
265
266 // send message
267 const user = await Auth.currentAuthenticatedUser();
268 const newMessage = await DataStore.save(
269 new Message({
270 content: message,
271 audio: key,
272 userID: user.attributes.sub,
273 chatroomID: chatRoom.id,
274 status: "SENT",
275 replyToMessageID: messageReplyTo?.id,
276 })
277 );
278
279 updateLastMessage(newMessage);
280
281 resetFields();
282 };
283
284 return (
285 <KeyboardAvoidingView

Callers 1

onPressFunction · 0.85

Calls 3

getBlobFunction · 0.85
updateLastMessageFunction · 0.85
resetFieldsFunction · 0.85

Tested by

no test coverage detected