@magmamath/students-features 0.9.107-rc.2 → 0.9.107-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js +29 -18
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +7 -2
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +14 -3
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +11 -2
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/components/VoiceRecord.js +25 -17
- package/dist/commonjs/features/voiceRecord/components/VoiceRecord.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/components/VoiceRecordButton.js +22 -8
- package/dist/commonjs/features/voiceRecord/components/VoiceRecordButton.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/components/{VoiceRecordDelete.js → VoiceRecordDeleteButton.js} +9 -6
- package/dist/commonjs/features/voiceRecord/components/VoiceRecordDeleteButton.js.map +1 -0
- package/dist/commonjs/features/voiceRecord/components/VoiceRecordTimer.js +7 -2
- package/dist/commonjs/features/voiceRecord/components/VoiceRecordTimer.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/constants.js +8 -1
- package/dist/commonjs/features/voiceRecord/constants.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/helpers.js +89 -3
- package/dist/commonjs/features/voiceRecord/helpers.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/hooks/useVoiceRecorder.js +45 -33
- package/dist/commonjs/features/voiceRecord/hooks/useVoiceRecorder.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/hooks/useVoiceRecorderAnimation.js +3 -3
- package/dist/commonjs/features/voiceRecord/hooks/useVoiceRecorderAnimation.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/index.js +44 -0
- package/dist/commonjs/features/voiceRecord/index.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/modal/VoiceRecordDeleteModal.js +93 -0
- package/dist/commonjs/features/voiceRecord/modal/VoiceRecordDeleteModal.js.map +1 -0
- package/dist/commonjs/features/voiceRecord/modal/VoiceRecordUndoModal.js +75 -0
- package/dist/commonjs/features/voiceRecord/modal/VoiceRecordUndoModal.js.map +1 -0
- package/dist/commonjs/features/voiceRecord/model/Recorder.model.js +54 -0
- package/dist/commonjs/features/voiceRecord/model/Recorder.model.js.map +1 -0
- package/dist/commonjs/features/voiceRecord/model/VoiceRecord.model.js +162 -21
- package/dist/commonjs/features/voiceRecord/model/VoiceRecord.model.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/model/VoiceRecordApi.js +21 -1
- package/dist/commonjs/features/voiceRecord/model/VoiceRecordApi.js.map +1 -1
- package/dist/commonjs/features/voiceRecord/model/VoiceRecordCollection.js +30 -0
- package/dist/commonjs/features/voiceRecord/model/VoiceRecordCollection.js.map +1 -0
- package/dist/commonjs/features/voiceRecord/types.js +6 -0
- package/dist/commonjs/features/voiceRecord/types.js.map +1 -0
- package/dist/commonjs/lib/components/ConditionalWrapper.js +23 -0
- package/dist/commonjs/lib/components/ConditionalWrapper.js.map +1 -0
- package/dist/commonjs/shared/translation/localization/ca.json +13 -0
- package/dist/commonjs/shared/translation/localization/de.json +13 -0
- package/dist/commonjs/shared/translation/localization/en.json +13 -0
- package/dist/commonjs/shared/translation/localization/gb.json +13 -0
- package/dist/commonjs/shared/translation/localization/sct.json +13 -0
- package/dist/commonjs/shared/translation/localization/sw.json +13 -0
- package/dist/module/features/chatbot/components/Chat/Chat.js +29 -18
- package/dist/module/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +5 -2
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +14 -3
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +11 -2
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/voiceRecord/components/VoiceRecord.js +24 -16
- package/dist/module/features/voiceRecord/components/VoiceRecord.js.map +1 -1
- package/dist/module/features/voiceRecord/components/VoiceRecordButton.js +22 -8
- package/dist/module/features/voiceRecord/components/VoiceRecordButton.js.map +1 -1
- package/dist/module/features/voiceRecord/components/{VoiceRecordDelete.js → VoiceRecordDeleteButton.js} +8 -5
- package/dist/module/features/voiceRecord/components/VoiceRecordDeleteButton.js.map +1 -0
- package/dist/module/features/voiceRecord/components/VoiceRecordTimer.js +7 -2
- package/dist/module/features/voiceRecord/components/VoiceRecordTimer.js.map +1 -1
- package/dist/module/features/voiceRecord/constants.js +7 -0
- package/dist/module/features/voiceRecord/constants.js.map +1 -1
- package/dist/module/features/voiceRecord/helpers.js +84 -2
- package/dist/module/features/voiceRecord/helpers.js.map +1 -1
- package/dist/module/features/voiceRecord/hooks/useVoiceRecorder.js +47 -35
- package/dist/module/features/voiceRecord/hooks/useVoiceRecorder.js.map +1 -1
- package/dist/module/features/voiceRecord/hooks/useVoiceRecorderAnimation.js +3 -3
- package/dist/module/features/voiceRecord/hooks/useVoiceRecorderAnimation.js.map +1 -1
- package/dist/module/features/voiceRecord/index.js +4 -0
- package/dist/module/features/voiceRecord/index.js.map +1 -1
- package/dist/module/features/voiceRecord/modal/VoiceRecordDeleteModal.js +86 -0
- package/dist/module/features/voiceRecord/modal/VoiceRecordDeleteModal.js.map +1 -0
- package/dist/module/features/voiceRecord/modal/VoiceRecordUndoModal.js +69 -0
- package/dist/module/features/voiceRecord/modal/VoiceRecordUndoModal.js.map +1 -0
- package/dist/module/features/voiceRecord/model/Recorder.model.js +49 -0
- package/dist/module/features/voiceRecord/model/Recorder.model.js.map +1 -0
- package/dist/module/features/voiceRecord/model/VoiceRecord.model.js +163 -22
- package/dist/module/features/voiceRecord/model/VoiceRecord.model.js.map +1 -1
- package/dist/module/features/voiceRecord/model/VoiceRecordApi.js +21 -1
- package/dist/module/features/voiceRecord/model/VoiceRecordApi.js.map +1 -1
- package/dist/module/features/voiceRecord/model/VoiceRecordCollection.js +25 -0
- package/dist/module/features/voiceRecord/model/VoiceRecordCollection.js.map +1 -0
- package/dist/module/features/voiceRecord/types.js +4 -0
- package/dist/module/features/voiceRecord/types.js.map +1 -0
- package/dist/module/lib/components/ConditionalWrapper.js +17 -0
- package/dist/module/lib/components/ConditionalWrapper.js.map +1 -0
- package/dist/module/shared/translation/localization/ca.json +13 -0
- package/dist/module/shared/translation/localization/de.json +13 -0
- package/dist/module/shared/translation/localization/en.json +13 -0
- package/dist/module/shared/translation/localization/gb.json +13 -0
- package/dist/module/shared/translation/localization/sct.json +13 -0
- package/dist/module/shared/translation/localization/sw.json +13 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts +4 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecord.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecordButton.d.ts +1 -5
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecordButton.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecordDeleteButton.d.ts +8 -0
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecordDeleteButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecordTimer.d.ts +4 -2
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecordTimer.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/constants.d.ts +6 -0
- package/dist/typescript/commonjs/features/voiceRecord/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/helpers.d.ts +26 -2
- package/dist/typescript/commonjs/features/voiceRecord/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/hooks/useVoiceRecorder.d.ts +0 -4
- package/dist/typescript/commonjs/features/voiceRecord/hooks/useVoiceRecorder.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/hooks/useVoiceRecorderAnimation.d.ts +1 -2
- package/dist/typescript/commonjs/features/voiceRecord/hooks/useVoiceRecorderAnimation.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/index.d.ts +4 -0
- package/dist/typescript/commonjs/features/voiceRecord/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/modal/VoiceRecordDeleteModal.d.ts +13 -0
- package/dist/typescript/commonjs/features/voiceRecord/modal/VoiceRecordDeleteModal.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voiceRecord/modal/VoiceRecordUndoModal.d.ts +13 -0
- package/dist/typescript/commonjs/features/voiceRecord/modal/VoiceRecordUndoModal.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voiceRecord/model/Recorder.model.d.ts +20 -0
- package/dist/typescript/commonjs/features/voiceRecord/model/Recorder.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voiceRecord/model/VoiceRecord.model.d.ts +38 -20
- package/dist/typescript/commonjs/features/voiceRecord/model/VoiceRecord.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/model/VoiceRecordApi.d.ts +2 -0
- package/dist/typescript/commonjs/features/voiceRecord/model/VoiceRecordApi.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voiceRecord/model/VoiceRecordCollection.d.ts +10 -0
- package/dist/typescript/commonjs/features/voiceRecord/model/VoiceRecordCollection.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voiceRecord/types.d.ts +43 -0
- package/dist/typescript/commonjs/features/voiceRecord/types.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/components/ConditionalWrapper.d.ts +9 -0
- package/dist/typescript/commonjs/lib/components/ConditionalWrapper.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +78 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +26 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/types/common.types.d.ts +3 -0
- package/dist/typescript/commonjs/types/common.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts +4 -2
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecord.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecordButton.d.ts +1 -5
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecordButton.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecordDeleteButton.d.ts +8 -0
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecordDeleteButton.d.ts.map +1 -0
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecordTimer.d.ts +4 -2
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecordTimer.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/constants.d.ts +6 -0
- package/dist/typescript/module/features/voiceRecord/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/helpers.d.ts +26 -2
- package/dist/typescript/module/features/voiceRecord/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/hooks/useVoiceRecorder.d.ts +0 -4
- package/dist/typescript/module/features/voiceRecord/hooks/useVoiceRecorder.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/hooks/useVoiceRecorderAnimation.d.ts +1 -2
- package/dist/typescript/module/features/voiceRecord/hooks/useVoiceRecorderAnimation.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/index.d.ts +4 -0
- package/dist/typescript/module/features/voiceRecord/index.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/modal/VoiceRecordDeleteModal.d.ts +13 -0
- package/dist/typescript/module/features/voiceRecord/modal/VoiceRecordDeleteModal.d.ts.map +1 -0
- package/dist/typescript/module/features/voiceRecord/modal/VoiceRecordUndoModal.d.ts +13 -0
- package/dist/typescript/module/features/voiceRecord/modal/VoiceRecordUndoModal.d.ts.map +1 -0
- package/dist/typescript/module/features/voiceRecord/model/Recorder.model.d.ts +20 -0
- package/dist/typescript/module/features/voiceRecord/model/Recorder.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voiceRecord/model/VoiceRecord.model.d.ts +38 -20
- package/dist/typescript/module/features/voiceRecord/model/VoiceRecord.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/model/VoiceRecordApi.d.ts +2 -0
- package/dist/typescript/module/features/voiceRecord/model/VoiceRecordApi.d.ts.map +1 -1
- package/dist/typescript/module/features/voiceRecord/model/VoiceRecordCollection.d.ts +10 -0
- package/dist/typescript/module/features/voiceRecord/model/VoiceRecordCollection.d.ts.map +1 -0
- package/dist/typescript/module/features/voiceRecord/types.d.ts +43 -0
- package/dist/typescript/module/features/voiceRecord/types.d.ts.map +1 -0
- package/dist/typescript/module/lib/components/ConditionalWrapper.d.ts +9 -0
- package/dist/typescript/module/lib/components/ConditionalWrapper.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/constants.d.ts +78 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +26 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/types/common.types.d.ts +3 -0
- package/dist/typescript/module/types/common.types.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/features/chatbot/components/Chat/Chat.tsx +30 -19
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +9 -2
- package/src/features/chatbot/components/Chatbot.tsx +15 -2
- package/src/features/chatbot/model/ChatBotModel.ts +12 -3
- package/src/features/chatbot/model/ChatsCacheModel.ts +4 -0
- package/src/features/chatbot/types/api.types.ts +1 -0
- package/src/features/chatbot/types/model.types.ts +1 -0
- package/src/features/voiceRecord/components/VoiceRecord.tsx +29 -18
- package/src/features/voiceRecord/components/VoiceRecordButton.tsx +33 -17
- package/src/features/voiceRecord/components/{VoiceRecordDelete.tsx → VoiceRecordDeleteButton.tsx} +5 -4
- package/src/features/voiceRecord/components/VoiceRecordTimer.tsx +19 -3
- package/src/features/voiceRecord/constants.ts +6 -0
- package/src/features/voiceRecord/helpers.ts +115 -1
- package/src/features/voiceRecord/hooks/useVoiceRecorder.ts +50 -36
- package/src/features/voiceRecord/hooks/useVoiceRecorderAnimation.ts +3 -4
- package/src/features/voiceRecord/index.ts +4 -0
- package/src/features/voiceRecord/modal/VoiceRecordDeleteModal.tsx +105 -0
- package/src/features/voiceRecord/modal/VoiceRecordUndoModal.tsx +82 -0
- package/src/features/voiceRecord/model/Recorder.model.ts +62 -0
- package/src/features/voiceRecord/model/VoiceRecord.model.ts +193 -32
- package/src/features/voiceRecord/model/VoiceRecordApi.ts +25 -1
- package/src/features/voiceRecord/model/VoiceRecordCollection.ts +26 -0
- package/src/features/voiceRecord/types.ts +49 -0
- package/src/lib/components/ConditionalWrapper.tsx +15 -0
- package/src/shared/translation/localization/ca.json +13 -0
- package/src/shared/translation/localization/de.json +13 -0
- package/src/shared/translation/localization/en.json +13 -0
- package/src/shared/translation/localization/gb.json +13 -0
- package/src/shared/translation/localization/sct.json +13 -0
- package/src/shared/translation/localization/sw.json +13 -0
- package/src/types/common.types.ts +1 -0
- package/dist/commonjs/features/voiceRecord/components/VoiceRecordDelete.js.map +0 -1
- package/dist/module/features/voiceRecord/components/VoiceRecordDelete.js.map +0 -1
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecordDelete.d.ts +0 -7
- package/dist/typescript/commonjs/features/voiceRecord/components/VoiceRecordDelete.d.ts.map +0 -1
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecordDelete.d.ts +0 -7
- package/dist/typescript/module/features/voiceRecord/components/VoiceRecordDelete.d.ts.map +0 -1
|
@@ -1,50 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { RecordingPresets,
|
|
4
|
-
import {
|
|
3
|
+
import { RecordingPresets, useAudioPlayer, useAudioRecorder, useAudioRecorderState } from 'expo-audio';
|
|
4
|
+
import { addAudioInputsListenerWeb, getAudioDurationMs, getAvailableInputs } from "../helpers.js";
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
|
+
import { IS_WEB } from '@magmamath/react-native-ui';
|
|
7
|
+
import { VOICE_RECORDER_MAX_DURATION_MS, VoiceRecorderState } from "../constants.js";
|
|
8
|
+
import { useUnit } from 'effector-react';
|
|
6
9
|
export const useVoiceRecorder = model => {
|
|
7
|
-
const recorder = useAudioRecorder(RecordingPresets.LOW_QUALITY, status => console.log('Recording status:', status));
|
|
8
|
-
const recorderState = useAudioRecorderState(recorder);
|
|
9
10
|
const player = useAudioPlayer();
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const currentRecord = useUnit(model.$currentRecord);
|
|
12
|
+
const recorder = useAudioRecorder(RecordingPresets.LOW_QUALITY, model.recordingStatusUpdate);
|
|
13
|
+
const recorderState = useAudioRecorderState(recorder);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (recorderState.durationMillis >= VOICE_RECORDER_MAX_DURATION_MS && recorderState.isRecording) {
|
|
16
|
+
model.recorderModel.stop();
|
|
17
|
+
}
|
|
18
|
+
}, [recorderState.durationMillis]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!IS_WEB) {
|
|
21
|
+
//only once for iPad and listener for WEB
|
|
22
|
+
getAvailableInputs(recorder).then(inputs => {
|
|
23
|
+
model.recorderModel.setAvailableInputs(inputs);
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
15
26
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
await setAudioModeAsync({
|
|
19
|
-
playsInSilentMode: true,
|
|
20
|
-
allowsRecording: true
|
|
27
|
+
const removeListener = addAudioInputsListenerWeb(devices => {
|
|
28
|
+
model.recorderModel.setAvailableInputs(devices);
|
|
21
29
|
});
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
return removeListener;
|
|
31
|
+
}, []);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (currentRecord?.uri) {
|
|
34
|
+
const getDuration = async () => {
|
|
35
|
+
const durationMs = await getAudioDurationMs(currentRecord.uri, player);
|
|
36
|
+
model.recorderModel.setAudioFileDurationMs(durationMs || 0);
|
|
37
|
+
};
|
|
38
|
+
getDuration();
|
|
39
|
+
}
|
|
40
|
+
}, [currentRecord?.uri]);
|
|
30
41
|
useEffect(() => {
|
|
31
|
-
|
|
42
|
+
if (recorderState.isRecording) {
|
|
43
|
+
model.recorderModel.setVoiceRecordState(VoiceRecorderState.RECORDING);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (recorderState.durationMillis > 0) {
|
|
47
|
+
model.recorderModel.setVoiceRecordState(VoiceRecorderState.PAUSED);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
model.recorderModel.setVoiceRecordState(VoiceRecorderState.IDLE);
|
|
32
51
|
return () => {
|
|
33
|
-
model.
|
|
52
|
+
model.recorderModel.reset();
|
|
34
53
|
};
|
|
35
|
-
}, [recorderState
|
|
54
|
+
}, [recorderState]);
|
|
36
55
|
useEffect(() => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
return removeListener;
|
|
41
|
-
}, []);
|
|
56
|
+
model.recorderModel.recorder = recorder;
|
|
57
|
+
}, [recorder]);
|
|
42
58
|
return {
|
|
43
|
-
|
|
44
|
-
recorderState,
|
|
45
|
-
player,
|
|
46
|
-
startRecording,
|
|
47
|
-
stopRecording
|
|
59
|
+
recorderState
|
|
48
60
|
};
|
|
49
61
|
};
|
|
50
62
|
//# sourceMappingURL=useVoiceRecorder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RecordingPresets","
|
|
1
|
+
{"version":3,"names":["RecordingPresets","useAudioPlayer","useAudioRecorder","useAudioRecorderState","addAudioInputsListenerWeb","getAudioDurationMs","getAvailableInputs","useEffect","IS_WEB","VOICE_RECORDER_MAX_DURATION_MS","VoiceRecorderState","useUnit","useVoiceRecorder","model","player","currentRecord","$currentRecord","recorder","LOW_QUALITY","recordingStatusUpdate","recorderState","durationMillis","isRecording","recorderModel","stop","then","inputs","setAvailableInputs","removeListener","devices","uri","getDuration","durationMs","setAudioFileDurationMs","setVoiceRecordState","RECORDING","PAUSED","IDLE","reset"],"sourceRoot":"../../../../../src","sources":["features/voiceRecord/hooks/useVoiceRecorder.ts"],"mappings":";;AAAA,SACEA,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,qBAAqB,QAChB,YAAY;AACnB,SAASC,yBAAyB,EAAEC,kBAAkB,EAAEC,kBAAkB,QAAQ,eAAY;AAE9F,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,8BAA8B,EAAEC,kBAAkB,QAAQ,iBAAc;AACjF,SAASC,OAAO,QAAQ,gBAAgB;AAExC,OAAO,MAAMC,gBAAgB,GAAIC,KAAuB,IAAK;EAC3D,MAAMC,MAAM,GAAGb,cAAc,CAAC,CAAC;EAC/B,MAAMc,aAAa,GAAGJ,OAAO,CAACE,KAAK,CAACG,cAAc,CAAC;EAEnD,MAAMC,QAAQ,GAAGf,gBAAgB,CAACF,gBAAgB,CAACkB,WAAW,EAAEL,KAAK,CAACM,qBAAqB,CAAC;EAC5F,MAAMC,aAAa,GAAGjB,qBAAqB,CAACc,QAAQ,CAAC;EAErDV,SAAS,CAAC,MAAM;IACd,IACEa,aAAa,CAACC,c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AACW,mBAAmB,CAACxB,kBAAkB,CAAC2B,IAAI,CAAC;IAEhE,OAAO,MAAM;MACXxB,KAAK,CAACU,aAAa,CAACe,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,EAAE,CAAClB,aAAa,CAAC,CAAC;EAEnBb,SAAS,CAAC,MAAM;IACdM,KAAK,CAACU,aAAa,CAACN,QAAQ,GAAGA,QAAQ;EACzC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,OAAO;IAAEG;EAAc,CAAC;AAC1B,CAAC","ignoreList":[]}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { useAnimatedStyle, withTiming } from 'react-native-reanimated';
|
|
4
4
|
import { VOICE_RECORDER_CONTAINER_SIZES } from "../constants.js";
|
|
5
|
-
export const useVoiceRecorderAnimation =
|
|
5
|
+
export const useVoiceRecorderAnimation = isExpanded => {
|
|
6
6
|
const containerAnimatedStyle = useAnimatedStyle(() => {
|
|
7
7
|
return {
|
|
8
|
-
height: withTiming(
|
|
8
|
+
height: withTiming(isExpanded ? VOICE_RECORDER_CONTAINER_SIZES.EXPANDED : VOICE_RECORDER_CONTAINER_SIZES.COLLAPSED, {
|
|
9
9
|
duration: 280
|
|
10
10
|
})
|
|
11
11
|
};
|
|
12
|
-
}, [
|
|
12
|
+
}, [isExpanded]);
|
|
13
13
|
return {
|
|
14
14
|
containerAnimatedStyle
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useAnimatedStyle","withTiming","VOICE_RECORDER_CONTAINER_SIZES","useVoiceRecorderAnimation","
|
|
1
|
+
{"version":3,"names":["useAnimatedStyle","withTiming","VOICE_RECORDER_CONTAINER_SIZES","useVoiceRecorderAnimation","isExpanded","containerAnimatedStyle","height","EXPANDED","COLLAPSED","duration"],"sourceRoot":"../../../../../src","sources":["features/voiceRecord/hooks/useVoiceRecorderAnimation.ts"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,UAAU,QAAQ,yBAAyB;AACtE,SAASC,8BAA8B,QAAQ,iBAAc;AAE7D,OAAO,MAAMC,yBAAyB,GAAIC,UAAmB,IAAK;EAChE,MAAMC,sBAAsB,GAAGL,gBAAgB,CAAC,MAAM;IACpD,OAAO;MACLM,MAAM,EAAEL,UAAU,CAChBG,UAAU,GACNF,8BAA8B,CAACK,QAAQ,GACvCL,8BAA8B,CAACM,SAAS,EAC5C;QACEC,QAAQ,EAAE;MACZ,CACF;IACF,CAAC;EACH,CAAC,EAAE,CAACL,UAAU,CAAC,CAAC;EAEhB,OAAO;IAAEC;EAAuB,CAAC;AACnC,CAAC","ignoreList":[]}
|
|
@@ -2,4 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
export * from "./components/VoiceRecord.js";
|
|
4
4
|
export * from "./model/VoiceRecord.model.js";
|
|
5
|
+
export * from "./modal/VoiceRecordDeleteModal.js";
|
|
6
|
+
export * from "./modal/VoiceRecordUndoModal.js";
|
|
7
|
+
export * from "./constants.js";
|
|
8
|
+
export * from "./types.js";
|
|
5
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["features/voiceRecord/index.ts"],"mappings":";;AAAA,cAAc,6BAA0B;AACxC,cAAc,8BAA2B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["features/voiceRecord/index.ts"],"mappings":";;AAAA,cAAc,6BAA0B;AACxC,cAAc,8BAA2B;AACzC,cAAc,mCAAgC;AAC9C,cAAc,iCAA8B;AAC5C,cAAc,gBAAa;AAC3B,cAAc,YAAS","ignoreList":[]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import { BaseModal, Button, ButtonColor, ButtonSize, ButtonVariant, SPACING } from '@magmamath/react-native-ui';
|
|
5
|
+
import { View, StyleSheet } from 'react-native';
|
|
6
|
+
import { useUnit } from 'effector-react';
|
|
7
|
+
import { VoiceRecorderState } from "../constants.js";
|
|
8
|
+
import { useText } from "../../../shared/translation/index.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const FooterButtons = ({
|
|
11
|
+
onClose,
|
|
12
|
+
onDelete
|
|
13
|
+
}) => {
|
|
14
|
+
const t = useText();
|
|
15
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
16
|
+
style: styles.footerContainer,
|
|
17
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
18
|
+
variant: ButtonVariant.TERTIARY,
|
|
19
|
+
size: ButtonSize.LARGE,
|
|
20
|
+
onPress: onClose,
|
|
21
|
+
children: t('voiceRecorder.cancel')
|
|
22
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
23
|
+
colorScheme: ButtonColor.RED,
|
|
24
|
+
variant: ButtonVariant.PRIMARY,
|
|
25
|
+
size: ButtonSize.LARGE,
|
|
26
|
+
onPress: onDelete,
|
|
27
|
+
children: t('voiceRecorder.delete')
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export const VoiceRecordDeleteModal = ({
|
|
32
|
+
modal: {
|
|
33
|
+
closeModal,
|
|
34
|
+
params
|
|
35
|
+
}
|
|
36
|
+
}) => {
|
|
37
|
+
const t = useText();
|
|
38
|
+
const {
|
|
39
|
+
model
|
|
40
|
+
} = params;
|
|
41
|
+
const recorderState = useUnit(model.recorderModel.$voiceRecordState);
|
|
42
|
+
const handleDelete = async () => {
|
|
43
|
+
if (recorderState === VoiceRecorderState.RECORDING) {
|
|
44
|
+
await model.stopAndDiscard();
|
|
45
|
+
}
|
|
46
|
+
await model.deleteCurrentRecording();
|
|
47
|
+
closeModal();
|
|
48
|
+
};
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (recorderState === VoiceRecorderState.RECORDING) {
|
|
51
|
+
model.recorderModel.recorder.pause();
|
|
52
|
+
}
|
|
53
|
+
return () => {
|
|
54
|
+
if (model.recorderModel.$voiceRecordState.getState() === VoiceRecorderState.PAUSED) {
|
|
55
|
+
try {
|
|
56
|
+
model.recorderModel.recorder.record();
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error(`Failed to resume recording: ${error}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}, []);
|
|
63
|
+
return /*#__PURE__*/_jsx(BaseModal, {
|
|
64
|
+
style: {
|
|
65
|
+
container: styles.modalContainer
|
|
66
|
+
},
|
|
67
|
+
header: t('voiceRecorder.deleteRecording'),
|
|
68
|
+
content: t('voiceRecorder.youWontBeAbleToRecover'),
|
|
69
|
+
footer: /*#__PURE__*/_jsx(FooterButtons, {
|
|
70
|
+
onClose: closeModal,
|
|
71
|
+
onDelete: handleDelete
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const styles = StyleSheet.create({
|
|
76
|
+
modalContainer: {
|
|
77
|
+
width: 600,
|
|
78
|
+
height: 268
|
|
79
|
+
},
|
|
80
|
+
footerContainer: {
|
|
81
|
+
flexDirection: 'row',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
gap: SPACING[200]
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
//# sourceMappingURL=VoiceRecordDeleteModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","BaseModal","Button","ButtonColor","ButtonSize","ButtonVariant","SPACING","View","StyleSheet","useUnit","VoiceRecorderState","useText","jsx","_jsx","jsxs","_jsxs","FooterButtons","onClose","onDelete","t","style","styles","footerContainer","children","variant","TERTIARY","size","LARGE","onPress","colorScheme","RED","PRIMARY","VoiceRecordDeleteModal","modal","closeModal","params","model","recorderState","recorderModel","$voiceRecordState","handleDelete","RECORDING","stopAndDiscard","deleteCurrentRecording","recorder","pause","getState","PAUSED","record","error","console","container","modalContainer","header","content","footer","create","width","height","flexDirection","alignItems","gap"],"sourceRoot":"../../../../../src","sources":["features/voiceRecord/modal/VoiceRecordDeleteModal.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,SAAS,EACTC,MAAM,EACNC,WAAW,EACXC,UAAU,EACVC,aAAa,EACbC,OAAO,QACF,4BAA4B;AACnC,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,OAAO,QAAQ,gBAAgB;AAExC,SAASC,kBAAkB,QAAQ,iBAAc;AACjD,SAASC,OAAO,QAAQ,sCAA6B;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAgBrD,MAAMC,aAAa,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAA6B,CAAC,KAAK;EACnE,MAAMC,CAAC,GAAGR,OAAO,CAAC,CAAC;EAEnB,oBACEI,KAAA,CAACR,IAAI;IAACa,KAAK,EAAEC,MAAM,CAACC,eAAgB;IAAAC,QAAA,gBAClCV,IAAA,CAACX,MAAM;MAACsB,OAAO,EAAEnB,aAAa,CAACoB,QAAS;MAACC,IAAI,EAAEtB,UAAU,CAACuB,KAAM;MAACC,OAAO,EAAEX,OAAQ;MAAAM,QAAA,EAC/EJ,CAAC,CAAC,sBAAsB;IAAC,CACpB,CAAC,eACTN,IAAA,CAACX,MAAM;MACL2B,WAAW,EAAE1B,WAAW,CAAC2B,GAAI;MAC7BN,OAAO,EAAEnB,aAAa,CAAC0B,OAAQ;MAC/BL,IAAI,EAAEtB,UAAU,CAACuB,KAAM;MACvBC,OAAO,EAAEV,QAAS;MAAAK,QAAA,EAEjBJ,CAAC,CAAC,sBAAsB;IAAC,CACpB,CAAC;EAAA,CACL,CAAC;AAEX,CAAC;AAED,OAAO,MAAMa,sBAAsB,GAAGA,CAAC;EACrCC,KAAK,EAAE;IAAEC,UAAU;IAAEC;EAAO;AACQ,CAAC,KAAK;EAC1C,MAAMhB,CAAC,GA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,UAAU,CAACgD,MAAM,CAAC;EAC/BJ,cAAc,EAAE;IACdK,KAAK,EAAE,GAAG;IACVC,MAAM,EAAE;EACV,CAAC;EACDpC,eAAe,EAAE;IACfqC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAEvD,OAAO,CAAC,GAAG;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { BaseModal, Button, ButtonColor, ButtonSize, ButtonVariant, SPACING } from '@magmamath/react-native-ui';
|
|
5
|
+
import { StyleSheet, View } from 'react-native';
|
|
6
|
+
import { useText } from "../../../shared/translation/index.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const FooterButtons = ({
|
|
9
|
+
onClose,
|
|
10
|
+
onRedo
|
|
11
|
+
}) => {
|
|
12
|
+
const t = useText();
|
|
13
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
14
|
+
style: styles.footerContainer,
|
|
15
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
16
|
+
variant: ButtonVariant.TERTIARY,
|
|
17
|
+
size: ButtonSize.LARGE,
|
|
18
|
+
onPress: onClose,
|
|
19
|
+
children: t('voiceRecorder.cancel')
|
|
20
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
21
|
+
colorScheme: ButtonColor.BLUE,
|
|
22
|
+
variant: ButtonVariant.PRIMARY,
|
|
23
|
+
size: ButtonSize.LARGE,
|
|
24
|
+
onPress: onRedo,
|
|
25
|
+
children: t('voiceRecorder.redo')
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export const VoiceRecordUndoModal = ({
|
|
30
|
+
modal: {
|
|
31
|
+
closeModal,
|
|
32
|
+
params
|
|
33
|
+
}
|
|
34
|
+
}) => {
|
|
35
|
+
const t = useText();
|
|
36
|
+
const {
|
|
37
|
+
model
|
|
38
|
+
} = params;
|
|
39
|
+
const handleRedo = () => {
|
|
40
|
+
model.deleteCurrentRecording({
|
|
41
|
+
notification: false
|
|
42
|
+
});
|
|
43
|
+
closeModal();
|
|
44
|
+
model.initializeRecording();
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/_jsx(BaseModal, {
|
|
47
|
+
style: {
|
|
48
|
+
container: styles.modalStyle
|
|
49
|
+
},
|
|
50
|
+
header: t('voiceRecorder.redoRecording'),
|
|
51
|
+
content: t('voiceRecorder.thisWillRemoveRecording'),
|
|
52
|
+
footer: /*#__PURE__*/_jsx(FooterButtons, {
|
|
53
|
+
onClose: closeModal,
|
|
54
|
+
onRedo: handleRedo
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
modalStyle: {
|
|
60
|
+
width: 600,
|
|
61
|
+
height: 268
|
|
62
|
+
},
|
|
63
|
+
footerContainer: {
|
|
64
|
+
flexDirection: 'row',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
gap: SPACING[200]
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=VoiceRecordUndoModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","BaseModal","Button","ButtonColor","ButtonSize","ButtonVariant","SPACING","StyleSheet","View","useText","jsx","_jsx","jsxs","_jsxs","FooterButtons","onClose","onRedo","t","style","styles","footerContainer","children","variant","TERTIARY","size","LARGE","onPress","colorScheme","BLUE","PRIMARY","VoiceRecordUndoModal","modal","closeModal","params","model","handleRedo","deleteCurrentRecording","notification","initializeRecording","container","modalStyle","header","content","footer","create","width","height","flexDirection","alignItems","gap"],"sourceRoot":"../../../../../src","sources":["features/voiceRecord/modal/VoiceRecordUndoModal.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,SAAS,EACTC,MAAM,EAC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B,CAAC;EAED,oBACE3B,IAAA,CAACV,SAAS;IACRiB,KAAK,EAAE;MACLqB,SAAS,EAAEpB,MAAM,CAACqB;IACpB,CAAE;IACFC,MAAM,EAAExB,CAAC,CAAC,6BAA6B,CAAE;IACzCyB,OAAO,EAAEzB,CAAC,CAAC,uCAAuC,CAAE;IACpD0B,MAAM,eAAEhC,IAAA,CAACG,aAAa;MAACC,OAAO,EAAEiB,UAAW;MAAChB,MAAM,EAAEmB;IAAW,CAAE;EAAE,CACpE,CAAC;AAEN,CAAC;AAED,MAAMhB,MAAM,GAAGZ,UAAU,CAACqC,MAAM,CAAC;EAC/BJ,UAAU,EAAE;IACVK,KAAK,EAAE,GAAG;IACVC,MAAM,EAAE;EACV,CAAC;EACD1B,eAAe,EAAE;IACf2B,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAE3C,OAAO,CAAC,GAAG;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createEffect, createEvent, restore } from 'effector';
|
|
4
|
+
import { setAudioModeAsync } from 'expo-audio';
|
|
5
|
+
import { VoiceRecorderState } from "../constants.js";
|
|
6
|
+
const AUDIO_MODE_CONFIG = {
|
|
7
|
+
playsInSilentMode: true,
|
|
8
|
+
allowsRecording: true
|
|
9
|
+
};
|
|
10
|
+
export class RecorderModel {
|
|
11
|
+
stopResolver = null;
|
|
12
|
+
reset = createEvent();
|
|
13
|
+
setAudioFileDurationMs = createEvent();
|
|
14
|
+
setVoiceRecordState = createEvent();
|
|
15
|
+
setAvailableInputs = createEvent();
|
|
16
|
+
$audioFileDurationMs = restore(this.setAudioFileDurationMs, 0).reset(this.reset);
|
|
17
|
+
$voiceRecordState = restore(this.setVoiceRecordState, VoiceRecorderState.IDLE).reset(this.reset);
|
|
18
|
+
$availableInputs = restore(this.setAvailableInputs, []);
|
|
19
|
+
start = createEffect(async () => {
|
|
20
|
+
try {
|
|
21
|
+
await setAudioModeAsync(AUDIO_MODE_CONFIG);
|
|
22
|
+
await this.recorder.prepareToRecordAsync();
|
|
23
|
+
this.recorder.record();
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error('Error starting recording:', error);
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
stop = createEffect(() => {
|
|
30
|
+
if (!this.recorder.isRecording) return Promise.resolve();
|
|
31
|
+
return this.recorder.stop();
|
|
32
|
+
});
|
|
33
|
+
stopAndGetCollectionItem() {
|
|
34
|
+
return new Promise(resolve => {
|
|
35
|
+
this.stopResolver = resolve;
|
|
36
|
+
this.recorder.isRecording && this.recorder.stop();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
resolveStopWithCollectionItem(item) {
|
|
40
|
+
if (this.stopResolver) {
|
|
41
|
+
this.stopResolver(item);
|
|
42
|
+
this.stopResolver = null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
clearStopResolver() {
|
|
46
|
+
this.stopResolver = null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=Recorder.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEffect","createEvent","restore","setAudioModeAsync","VoiceRecorderState","AUDIO_MODE_CONFIG","playsInSilentMode","allowsRecording","RecorderModel","stopResolver","reset","setAudioFileDurationMs","setVoiceRecordState","setAvailableInputs","$audioFileDurationMs","$voiceRecordState","IDLE","$availableInputs","start","recorder","prepareToRecordAsync","record","error","console","stop","isRecording","Promise","resolve","stopAndGetCollectionItem","resolveStopWithCollectionItem","item","clearStopResolver"],"sourceRoot":"../../../../../src","sources":["features/voiceRecord/model/Recorder.model.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAU;AAC7D,SAAwBC,iBAAiB,QAAQ,YAAY;AAC7D,SAASC,kBAAkB,QAAQ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O,IAAIF,OAAO,CAAEC,OAAO,IAAK;MAC9B,IAAI,CAAClB,YAAY,GAAGkB,OAAO;MAC3B,IAAI,CAACR,QAAQ,CAACM,WAAW,IAAI,IAAI,CAACN,QAAQ,CAACK,IAAI,CAAC,CAAC;IACnD,CAAC,CAAC;EACJ;EAEOK,6BAA6BA,CAACC,IAA+B,EAAQ;IAC1E,IAAI,IAAI,CAACrB,YAAY,EAAE;MACrB,IAAI,CAACA,YAAY,CAACqB,IAAI,CAAC;MACvB,IAAI,CAACrB,YAAY,GAAG,IAAI;IAC1B;EACF;EAEOsB,iBAAiBA,CAAA,EAAS;IAC/B,IAAI,CAACtB,YAAY,GAAG,IAAI;EAC1B;AACF","ignoreList":[]}
|
|
@@ -1,33 +1,174 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { createEffect, createEvent, restore, sample } from 'effector';
|
|
3
|
+
import { attach, createEffect, createEvent, createStore, restore, sample } from 'effector';
|
|
4
|
+
import { ensureRecordingPermissions, generateAudioFormData, getAudioDurationMs, getAvailableInputs, uploadAudioFileRequestGenerator } from "../helpers.js";
|
|
5
|
+
import { t } from "../../../shared/translation/index.js";
|
|
6
|
+
import { RecorderModel } from "./Recorder.model.js";
|
|
7
|
+
import { VoiceRecordsCollection } from "./VoiceRecordCollection.js";
|
|
4
8
|
export class VoiceRecordModel {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
$
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
shouldDiscardRecording = false;
|
|
10
|
+
setCurrentKey = createEvent();
|
|
11
|
+
setCurrentRecord = createEvent();
|
|
12
|
+
reset = createEvent();
|
|
13
|
+
setIsDisabled = createEvent();
|
|
14
|
+
startAudioUpload = createEvent();
|
|
15
|
+
$currentKey = restore(this.setCurrentKey, '');
|
|
16
|
+
$currentRecord = restore(this.setCurrentRecord, null).reset(this.reset);
|
|
17
|
+
$isDisabled = restore(this.setIsDisabled, false);
|
|
18
|
+
deleteCurrentRecording = attach({
|
|
19
|
+
source: this.$currentKey,
|
|
20
|
+
mapParams: (props, currentKey) => ({
|
|
21
|
+
notification: true,
|
|
22
|
+
...props,
|
|
23
|
+
currentKey
|
|
24
|
+
}),
|
|
25
|
+
effect: createEffect(({
|
|
26
|
+
currentKey,
|
|
27
|
+
notification
|
|
28
|
+
}) => {
|
|
29
|
+
const recordingItem = this.collection.get(currentKey);
|
|
30
|
+
this.abortUploadIfInProgress(recordingItem);
|
|
31
|
+
this.resetRecordingState(currentKey);
|
|
32
|
+
if (notification) {
|
|
33
|
+
this.notification.info(t('voiceRecorder.recordingDeleted'));
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
initializeRecording = createEffect(async () => {
|
|
38
|
+
this.deleteCurrentRecording({
|
|
39
|
+
notification: false
|
|
40
|
+
});
|
|
41
|
+
const hasPermissions = await ensureRecordingPermissions();
|
|
42
|
+
if (!hasPermissions) {
|
|
43
|
+
this.notification.error(t('voiceRecorder.noMicrophoneAccess'));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const inputs = await getAvailableInputs(this.recorderModel.recorder);
|
|
47
|
+
this.recorderModel.setAvailableInputs(inputs);
|
|
48
|
+
if (inputs.length === 0) {
|
|
49
|
+
this.notification.error(t('voiceRecorder.noMicrophoneFound'));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
return this.recorderModel.start();
|
|
53
|
+
});
|
|
54
|
+
stopAndDiscard = createEffect(async () => {
|
|
55
|
+
this.shouldDiscardRecording = true;
|
|
56
|
+
await this.recorderModel.stop();
|
|
57
|
+
this.recorderModel.clearStopResolver();
|
|
58
|
+
this.recorderModel.reset();
|
|
59
|
+
});
|
|
60
|
+
recordingStatusUpdate = status => {
|
|
61
|
+
if (status.error) {
|
|
62
|
+
this.notification.error(`Recorder error: ${status.error}`);
|
|
63
|
+
this.recorderModel.clearStopResolver();
|
|
64
|
+
this.shouldDiscardRecording = false;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (status.isFinished && status.url) {
|
|
68
|
+
if (!this.shouldDiscardRecording) {
|
|
69
|
+
this.startAudioUpload(status.url);
|
|
70
|
+
}
|
|
71
|
+
this.shouldDiscardRecording = false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
16
74
|
constructor({
|
|
17
|
-
|
|
75
|
+
api,
|
|
76
|
+
notification,
|
|
77
|
+
events
|
|
18
78
|
}) {
|
|
19
|
-
this.
|
|
79
|
+
this.api = api;
|
|
80
|
+
this.notification = notification;
|
|
81
|
+
this.events = events;
|
|
82
|
+
this.recorderModel = new RecorderModel();
|
|
83
|
+
this.collection = new VoiceRecordsCollection();
|
|
84
|
+
this.setupUploadHandler();
|
|
85
|
+
this.setupCurrentRecordSync();
|
|
86
|
+
this.setupUriSync();
|
|
87
|
+
}
|
|
88
|
+
abortUploadIfInProgress(recordingItem) {
|
|
89
|
+
if (!recordingItem?.id && recordingItem?.controller) {
|
|
90
|
+
recordingItem.controller.abort();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
resetRecordingState(currentKey) {
|
|
94
|
+
this.recorderModel.reset();
|
|
95
|
+
this.reset();
|
|
96
|
+
this.collection.delete(currentKey);
|
|
97
|
+
}
|
|
98
|
+
async handleAudioUpload({
|
|
99
|
+
uri,
|
|
100
|
+
currentKey
|
|
101
|
+
}) {
|
|
102
|
+
const durationMs = await getAudioDurationMs(uri);
|
|
103
|
+
const formData = await generateAudioFormData({
|
|
104
|
+
audioFileUri: uri,
|
|
105
|
+
durationMs
|
|
106
|
+
});
|
|
107
|
+
const {
|
|
108
|
+
uploadAudio,
|
|
109
|
+
controller
|
|
110
|
+
} = uploadAudioFileRequestGenerator(formData, this.api);
|
|
111
|
+
const audioUploadPromise = uploadAudio().then(data => {
|
|
112
|
+
// Check if the item still exists (wasn't deleted during upload)
|
|
113
|
+
if (this.collection.get(currentKey)) {
|
|
114
|
+
this.collection.update(currentKey, {
|
|
115
|
+
id: data.id
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return data;
|
|
119
|
+
}).catch(error => {
|
|
120
|
+
if (error.name === 'CanceledError') return;
|
|
121
|
+
this.notification.error(t('voiceRecorder.uploadFailed'));
|
|
122
|
+
});
|
|
123
|
+
const collectionItem = {
|
|
124
|
+
durationMs,
|
|
125
|
+
audioUploadPromise,
|
|
126
|
+
controller,
|
|
127
|
+
uri
|
|
128
|
+
};
|
|
129
|
+
this.collection.add(currentKey, collectionItem);
|
|
130
|
+
this.setCurrentRecord(collectionItem);
|
|
131
|
+
this.recorderModel.resolveStopWithCollectionItem(collectionItem);
|
|
132
|
+
return audioUploadPromise;
|
|
133
|
+
}
|
|
134
|
+
setupUploadHandler() {
|
|
20
135
|
sample({
|
|
21
|
-
clock: this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
136
|
+
clock: this.startAudioUpload,
|
|
137
|
+
source: this.$currentKey,
|
|
138
|
+
filter: (currentKey, uri) => !!uri && !!currentKey,
|
|
139
|
+
fn: (currentKey, uri) => ({
|
|
140
|
+
currentKey,
|
|
141
|
+
uri
|
|
142
|
+
}),
|
|
143
|
+
target: createEffect(({
|
|
144
|
+
uri,
|
|
145
|
+
currentKey
|
|
146
|
+
}) => this.handleAudioUpload({
|
|
147
|
+
uri,
|
|
148
|
+
currentKey
|
|
149
|
+
}))
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
setupUriSync() {
|
|
153
|
+
sample({
|
|
154
|
+
source: this.$currentRecord,
|
|
155
|
+
fn: record => record?.uri || '',
|
|
156
|
+
target: createStore('').reset(this.reset)
|
|
26
157
|
});
|
|
158
|
+
}
|
|
159
|
+
setupCurrentRecordSync() {
|
|
27
160
|
sample({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
161
|
+
source: this.$currentKey,
|
|
162
|
+
fn: currentKey => this.collection.get(currentKey),
|
|
163
|
+
target: createEffect(recordingItem => {
|
|
164
|
+
if (!recordingItem) {
|
|
165
|
+
this.reset();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.setCurrentRecord(recordingItem);
|
|
169
|
+
if (recordingItem.durationMs) {
|
|
170
|
+
this.recorderModel.setAudioFileDurationMs(recordingItem.durationMs);
|
|
171
|
+
}
|
|
31
172
|
})
|
|
32
173
|
});
|
|
33
174
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createEffect","createEvent","restore","sample","
|
|
1
|
+
{"version":3,"names":["attach","createEffect","createEvent","createStore","restore","sample","ensureRecordingPermissions","generateAudioFormData","getAudioDurationMs","getAvailableInputs","uploadAudioFileRequestGenerator","t","RecorderModel","VoiceRecordsCollection","VoiceRecordModel","shouldDiscardRecording","setCurrentKey","setCurrentRecord","reset","setIsDisabled","startAudioUpload","$currentKey","$currentRecord","$isDisabled","deleteCurrentRecording","source","mapParams","props","currentKey","notification","effect","recordingItem","collection","get","abortUploadIfInProgress","resetRecordingState","info","initializeRecording","hasPermissions","error","inputs","recorderModel","recorder","setAvailableInputs","length","start","stopAndDiscard","stop","clearStopResolver","recordingStatusUpdate","status","isFinished","url","constructor","api","events","setupUploadHandler","setupCurrentRecordSync","setupUriSync","id","controller","abort","delete","handleAudioUpload","uri","durationMs","formData","audioFileUri","uploadAudio","audioUploadPromise","then","data","update","catch","name","collectionItem","add","resolveStopWithCollectionItem","clock","filter","fn","target","record","setAudioFileDurationMs"],"sourceRoot":"../../../../../src","sources":["features/voiceRecord/model/VoiceRecord.model.ts"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,UAAU;AAC1F,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,kBAAkB,EAClBC,kBAAkB,EAClBC,+BAA+B,QAC1B,eAAY;AAEnB,SAASC,CAAC,QAAQ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AC;QAAEC,GAAG;QAAEpC;MAAW,CAAC,CAC5C;IACF,CAAC,CAAC;EACJ;EAEQ8B,YAAYA,CAAA,EAAG;IACrBrD,MAAM,CAAC;MACLoB,MAAM,EAAE,IAAI,CAACH,cAAc;MAC3B0D,EAAE,EAAGE,MAAM,IAAKA,MAAM,EAAElB,GAAG,IAAI,EAAE;MACjCiB,MAAM,EAAE9E,WAAW,CAAS,EAAE,CAAC,CAACe,KAAK,CAAC,IAAI,CAACA,KAAK;IAClD,CAAC,CAAC;EACJ;EAEQuC,sBAAsBA,CAAA,EAAG;IAC/BpD,MAAM,CAAC;MACLoB,MAAM,EAAE,IAAI,CAACJ,WAAW;MACxB2D,EAAE,EAAGpD,UAAU,IAAK,IAAI,CAACI,UAAU,CAACC,GAAG,CAACL,UAAU,CAAC;MACnDqD,MAAM,EAAEhF,YAAY,CAAE8B,aAAyC,IAAK;QAClE,IAAI,CAACA,aAAa,EAAE;UAClB,IAAI,CAACb,KAAK,CAAC,CAAC;UACZ;QACF;QAEA,IAAI,CAACD,gBAAgB,CAACc,aAAa,CAAC;QAEpC,IAAIA,aAAa,CAACkC,UAAU,EAAE;UAC5B,IAAI,CAACxB,aAAa,CAAC0C,sBAAsB,CAACpD,aAAa,CAACkC,UAAU,CAAC;QACrE;MACF,CAAC;IACH,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export class VoiceRecordApi {
|
|
3
|
+
export class VoiceRecordApi {
|
|
4
|
+
// public readonly uploadAudioFileFx
|
|
5
|
+
|
|
6
|
+
// public readonly abortUpload = createEffect(() => {
|
|
7
|
+
// if (this.uploadAudioFileFx.pending.getState()) {
|
|
8
|
+
// this.uploadAudioFileFx.controller.abort()
|
|
9
|
+
// }
|
|
10
|
+
// })
|
|
11
|
+
|
|
12
|
+
constructor(api) {
|
|
13
|
+
// this.uploadAudioFileFx = createControllerEffect((audioFileFormData: FormData, config) =>
|
|
14
|
+
// api.uploadAudioFile(
|
|
15
|
+
// { audioFileFormData },
|
|
16
|
+
// //@ts-ignore
|
|
17
|
+
// {
|
|
18
|
+
// signal: config?.signal,
|
|
19
|
+
// },
|
|
20
|
+
// ),
|
|
21
|
+
// )
|
|
22
|
+
}
|
|
23
|
+
}
|
|
4
24
|
//# sourceMappingURL=VoiceRecordApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VoiceRecordApi"],"sourceRoot":"../../../../../src","sources":["features/voiceRecord/model/VoiceRecordApi.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["VoiceRecordApi","constructor","api"],"sourceRoot":"../../../../../src","sources":["features/voiceRecord/model/VoiceRecordApi.ts"],"mappings":";;AAIA,OAAO,MAAMA,cAAc,CAAC;EAC1B;;EAEA;EACA;EACA;EACA;EACA;;EAEAC,WAAWA,CAACC,GAAa,EAAE;IACzB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;EAAA;AAEJ","ignoreList":[]}
|