Skip to content

Commit 5f76b48

Browse files
feat(UNT-T22353): audit changes
- remove assets folder inside src folder - remove a TODO - rename subscribeData listeners - remove audios from android raw folder
1 parent fdb68a9 commit 5f76b48

File tree

6 files changed

+18
-49
lines changed

6 files changed

+18
-49
lines changed
-201 KB
Binary file not shown.
-300 KB
Binary file not shown.
-1.01 MB
Binary file not shown.
-716 KB
Binary file not shown.

src/assets/index.ts

Whitespace-only changes.

src/components/Waveform/Waveform.tsx

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,11 @@ export const Waveform: <T extends StaticOrLive>(
8383
pausePlayer,
8484
onCurrentDuration,
8585
onDidFinishPlayingAudio,
86-
onCurrentExtractedWaveformData,
8786
onCurrentRecordingWaveformData,
8887
} = useAudioPlayer();
8988

90-
const {
91-
// getDecibel,
92-
startRecording,
93-
stopRecording,
94-
pauseRecording,
95-
resumeRecording,
96-
} = useAudioRecorder();
89+
const { startRecording, stopRecording, pauseRecording, resumeRecording } =
90+
useAudioRecorder();
9791

9892
const { checkHasAudioRecorderPermission } = useAudioPermission();
9993

@@ -354,33 +348,8 @@ export const Waveform: <T extends StaticOrLive>(
354348
}
355349
}, [seekPosition, panMoving, mode, songDuration]);
356350

357-
// TODO: to use this we have to remove conditions from onCurrentRecordingWaveformData and remove that code from native side also
358-
// useEffect(() => {
359-
// if (mode === 'live') {
360-
// const timerInterval = setInterval(() => {
361-
// if (isRecording) {
362-
// getDecibel()
363-
// .then((result: any) => {
364-
// setWaveform(prev => [...prev, result]);
365-
// if (scrollRef.current) {
366-
// scrollRef.current.scrollToEnd({ animated: true });
367-
// }
368-
// })
369-
// .catch((error: any) => {
370-
// console.error(`Error: ${error}`);
371-
// });
372-
// } else {
373-
// clearInterval(timerInterval);
374-
// }
375-
// }, updateTime);
376-
// return () => clearInterval(timerInterval);
377-
// } else {
378-
// return;
379-
// }
380-
// }, [getDecibel, isRecording, updateTime, mode]);
381-
382351
useEffect(() => {
383-
const subscribeData = onDidFinishPlayingAudio(async data => {
352+
const tracePlayerState = onDidFinishPlayingAudio(async data => {
384353
if (data.playerKey === `PlayerFor${path}`) {
385354
if (data.finishType === FinishMode.stop) {
386355
setPlayerState(PlayerState.stopped);
@@ -389,29 +358,29 @@ export const Waveform: <T extends StaticOrLive>(
389358
}
390359
}
391360
});
392-
const subscribeData2 = onCurrentDuration(data => {
361+
362+
const tracePlaybackValue = onCurrentDuration(data => {
393363
if (data.playerKey === `PlayerFor${path}`) {
394364
setCurrentProgress(data.currentDuration);
395365
}
396366
});
397-
const subscribeData3 = onCurrentExtractedWaveformData(() => {
398-
// write logic for subscription
399-
});
400-
const subscribeData4 = onCurrentRecordingWaveformData(result => {
401-
if (mode === 'live') {
402-
if (!isNil(result.currentDecibel)) {
403-
setWaveform(prev => [...prev, result.currentDecibel]);
404-
if (scrollRef.current) {
405-
scrollRef.current.scrollToEnd({ animated: true });
367+
368+
const traceRecorderWaveformValue = onCurrentRecordingWaveformData(
369+
result => {
370+
if (mode === 'live') {
371+
if (!isNil(result.currentDecibel)) {
372+
setWaveform(prev => [...prev, result.currentDecibel]);
373+
if (scrollRef.current) {
374+
scrollRef.current.scrollToEnd({ animated: true });
375+
}
406376
}
407377
}
408378
}
409-
});
379+
);
410380
return () => {
411-
subscribeData.remove();
412-
subscribeData2.remove();
413-
subscribeData3.remove();
414-
subscribeData4.remove();
381+
tracePlayerState.remove();
382+
tracePlaybackValue.remove();
383+
traceRecorderWaveformValue.remove();
415384
};
416385
}, []);
417386

0 commit comments

Comments
 (0)