This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,171 @@
// Metro module 11416 (f11417).
import MediaEngineStore from "../../../stores/MediaEngineStore";
import { VoiceMessageRecordingStatus, addVoiceMessageWave, resetVoiceMessageState, setSavedVoiceMessageUploadData, setVoiceMessageRecordingId, setVoiceMessageRecordingState, setVoiceMessageStartTimeMillis, useVoiceMessagesUIStore } from "./VoiceMessagesUIStore";
import { VOICE_RECORDING_MAX_DB, VOICE_RECORDING_MAX_DURATION_MILLIS, VOICE_RECORDING_MIN_DB, WAVEFORM_MAX_SAMPLES, WAVEFORM_WAVE_MAX_VALUE } from "../VoiceMessageConstants";
import { AnalyticEvents } from "../../../Constants";
import Logger from "../../debug/Logger";
import downsampleWaveform from "../downsampleWaveform";
import Module206 from "../../../_bundle/Module206";
import Module12 from "../../../_bundle/Module12";
import { MediaEngineEvent } from "../../../_bundle/Module4286";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { triggerHapticFeedback, HapticFeedbackTypes } from "../../haptics/HapticUtils.native";
import { isAndroid } from "../../../utils/PlatformUtils";
let initialize_secs, c7765_20, c7765_21, stopAndGetAudioRecording, stopAndCacheAudioRecording, $mk87149 = function() {
return (a0) => Math.min(a0, WAVEFORM_WAVE_MAX_VALUE);
};
const resetAudioRecording = function resetAudioRecording() {
MediaEngineStore.getMediaEngine().removeListener(MediaEngineEvent.VoiceActivity, c7765_21);
resetVoiceMessageState();
};
stopAndGetAudioRecording = function stopAndGetAudioRecording() {
setVoiceMessageRecordingId(null);
setVoiceMessageRecordingState(null);
const r19 = useVoiceMessagesUIStore.getState().waveform.map((item) => {
const [r8] = item;
return r8;
});
const r6 = r19.length <= WAVEFORM_MAX_SAMPLES ? r19 : downsampleWaveform(r19, WAVEFORM_MAX_SAMPLES);
const waveform = Module206.fromByteArray(new Uint8Array(r6.map($mk87149())));
return new Promise((c27061_0) => {
MediaEngineStore.getMediaEngine().stopLocalAudioRecording((a0, a1) => {
c27061_0({
filename: a0,
durationSecs: a1 / 1000,
waveform
});
});
});
};
stopAndCacheAudioRecording = async function stopAndCacheAudioRecording() {
let c27063_1;
c27063_1 = void 0;
let c30404_0 = await stopAndGetAudioRecording();
MediaEngineStore.getMediaEngine().removeListener(MediaEngineEvent.VoiceActivity, c7765_21);
(0, setSavedVoiceMessageUploadData)(c30404_0);
};
initialize_secs = null;
c7765_20 = new Logger("VoiceMessages");
c7765_21 = Module12.throttle((a0) => {
const state = useVoiceMessagesUIStore.getState();
if (state.startTimeMillis != null) {
addVoiceMessageWave(WAVEFORM_WAVE_MAX_VALUE * ((a0 - VOICE_RECORDING_MIN_DB) / (VOICE_RECORDING_MAX_DB - VOICE_RECORDING_MIN_DB)));
if (state.savedVoiceMessageUploadData == null && performance.now() - state.startTimeMillis >= VOICE_RECORDING_MAX_DURATION_MILLIS) {
stopAndCacheAudioRecording();
}
}
}, 100);
export function generateBase64EncodedWaveform(a0) {
return Module206.fromByteArray(new Uint8Array((a0.length <= WAVEFORM_MAX_SAMPLES ? a0 : downsampleWaveform(a0, WAVEFORM_MAX_SAMPLES)).map($mk87149())));
}
export async function startAudioRecording(c27060_0) {
let c27060_3;
let c27060_4 = 0;
let c30402_0, c30402_1, c30402_2;
L12: {
try {
c30402_0 = c27060_0;
c30402_1 = void 0;
initialize_secs = null;
setVoiceMessageRecordingState(VoiceMessageRecordingStatus.REQUESTED);
setVoiceMessageRecordingId(c27060_0);
MediaEngineStore.getMediaEngine().on(MediaEngineEvent.VoiceActivity, c7765_21);
c27060_4 = 1;
c30402_1 = performance.now();
await MediaEngineStore.getMediaEngine().startLocalAudioRecording({
echoCancellation: MediaEngineStore.getEchoCancellation(),
echoCancellationPreEcho: false,
noiseSuppression: MediaEngineStore.getNoiseSuppression(),
automaticGainControlConfig: {
enabled: MediaEngineStore.getAutomaticGainControl()
},
noiseCancellation: MediaEngineStore.getNoiseCancellation()
});
initialize_secs = performance.now() - c30402_1;
c7765_20.log("Voice message audio startup latency:", initialize_secs);
if (useVoiceMessagesUIStore.getState().recordingId !== c30402_0) {
c27060_4 = 0;
break L12;
}
(0, setVoiceMessageRecordingState)(VoiceMessageRecordingStatus.STARTED);
(0, setVoiceMessageStartTimeMillis)(Date.now());
c27060_4 = 0;
} catch ($e) {
const r29 = $e;
let r8 = r29;
c27060_3 = r29;
if (c27060_4 !== 0) {
while (true) {
try {
const r116 = c27060_3;
c27060_4 = 0;
c30402_2 = r116;
(0, resetAudioRecording)();
throw c30402_2;
} catch (r112) {
r8 = r112;
c27060_3 = r112;
if (c27060_4 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
}
export async function endAudioRecording() {
let r74;
let c27062_1;
let c30403_0, c30403_1;
L17: {
c27062_1 = void 0;
c30403_0 = void 0;
c30403_1 = void 0;
const state = useVoiceMessagesUIStore.getState();
c30403_0 = state.savedVoiceMessageUploadData;
if (c30403_0 == null && state.recordingStatus === VoiceMessageRecordingStatus.REQUESTED) {
stopAndGetAudioRecording();
c30403_0 = {
filename: "",
durationSecs: 0,
waveform: ""
};
}
if (c30403_0 == null) {
c30403_0 = await stopAndGetAudioRecording();
c30403_1 = useVoiceMessagesUIStore.getState().startTimeMillis;
(0, resetAudioRecording)();
r74 = {
data: c30403_0,
startTimeMillis: c30403_1
};
break L17;
}
c30403_1 = useVoiceMessagesUIStore.getState().startTimeMillis;
(0, resetAudioRecording)();
return {
data: c30403_0,
startTimeMillis: c30403_1
};
}
return r74;
}
export { stopAndCacheAudioRecording };
export function emitVoiceMessageRecorded(a0, a1, a2) {
if (a2 != null) {
AnalyticsUtils.track(AnalyticEvents.VOICE_MESSAGE_RECORDED, {
recording_start_timestamp: a2,
recording_stop_timestamp: Date.now(),
duration_secs: a1,
result: a0,
initialize_secs
});
initialize_secs = null;
}
}
export function triggerHaptic() {
triggerHapticFeedback(isAndroid() ? HapticFeedbackTypes.IMPACT_LIGHT : HapticFeedbackTypes.IMPACT_MEDIUM);
}
@@ -0,0 +1,121 @@
// Metro module 13596 (f13597).
import { AppState, NativeModules } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import { isAndroid } from "../../../utils/PlatformUtils";
import Module13597 from "../../../_bundle/Module13597";
import LifecycleManager from "../../../lib/LifecycleManager";
import Dispatcher from "../../../Dispatcher";
import Module4587 from "../../../_bundle/Module4587";
class VoiceMessagesPlaybackManager extends LifecycleManager {
appState = AppState.currentState;
handleSetPrefersReducedMotion = (a0) => {
if (isAndroid()) {
Module4587.handleSetPrefersReducedMotion(a0.prefersReducedMotion);
} else {
NativeModules.DCDAccessibilityManager.handleSetPrefersReducedMotion(a0.prefersReducedMotion);
}
};
handleMessageDelete = (a0) => {
const id = a0.id;
if (a0.channelId === SelectedChannelStore.getCurrentlySelectedChannelId()) {
if (isAndroid()) {
Module13597.handleVoiceMessageDeleted(id);
} else {
const DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
if (DCDAudioPlayerManager != null) {
DCDAudioPlayerManager.handleVoiceMessageDeleted(id);
}
}
}
};
handleLogout = () => {
if (isAndroid()) {
Module13597.pauseCurrentPlayer(false);
} else {
const DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
if (DCDAudioPlayerManager != null) {
DCDAudioPlayerManager.pauseCurrentPlayer(false);
}
}
};
handleAppStateChanged = (a0) => {
L14: {
const state = a0.state;
if (isAndroid()) {
const appState = this.appState;
this.appState = state;
if (state === "active" && appState !== "active") {
if (isAndroid()) {
Module13597.maybePlayCurrentPlayer();
break L14;
}
const DCDAudioPlayerManager2 = NativeModules.DCDAudioPlayerManager;
if (DCDAudioPlayerManager2 == null) {
break L14;
}
DCDAudioPlayerManager2.maybePlayCurrentPlayer();
break L14;
}
if (state !== "active" && appState === "active") {
if (isAndroid()) {
Module13597.pauseCurrentPlayer(true);
} else {
const DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
if (DCDAudioPlayerManager != null) {
DCDAudioPlayerManager.pauseCurrentPlayer(true);
}
}
}
}
}
};
_terminate() {
Dispatcher.unsubscribe("LOGOUT", this.handleLogout);
Dispatcher.unsubscribe("MESSAGE_DELETE", this.handleMessageDelete);
Dispatcher.unsubscribe("APP_STATE_UPDATE", this.handleAppStateChanged);
Dispatcher.unsubscribe("ACCESSIBILITY_SET_PREFERS_REDUCED_MOTION", this.handleSetPrefersReducedMotion);
}
_initialize() {
Dispatcher.subscribe("LOGOUT", this.handleLogout);
Dispatcher.subscribe("MESSAGE_DELETE", this.handleMessageDelete);
Dispatcher.subscribe("APP_STATE_UPDATE", this.handleAppStateChanged);
Dispatcher.subscribe("ACCESSIBILITY_SET_PREFERS_REDUCED_MOTION", this.handleSetPrefersReducedMotion);
this.handleSetPrefersReducedMotion({
type: "ACCESSIBILITY_SET_PREFERS_REDUCED_MOTION",
prefersReducedMotion: AccessibilityStore.rawPrefersReducedMotion
});
}
}
const voiceMessagesPlaybackManager = new VoiceMessagesPlaybackManager();
export default voiceMessagesPlaybackManager;
export function pauseCurrentAudioPlayer(a0) {
if (isAndroid()) {
Module13597.pauseCurrentPlayer(a0);
} else {
const DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
if (DCDAudioPlayerManager != null) {
DCDAudioPlayerManager.pauseCurrentPlayer(a0);
}
}
}
export function playCurrentAudioPlayer() {
if (isAndroid()) {
Module13597.maybePlayCurrentPlayer();
} else {
const DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
if (DCDAudioPlayerManager != null) {
DCDAudioPlayerManager.maybePlayCurrentPlayer();
}
}
}
export function handleVoiceMessageDeleted(a0) {
if (isAndroid()) {
Module13597.handleVoiceMessageDeleted(a0);
} else {
const DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
if (DCDAudioPlayerManager != null) {
DCDAudioPlayerManager.handleVoiceMessageDeleted(a0);
}
}
}
@@ -0,0 +1,129 @@
// Metro module 11153 (f11154).
import { VoiceMessageAnimationState, WAVEFORM_WAVE_MAX_VALUE } from "../VoiceMessageConstants";
import { create } from "../../../_bundle/Module644";
import { makeMutable } from "../../reanimated/ReanimatedRexport";
import { batchUpdates } from "../../../_bundle/Module705";
import { withSpring } from "../../../design/animation/reanimated/spring/spring";
let c7539_5;
const r16 = {
REQUESTED: 0,
0: "REQUESTED",
STARTED: 1,
1: "STARTED"
};
let c7539_4 = create(() => ({
voiceMessageAnimationState: makeMutable([VoiceMessageAnimationState.SENDING, VoiceMessageAnimationState.SENDING]),
recordingStatus: null,
recordingId: null,
currWaveHeight: void 0,
showRecordingOverlay: false,
startTimeMillis: void 0,
waveform: [],
waveformVersion: 0,
showVoiceMessagesTooltip: false,
savedVoiceMessageUploadData: void 0,
isVoiceMessageButtonMounted: false,
isUsingHoldGesture: false
}));
c7539_5 = c7539_4;
export { r16 as VoiceMessageRecordingStatus };
export { c7539_4 as useVoiceMessagesUIStore };
export function setShowRecordingOverlay(showRecordingOverlay) {
batchUpdates(() => {
c7539_4.setState({
showRecordingOverlay
});
});
}
export function setVoiceMessageRecordingState(recordingStatus) {
batchUpdates(() => {
c7539_4.setState({
recordingStatus
});
});
}
export function setVoiceMessageRecordingId(recordingId) {
batchUpdates(() => {
c7539_4.setState({
recordingId
});
});
}
export function setVoiceMessageStartTimeMillis(startTimeMillis) {
batchUpdates(() => {
c7539_4.setState({
startTimeMillis
});
});
}
export function setVoiceMessageAnimationState(c18570_0) {
batchUpdates(() => {
c7539_4.setState({
...c18570_0
});
});
}
export function addVoiceMessageWave(a0) {
const waveform = c7539_5.getState().waveform;
const waveformVersion = c7539_5.getState().waveformVersion;
const currWaveHeight = c7539_5.getState().currWaveHeight;
if (currWaveHeight != null) {
currWaveHeight.set(withSpring(a0 / WAVEFORM_WAVE_MAX_VALUE));
}
waveform.push([a0, waveformVersion]);
batchUpdates(() => {
c7539_4.setState({
waveformVersion: waveformVersion + 1
});
});
}
export function showVoiceMessagesTooltip() {
batchUpdates(() => {
c7539_4.setState({
showVoiceMessagesTooltip: true
});
});
}
export function hideVoiceMessagesTooltip() {
batchUpdates(() => {
c7539_4.setState({
showVoiceMessagesTooltip: false
});
});
}
export function resetVoiceMessageState() {
batchUpdates(() => {
c7539_4.setState({
waveform: [],
waveformVersion: 0,
showRecordingOverlay: false,
startTimeMillis: void 0,
savedVoiceMessageUploadData: void 0
});
});
const currWaveHeight = c7539_5.getState().currWaveHeight;
if (currWaveHeight != null) {
currWaveHeight.set(withSpring(0));
}
}
export function setSavedVoiceMessageUploadData(savedVoiceMessageUploadData) {
batchUpdates(() => {
c7539_4.setState({
savedVoiceMessageUploadData
});
});
}
export function setIsVoiceMessageButtonMounted(isVoiceMessageButtonMounted) {
batchUpdates(() => {
c7539_4.setState({
isVoiceMessageButtonMounted
});
});
}
export function setIsUsingHoldGesture(isUsingHoldGesture) {
batchUpdates(() => {
c7539_4.setState({
isUsingHoldGesture
});
});
}
@@ -0,0 +1,542 @@
// Metro module 11415 (f11416).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { memo, useRef, useCallback, useEffect, useMemo } from "react";
import { View, AppState } from "react-native";
import ActionSheetStore from "../../../action_sheet/native/ActionSheetStore";
import PendingReplyStore from "../../../replies/PendingReplyStore";
import ChannelStore from "../../../../stores/ChannelStore";
import * as _VoiceMessagesUIStore from "../VoiceMessagesUIStore";
import { useVoiceMessagesUIStore, showVoiceMessagesTooltip, setIsVoiceMessageButtonMounted, setVoiceMessageAnimationState, hideVoiceMessagesTooltip, setShowRecordingOverlay } from "../VoiceMessagesUIStore";
import * as _VoiceMessageConstants from "../../VoiceMessageConstants";
import { VOICE_RECORDING_MIN_DURATION_MILLIS } from "../../VoiceMessageConstants";
import { MessageFlags, ComponentActionsKeyed, ComponentActions } from "../../../../Constants";
import { MessageSendLocation } from "../../../messages/MessageConstants";
import { NativePermissionTypes } from "../../../native_permissions/NativePermissionConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { XSmallBoldIcon } from "../../../../design/components/Icon/native/redesign/generated/XSmallBoldIcon";
import * as _NavigationRouteUtils_native from "../../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { useIsModalOpen, getOpenModalKey } from "../../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { isVoiceChannelModalKey } from "../../../../utils/native/PrivateChannelCallUtils";
import { triggerHaptic, endAudioRecording, emitVoiceMessageRecorded, startAudioRecording } from "../VoiceMessageUtils";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useSharedValue } from "../../../reanimated/ReanimatedRexport";
import { useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useClientThemesOverride } from "../../../client_themes/native/ClientThemesOverrides";
import useChatWidth from "../../../chat/native/useChatWidth";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import { VoiceMessageRecordingResult } from "../../VoiceMessageAnalytics";
import { CloudUpload } from "../../../../lib/uploader/CloudUpload";
import { UploadPlatform } from "../../../../lib/uploader/Upload";
import MessageActionCreators from "../../../../actions/MessageActionCreators";
import { handleUploadMessageAttachmentsErrors } from "../../../media_uploads/handleUploadAttachmentErrors.native";
import { deletePendingReply } from "../../../replies/PendingReplyActionCreators";
import { ComponentDispatch } from "../../../../utils/ComponentDispatchUtils";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import * as _index_native from "../../../../intl/index.native";
import { intl } from "../../../../intl/index.native";
import { getFocusedChannelId } from "../../../panels/isChannelFocused.native";
import { getRootNavigationRef } from "../../../main_tabs_v2/RootNavigationRef.native";
import NativePermissionUtils from "../../../native_permissions/NativePermissionUtils";
import { showVoiceRecordingFailed } from "../../../toast/native/ToastUtils";
import useAccessibilityPress from "../../../a11y/native/useAccessibilityPress";
import { GestureDetector, Gesture } from "../../../../_bundle/Module5273";
import useVoiceMessageTooltip from "../useVoiceMessageTooltip";
import ChatInputActionButton from "../../../chat_input/native/action_buttons/ChatInputActionButton";
import { MicrophoneIcon } from "../../../../design/components/Icon/native/redesign/generated/MicrophoneIcon";
function $mk118322($env) {
return (a0, a1, a2) => {
handleUploadMessageAttachmentsErrors({
file: a0,
guildId: $env[5].getGuildId(),
analyticsLocations: [],
code: a1,
reason: a2
});
};
}
let triggerHapticGuarded, useStyles, useStyles2, c7764_30, c7764_31, c7764_32, c7764_33;
let env7764 = {};
const VoiceMessageRecordingCancelledToastIcon = function VoiceMessageRecordingCancelledToastIcon() {
return <View style={useStyles().icon} aria-hidden>
<XSmallBoldIcon color={Module712.colors.WHITE} size="xs" />
</View>;
};
triggerHapticGuarded = function triggerHapticGuarded() {
if (useVoiceMessagesUIStore.getState().showRecordingOverlay) {
triggerHaptic();
}
};
useStyles = createStyles({
icon: {
backgroundColor: Module712.colors.BACKGROUND_FEEDBACK_CRITICAL,
borderRadius: Module712.radii.round,
padding: Module712.space.PX_4,
marginLeft: Module712.space.PX_4
}
});
useStyles2 = createStyles({
themedChatInput: {
backgroundColor: Module712.colors.CARD_SECONDARY_BG
}
});
c7764_30 = {
code: "function VoiceMessageButtonTsx1(newValue){const{voiceMessageAnimationState,runOnJS,triggerHapticGuarded}=this.__closure;if(voiceMessageAnimationState.get()[1]===newValue)return;const prevValue=voiceMessageAnimationState.get()[1];voiceMessageAnimationState.set([prevValue,newValue]);runOnJS(triggerHapticGuarded)();}"
};
c7764_31 = {
code: "function VoiceMessageButtonTsx2(){const{runOnJS,handleFinalize}=this.__closure;runOnJS(handleFinalize)();}"
};
c7764_32 = {
code: "function VoiceMessageButtonTsx3(e){const{isGestureActiveValue,LOCK_THRESHOLD,cancelThresholdX,handleUpdateValue,VoiceMessageAnimationState}=this.__closure;if(!isGestureActiveValue.get())return;if(e.translationY<=-LOCK_THRESHOLD&&e.absoluteX>=cancelThresholdX){handleUpdateValue(VoiceMessageAnimationState.LOCKING);}else if(e.absoluteX<cancelThresholdX){handleUpdateValue(VoiceMessageAnimationState.CANCELLING);}else if(e.absoluteX>=cancelThresholdX){handleUpdateValue(VoiceMessageAnimationState.SENDING);}}"
};
c7764_33 = {
code: "function VoiceMessageButtonTsx4(e){const{isGestureActiveValue,runOnJS,setIsUsingHoldGesture,voiceMessageAnimationState,VoiceMessageAnimationState,startRecording}=this.__closure;if(e.numberOfTouches>1)return;if(isGestureActiveValue.get())return;runOnJS(setIsUsingHoldGesture)(true);voiceMessageAnimationState.set([VoiceMessageAnimationState.SENDING,VoiceMessageAnimationState.SENDING]);runOnJS(startRecording)();}"
};
const r96 = memo(function(a0) {
let ref, sharedValue;
let c18818_0;
let env18816 = {
$parent: env7764
};
const disabled = a0.disabled;
env18816[0] = disabled;
const channelId = a0.channelId;
env18816[1] = channelId;
env18816[2] = void 0;
env18816[3] = void 0;
env18816[4] = void 0;
env18816[5] = void 0;
env18816[6] = void 0;
env18816[7] = void 0;
env18816[8] = void 0;
env18816[9] = void 0;
env18816[10] = void 0;
env18816[11] = void 0;
env18816[12] = void 0;
env18816[13] = void 0;
env18816[14] = void 0;
const styles2 = useStyles2();
const chatInputFloating = useMobileVisualRefreshConfig({
location: "VoiceMessageButton"
}).chatInputFloating;
const clientThemesOverride = useClientThemesOverride(styles2.themedChatInput);
const voiceMessageAnimationState = (0, useVoiceMessagesUIStore)((a0) => a0.voiceMessageAnimationState);
env18816[2] = voiceMessageAnimationState;
const sharedValue2 = useSharedValue(0);
env18816[3] = sharedValue2;
ref = void 0;
sharedValue = void 0;
ref = useRef(false);
sharedValue = useSharedValue(false);
const r52 = _slicedToArray([ref, sharedValue, useCallback((a0) => {
ref.current = a0;
sharedValue.set(a0);
}, [ref, sharedValue])], 3);
const r23 = r52[0];
env18816[4] = r23;
const r20 = r52[1];
env18816[5] = r20;
const r53 = r52[2];
env18816[6] = r53;
env18816[7] = useRef(true);
env18816[8] = useRef(AppState.currentState);
env18816[9] = useRef(null);
const chatWidth = useChatWidth();
const width = useWindowDimensions_native().width;
c18818_0 = void 0;
c18818_0 = async (c30400_0) => {
let c30400_1, c30400_2;
L21: {
L20: {
let env31624;
c30400_2 = void 0;
const r9 = env31624 = {
$parent: env7764
};
c30400_1 = r9;
env31624[0] = void 0;
env31624[1] = void 0;
env31624[0] = c30400_0.isCancelling;
let cancelReason = c30400_0.cancelReason;
if (cancelReason === void 0) {
cancelReason = VoiceMessageRecordingResult.CANCELLED_USER_REQUESTED;
}
env31624[1] = cancelReason;
env31624[2] = void 0;
env31624[3] = void 0;
env31624[4] = void 0;
env31624[5] = void 0;
env31624[6] = void 0;
env31624[7] = void 0;
env31624[8] = void 0;
await void 0;
const r70 = await endAudioRecording();
const r79 = c30400_2;
env31624[2] = r70;
env31624[3] = env31624[2].data;
env31624[4] = env31624[2].startTimeMillis;
(0, r79.$parent[6])(false);
const r89 = env31624[0];
const r91 = c30400_2;
if (r89) {
r91.$parent[9].current = env31624[1];
emitVoiceMessageRecorded(env31624[1], env31624[3].durationSecs, env31624[4]);
break L21;
}
if (env31624[3].durationSecs < VOICE_RECORDING_MIN_DURATION_MILLIS / 1000) {
emitVoiceMessageRecorded(VoiceMessageRecordingResult.CANCELLED_DURATION, env31624[3].durationSecs, env31624[4]);
(0, showVoiceMessagesTooltip)();
break L20;
}
const r131 = c30400_2;
emitVoiceMessageRecorded(VoiceMessageRecordingResult.SENT, env31624[3].durationSecs, env31624[4]);
env31624[5] = ChannelStore.getChannel(r131.$parent[1]);
if (env31624[5] != null) {
const r154 = c30400_1;
const r155 = c30400_2;
env31624[6] = [new CloudUpload({
uri: env31624[3].filename,
originalUri: env31624[3].filename,
mimeType: "audio/ogg",
filename: "voice-message.ogg",
platform: UploadPlatform.REACT_NATIVE,
durationSecs: env31624[3].durationSecs,
waveform: env31624[3].waveform
}, env31624[5].id)];
const r184 = r155.$parent;
env31624[7] = PendingReplyStore.getPendingReply(r184[1]);
env31624[8] = MessageActionCreators.getSendMessageOptionsForReply(env31624[7]);
MessageActionCreators.sendMessage(env31624[5].id, {
content: "",
tts: false,
invalidEmojis: [],
validNonShortcutEmojis: []
}, void 0, {
flags: MessageFlags.IS_VOICE_MESSAGE,
location: MessageSendLocation.VOICE_MESSAGE,
attachmentsToUpload: env31624[6],
onAttachmentUploadError: $mk118322(r154),
...env31624[8]
});
deletePendingReply(r184[1]);
}
return void 0;
}
return void 0;
}
};
const callback = useCallback(function() {
return c18818_0.apply(this, arguments);
}, [channelId, r53]);
env18816[10] = callback;
useEffect(() => {
ComponentDispatch.subscribeKeyed(ComponentActionsKeyed.VOICE_MESSAGE_SEND, env18816[1], env18816[10]);
return () => {
ComponentDispatch.unsubscribeKeyed(ComponentActionsKeyed.VOICE_MESSAGE_SEND, env18816[1], env18816[10]);
};
}, [channelId, callback]);
useEffect(() => {
(0, setIsVoiceMessageButtonMounted)(true);
return () => {
(0, setIsVoiceMessageButtonMounted)(false);
};
}, []);
useEffect(() => {
let c27055_0 = AppState.addEventListener("change", function(a0) {
const r4 = env18816[8];
const current3 = r4.current;
const r15 = env18816[9];
const current2 = r15.current;
const CANCELLED_ON_BACKGROUND = VoiceMessageRecordingResult.CANCELLED_ON_BACKGROUND;
if (!(a0 !== "active" || current3 !== "inactive" && current3 !== "background" || !(current2 === CANCELLED_ON_BACKGROUND))) {
ToastActionCreators.open({
key: "VOICE_MESSAGE_CANCELLED_ON_BACKGROUND",
content: intl.string(_index_native.t.JM7Y2D),
icon: () => (0, jsx)(VoiceMessageRecordingCancelledToastIcon, {}),
position: "bottom"
});
r15.current = null;
}
r4.current = a0;
});
return () => {
c27055_0.remove();
};
}, []);
useEffect(() => {
env18816[7].current = true;
const current = env18816[4].current;
return () => {
env18816[7].current = false;
const state = useVoiceMessagesUIStore.getState();
if (state.showRecordingOverlay || state.recordingStatus != null || current) {
(0, env18816[6])(false);
endAudioRecording();
}
};
}, [r23, r53]);
const isModalOpen = useIsModalOpen();
useEffect(() => {
let _cancel2, handleActionSheetChange2, handleNavigationChange2;
const cancel2 = function cancel() {
return _cancel2.apply(this, arguments);
};
_cancel2 = function _cancel() {
const r9 = async () => {
let c31625_1;
let c32028_0;
L15: {
L11: {
c31625_1 = void 0;
c32028_0 = void 0;
const state = useVoiceMessagesUIStore.getState();
if (!state.showRecordingOverlay && state.recordingStatus == null && !env18816[4].current) {
break L11;
}
(0, env18816[6])(false);
c32028_0 = await endAudioRecording();
emitVoiceMessageRecorded(VoiceMessageRecordingResult.CANCELLED_GESTURE_CONFLICT, c32028_0.data.durationSecs, c32028_0.startTimeMillis);
break L15;
}
return void 0;
}
};
_cancel2 = r9;
return r9.apply(this, arguments);
};
handleActionSheetChange2 = function handleActionSheetChange() {
if (ActionSheetStore.isOpen()) {
cancel2();
}
};
handleNavigationChange2 = function handleNavigationChange() {
const focusedChannelId = getFocusedChannelId();
if (focusedChannelId != null) {
if (focusedChannelId !== env18816[1]) {
cancel2();
}
} else {
cancel2();
}
};
cancel2();
ActionSheetStore.addReactChangeListener(handleActionSheetChange2);
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.addListener("state", handleNavigationChange2);
}
return () => {
ActionSheetStore.removeReactChangeListener(handleActionSheetChange2);
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.removeListener("state", handleNavigationChange2);
}
};
}, [r23, r53, channelId]);
useEffect(() => {
(0, setVoiceMessageAnimationState)({
currWaveHeight: env18816[3]
});
}, [sharedValue2, isModalOpen]);
const callback2 = useCallback(async () => {
let c27058_0, c27058_1, c27058_2;
let c27058_3 = 0;
const r12 = env18816;
const r11 = env7764;
L26: {
L25: {
try {
let env30401;
c27058_1 = r12;
const r31 = env30401 = {
$parent: r11
};
c27058_0 = r31;
env30401[0] = void 0;
env30401[1] = void 0;
if ((function isNormalModalOpen() {
if (_NavigationRouteUtils_native.isModalOpen()) {
const openModalKey = getOpenModalKey();
return openModalKey == null || !isVoiceChannelModalKey(openModalKey);
}
return false;
})()) {
break L26;
}
if (!env18816[7].current) {
break L26;
}
if (ActionSheetStore.isOpen()) {
break L26;
}
if (ChannelStore.getChannel(env18816[1]) == null) {
break L26;
}
(0, env18816[6])(true);
ComponentDispatch.dispatch(ComponentActions.VOICE_MESSAGE_BUTTON_PRESSED);
if (!await NativePermissionUtils.requestPermission(NativePermissionTypes.AUDIO)) {
break L25;
}
if (!env18816[4].current) {
break L25;
}
(0, hideVoiceMessagesTooltip)();
env30401[0] = performance.now();
(0, setShowRecordingOverlay)(true);
c27058_3 = 1;
await startAudioRecording(env30401[0]);
c27058_3 = 0;
env30401[1] = useVoiceMessagesUIStore.getState();
if (env30401[1].recordingId !== env30401[0]) {
break L25;
}
const voiceMessageAnimationState = env30401[1].voiceMessageAnimationState;
if ((voiceMessageAnimationState == null ? void 0 : voiceMessageAnimationState.get()[1]) !== _VoiceMessageConstants.VoiceMessageAnimationState.LOCKED && !env18816[4].current) {
endAudioRecording();
break L25;
}
triggerHaptic();
} catch ($e) {
const r29 = $e;
let r7 = r29;
c27058_2 = r29;
if (c27058_3 !== 0) {
while (true) {
try {
c27058_3 = 0;
(0, env18816[6])(false);
showVoiceRecordingFailed();
} catch (r166) {
r7 = r166;
c27058_2 = r166;
if (c27058_3 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r7;
}
}
return void 0;
}
}, [r23, r53, channelId]);
env18816[11] = callback2;
const Z = function Z(a0) {
const r3 = env18816[2];
if (r3.get()[1] !== a0) {
r3.set([r3.get()[1], a0]);
_ReanimatedRexport.runOnJS(triggerHapticGuarded)();
}
};
Z.__closure = {
voiceMessageAnimationState,
runOnJS: _ReanimatedRexport.runOnJS,
triggerHapticGuarded
};
Z.__workletHash = 9127775028714;
Z.__initData = c7764_30;
const callback3 = useCallback(Z, [voiceMessageAnimationState]);
env18816[12] = callback3;
const callback4 = useCallback(() => {
if (env18816[4].current) {
(0, env18816[6])(false);
const r6 = env18816[2];
const r5 = r6.get()[1];
if (_VoiceMessageConstants.VoiceMessageAnimationState.SENDING === r5) {
(0, env18816[10])({
isCancelling: false
});
} else if (_VoiceMessageConstants.VoiceMessageAnimationState.CANCELLING === r5) {
(0, env18816[10])({
isCancelling: true
});
} else {
if (_VoiceMessageConstants.VoiceMessageAnimationState.LOCKING === r5) {
(0, _VoiceMessagesUIStore.setIsUsingHoldGesture)(false);
r6.set([_VoiceMessageConstants.VoiceMessageAnimationState.LOCKING, _VoiceMessageConstants.VoiceMessageAnimationState.LOCKED]);
_ReanimatedRexport.runOnJS(triggerHapticGuarded)();
return void 0;
}
endAudioRecording();
}
} else {
endAudioRecording();
}
}, [voiceMessageAnimationState, r23, callback, r53]);
env18816[13] = callback4;
const accessibilityPress = useAccessibilityPress(async () => {
let c27059_0 = env18816;
await (0, env18816[11])();
(0, _VoiceMessagesUIStore.setIsUsingHoldGesture)(false);
env18816[2].set([_VoiceMessageConstants.VoiceMessageAnimationState.LOCKED, _VoiceMessageConstants.VoiceMessageAnimationState.LOCKED]);
}, intl.string(_index_native.t.lwy6aX));
const { accessibilityActions, onAccessibilityAction } = accessibilityPress;
const r142 = 0.5 * chatWidth + (width - chatWidth);
env18816[14] = r142;
return <GestureDetector gesture={useMemo(() => {
const r20 = Gesture.Pan().enabled(!env18816[0]).minDistance(0);
const n = function n(a0) {
if (!(a0.numberOfTouches > 1 || env18816[5].get())) {
_ReanimatedRexport.runOnJS(_VoiceMessagesUIStore.setIsUsingHoldGesture)(true);
env18816[2].set([_VoiceMessageConstants.VoiceMessageAnimationState.SENDING, _VoiceMessageConstants.VoiceMessageAnimationState.SENDING]);
_ReanimatedRexport.runOnJS(env18816[11])();
}
};
const isGestureActiveValue = env18816[5];
n.__closure = {
isGestureActiveValue,
runOnJS: _ReanimatedRexport.runOnJS,
setIsUsingHoldGesture: _VoiceMessagesUIStore.setIsUsingHoldGesture,
voiceMessageAnimationState: env18816[2],
VoiceMessageAnimationState: _VoiceMessageConstants.VoiceMessageAnimationState,
startRecording: env18816[11]
};
n.__workletHash = 15771181123252;
n.__initData = c7764_33;
const r30 = r20.onTouchesDown(n);
const t = function t(a0) {
L8: {
if (env18816[5].get()) {
if (a0.translationY <= -40 && a0.absoluteX >= env18816[14]) {
(0, env18816[12])(_VoiceMessageConstants.VoiceMessageAnimationState.LOCKING);
break L8;
}
const absoluteX = a0.absoluteX;
const r10 = env18816[14];
if (absoluteX < r10) {
(0, env18816[12])(_VoiceMessageConstants.VoiceMessageAnimationState.CANCELLING);
} else if (a0.absoluteX >= r10) {
(0, env18816[12])(_VoiceMessageConstants.VoiceMessageAnimationState.SENDING);
}
}
}
};
t.__closure = {
isGestureActiveValue,
LOCK_THRESHOLD: 40,
cancelThresholdX: env18816[14],
handleUpdateValue: env18816[12],
VoiceMessageAnimationState: _VoiceMessageConstants.VoiceMessageAnimationState
};
t.__workletHash = 9262214665783;
t.__initData = c7764_32;
const r38 = r30.onUpdate(t);
const e = function e() {
_ReanimatedRexport.runOnJS(env18816[13])();
};
e.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handleFinalize: env18816[13]
};
e.__workletHash = 2411654680943;
e.__initData = c7764_31;
return r38.onFinalize(e);
}, [disabled, r20, voiceMessageAnimationState, callback2, r142, callback3, callback4])}>
<ChatInputActionButton ref={useVoiceMessageTooltip().tooltipTargetRef} IconComponent={MicrophoneIcon} active={false} accessibilityLabel={intl.string(_index_native.t.lwy6aX)} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} disabled={disabled} style={chatInputFloating ? void 0 : clientThemesOverride} />
</GestureDetector>;
});
export default r96;
@@ -0,0 +1,321 @@
// Metro module 11740 (f11741).
import * as Module19 from "react";
import { useEffect, useState, useCallback, useMemo } from "react";
import { View, ActivityIndicator } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { useVoiceMessagesUIStore } from "../VoiceMessagesUIStore";
import { VOICE_RECORDING_MAX_DURATION_MILLIS, VOICE_RECORDING_MAX_DURATION_OFFSET, VOICE_RECORDING_REALLY_WARN_DURATION_MILLIS, VOICE_RECORDING_WARN_DURATION_MILLIS, WAVEFORM_WAVE_MAX_VALUE } from "../../VoiceMessageConstants";
import { ThemeTypes } from "../../../../Constants";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import * as _PlatformUtils from "../../../../utils/PlatformUtils";
import { withSpring } from "../../../../design/animation/reanimated/spring/spring";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import { useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useToken } from "../../../../design/tokens/native/useToken";
import { getTimeFormat } from "../../../../utils/native/TimeUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
function $mk116289() {
return (a0) => !a0;
}
let AnimatedComponent, useStyles, __initData, Waveform, c8040_21, __initData2, Duration, __initData3, __initData4, __initData5, __initData6;
const WaveformBar = function WaveformBar(props) {
const value = props.value;
const styles = useStyles();
const sharedValue = useSharedValue(0);
const sharedValue2 = useSharedValue(0);
const sharedValue3 = useSharedValue(0);
const r26 = function() {
return {
height: sharedValue.get(),
width: sharedValue2.get(),
marginRight: sharedValue3.get()
};
};
r26.__closure = {
animatedHeight: sharedValue,
animatedWidth: sharedValue2,
animatedMargin: sharedValue3
};
r26.__workletHash = 8768145898720;
r26.__initData = __initData;
const animatedStyle = useAnimatedStyle(r26);
useEffect(() => {
sharedValue.set(withSpring(Math.max(2, 20 * Math.min(1, value / WAVEFORM_WAVE_MAX_VALUE * 1.25))));
}, [sharedValue, value]);
useEffect(() => {
sharedValue2.set(_timing.withTiming(2, {
duration: 300,
easing: _ReanimatedRexport.Easing.linear
}));
sharedValue3.set(_timing.withTiming(4, {
duration: 300,
easing: _ReanimatedRexport.Easing.linear
}));
}, [sharedValue2, sharedValue3]);
return <ReanimatedRexport.View style={[styles.waveformBar, animatedStyle]} />;
};
Waveform = function Waveform() {
const styles = useStyles();
useVoiceMessagesUIStore((a0) => a0.waveformVersion);
const voiceMessagesUIStore3 = useVoiceMessagesUIStore((a0) => a0.waveform);
const [state, setState] = useState(0);
const r21 = voiceMessagesUIStore3.slice(-state);
return <View style={styles.waveformContainer} onLayout={useCallback((a0) => {
setState(Math.round(a0.nativeEvent.layout.width / 6) + 2);
}, [])}>
{r21.map((item) => {
const [value2, key] = item;
return <WaveformBar key={key} value={value2} />;
})}
</View>;
};
Duration = function Duration(props) {
let state, setState2, state2, setState3, voiceMessagesUIStore2, setState4;
const animationValue = props.animationValue;
state = void 0;
setState2 = void 0;
state2 = void 0;
setState3 = void 0;
voiceMessagesUIStore2 = void 0;
setState4 = void 0;
const styles = useStyles();
const chatInputFloating = useMobileVisualRefreshConfig({
location: "voice-message-chat"
}).chatInputFloating;
const voiceMessagesUIStore = useVoiceMessagesUIStore((a0) => a0.startTimeMillis);
[state, setState2] = useState(() => voiceMessagesUIStore != null ? Date.now() - voiceMessagesUIStore : 0);
[state2, setState3] = useState(void 0);
voiceMessagesUIStore2 = useVoiceMessagesUIStore((a0) => a0.savedVoiceMessageUploadData != null);
const token = useToken(Module712.modules.mobile.VOICE_MESSAGE_DURATION_TEXT_STYLE);
useEffect(() => {
if (voiceMessagesUIStore2) {
setState2(VOICE_RECORDING_MAX_DURATION_MILLIS + VOICE_RECORDING_MAX_DURATION_OFFSET);
setState3(c8040_21.ENDED);
return void 0;
}
let c27140_0 = setInterval(() => {
if (voiceMessagesUIStore != null) {
const r7 = Date.now() - voiceMessagesUIStore;
setState2(r7);
if (r7 > VOICE_RECORDING_REALLY_WARN_DURATION_MILLIS) {
setState3(c8040_21.REALLY_WARN);
} else if (r7 > VOICE_RECORDING_WARN_DURATION_MILLIS) {
setState3(c8040_21.WARN);
}
}
}, 100);
return () => {
clearInterval(c27140_0);
};
}, [voiceMessagesUIStore, voiceMessagesUIStore2]);
const memo = useMemo(() => getTimeFormat(state / 1000, {
padMinutes: false
}), [state]);
let state3;
[state3, setState4] = useState(false);
useEffect(() => {
if (state2 != null) {
if (state2 !== c8040_21.ENDED) {
const r1 = AccessibilityStore.useReducedMotion ? 1000 : state2 === c8040_21.WARN ? 500 : 250;
let c27141_0;
let c27141_1 = r1;
const flash2 = function flash() {
setState4($mk116289());
c27141_0 = setTimeout(flash2, c27141_1);
};
setState4($mk116289());
c27141_0 = setTimeout(flash2, r1);
return () => {
clearTimeout(c27141_0);
};
}
setState4(true);
} else {
setState4(false);
}
}, [state2]);
const B = function B() {
return {
opacity: animationValue.get()
};
};
B.__closure = {
animationValue
};
B.__workletHash = 4012974382717;
B.__initData = __initData2;
const animatedStyle = useAnimatedStyle(B);
const style = [styles.dot, ,];
const r83 = voiceMessagesUIStore != null && !voiceMessagesUIStore2;
style[1] = r83 ? !r83 : styles.dotDismissed;
const r96 = <ReanimatedRexport.View style={[styles.durationContainer, animatedStyle]}>
<View style={style} />
<Text style={styles.duration} variant={token} color={state3 ? "text-feedback-critical" : chatInputFloating ? "text-default" : "text-overlay-light"} tabularNumbers>{memo}</Text>
</ReanimatedRexport.View>;
return chatInputFloating ? r96 : <ThemeContextProvider theme={ThemeTypes.DARK}>{r96}</ThemeContextProvider>;
};
AnimatedComponent = ReanimatedRexport.createAnimatedComponent(ActivityIndicator);
const isAndroid = _PlatformUtils.isAndroid();
const mobile = Module712.modules.mobile;
useStyles = createStyles({
container: {
height: "100%",
flexDirection: "row",
alignItems: "center",
paddingVertical: Module712.modules.mobile.VOICE_MESSAGE_RECORDING_CONTAINER_PADDING_VERTICAL,
paddingHorizontal: Module712.modules.mobile.VOICE_MESSAGE_RECORDING_PILL_PADDING_HORIZONTAL,
gap: Module712.modules.mobile.CHAT_INPUT_FLOATING_CONTENT_GAP,
borderRadius: Module712.modules.mobile.VOICE_MESSAGE_RECORDING_PILL_BORDER_RADIUS,
backgroundColor: Module712.colors.MOBILE_CHATINPUT_BACKGROUND_DEFAULT,
borderWidth: Module712.modules.mobile.CHAT_INPUT_FLOATING_ACCESSORY_BORDER_WIDTH,
borderColor: Module712.colors.MOBILE_CHATINPUT_BORDER_DEFAULT
},
loading: {
position: "absolute",
left: 12
},
dot: {
height: 6,
width: 6,
backgroundColor: Module712.unsafe_rawColors.RED_400,
marginHorizontal: 4,
borderRadius: 6
},
dotDismissed: {
backgroundColor: "transparent"
},
waveformContainer: {
flex: 1,
height: "100%",
overflow: "hidden",
justifyContent: "flex-end",
flexDirection: "row",
alignItems: "center",
marginLeft: Module712.modules.mobile.VOICE_MESSAGE_RECORDING_WAVEFORM_MARGIN_LEFT
},
waveformBar: {
backgroundColor: Module712.colors.MOBILE_VOICE_MESSAGE_RECORDING_WAVEFORM_BAR_BACKGROUND,
borderRadius: 1
},
durationContainer: {
flexDirection: "row",
alignItems: "center"
},
duration: {
lineHeight: isAndroid ? mobile.VOICE_MESSAGE_DURATION_LINE_HEIGHT_ANDROID : mobile.VOICE_MESSAGE_DURATION_LINE_HEIGHT_IOS,
textAlignVertical: _PlatformUtils.isAndroid() ? "center" : void 0
}
});
__initData = {
code: "function VoiceMessageChatTsx1(){const{animatedHeight,animatedWidth,animatedMargin}=this.__closure;return{height:animatedHeight.get(),width:animatedWidth.get(),marginRight:animatedMargin.get()};}"
};
c8040_21 = {
WARN: 0,
0: "WARN",
REALLY_WARN: 1,
1: "REALLY_WARN",
ENDED: 2,
2: "ENDED"
};
__initData2 = {
code: "function VoiceMessageChatTsx2(){const{animationValue}=this.__closure;return{opacity:animationValue.get()};}"
};
__initData3 = {
code: "function VoiceMessageChatTsx3(){const{initialAnimation,isRecording}=this.__closure;return initialAnimation.get()===1&&isRecording;}"
};
__initData4 = {
code: "function VoiceMessageChatTsx4(result,previous){const{animationValue,withTiming,Easing,loadingOpacity}=this.__closure;if(result&&result!==previous){animationValue.set(withTiming(1,{easing:Easing.quad,duration:200}));loadingOpacity.set(0);}}"
};
__initData5 = {
code: "function VoiceMessageChatTsx5(){const{initialAnimation,backgroundColor}=this.__closure;return{width:80+20*initialAnimation.get()+\"%\",...(backgroundColor!=null?{backgroundColor:backgroundColor.get()}:{})};}"
};
__initData6 = {
code: "function VoiceMessageChatTsx6(){const{loadingOpacity}=this.__closure;return{opacity:loadingOpacity.get()};}"
};
const r135 = Module19.memo(function({ isRecording, initialAnimation, backgroundColor, leftAccessory, rightAccessory }) {
let sharedValue5;
sharedValue5 = void 0;
const styles = useStyles();
const token = useToken(Module712.colors.MOBILE_VOICE_MESSAGE_RECORDING_SPINNER_COLOR);
const sharedValue4 = useSharedValue(0);
useEffect(() => {
if (isRecording) {
return void 0;
}
let c27142_0 = setTimeout(() => {
sharedValue4.set(_timing.withTiming(1, {
easing: _ReanimatedRexport.Easing.quad,
duration: 200
}));
}, 1000);
return () => {
clearTimeout(c27142_0);
};
}, [sharedValue4, isRecording]);
sharedValue5 = useSharedValue(0);
const A = function A() {
return initialAnimation.get() === 1 && isRecording;
};
A.__closure = {
initialAnimation,
isRecording
};
A.__workletHash = 7599681139161;
A.__initData = __initData3;
const h = function h(a0, a1) {
if (a0 ? a0 !== a1 : a0) {
sharedValue5.set(_timing.withTiming(1, {
easing: _ReanimatedRexport.Easing.quad,
duration: 200
}));
sharedValue4.set(0);
}
};
h.__closure = {
animationValue: sharedValue5,
withTiming: _timing.withTiming,
Easing: _ReanimatedRexport.Easing,
loadingOpacity: sharedValue4
};
h.__workletHash = 7661977794788;
h.__initData = __initData4;
useAnimatedReaction(A, h);
const I = function I() {
return {
width: 80 + 20 * initialAnimation.get() + "%",
...backgroundColor != null ? {
backgroundColor: backgroundColor.get()
} : {}
};
};
I.__closure = {
initialAnimation,
backgroundColor
};
I.__workletHash = 3621425956686;
I.__initData = __initData5;
const animatedStyle = useAnimatedStyle(I);
const f = function f() {
return {
opacity: sharedValue4.get()
};
};
f.__closure = {
loadingOpacity: sharedValue4
};
f.__workletHash = 17421928475897;
f.__initData = __initData6;
const animatedStyle2 = useAnimatedStyle(f);
return <ReanimatedRexport.View style={[styles.container, animatedStyle]}>
{isRecording ? null : <AnimatedComponent style={[styles.loading, animatedStyle2]} color={token} size="small" />}
{leftAccessory}
<Duration animationValue={sharedValue5} />
<Waveform />
{rightAccessory}
</ReanimatedRexport.View>;
});
export default r135;
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,32 @@
// Metro module 11741 (f11742).
import { forwardRef } from "react";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Icon } from "../../../../design/void/native";
const useStyles = createStyles((a0, a1, a2, a3) => ({
button: {
width: a0,
height: a0,
borderRadius: Module712.radii.sm,
alignItems: "center",
justifyContent: "center",
backgroundColor: a2,
borderWidth: a3 != null ? 1 : 0,
borderColor: a3
},
icon: {
width: a1,
height: a1
}
}));
const r25 = forwardRef(function(a0, a1) {
const { icon, tintColor, accessibilityLabel, onPress, onPressIn } = a0;
const styles = useStyles(a0.boxSize, a0.iconSize, a0.backgroundColor, a0.borderColor);
return <PressableOpacity ref={a1} style={styles.button} accessibilityRole="button" accessibilityLabel={accessibilityLabel} onPress={onPress} onPressIn={onPressIn}>
<Icon source={icon} size={Icon.Sizes.CUSTOM} style={[styles.icon, {
tintColor
}]} />
</PressableOpacity>;
});
export default r25;
@@ -0,0 +1,43 @@
// Metro module 11418 (f11419).
import { useRef, useMemo, useEffect } from "react";
import subscribeToKeyboardUIStore from "../../keyboard/native/subscribeToKeyboardUIStore";
import { hideVoiceMessagesTooltip, showVoiceMessagesTooltip, useVoiceMessagesUIStore } from "./VoiceMessagesUIStore";
import { intl, t } from "../../../intl/index.native";
import { getKeyboardIsOpen } from "../../keyboard/native/useKeyboardIsOpen";
import { useTooltip } from "../../../design/components/Tooltip/native/useTooltip.native";
export default function useVoiceMessageTooltip() {
const ref = useRef(null);
const voiceMessagesUIStore = useVoiceMessagesUIStore((a0) => a0.showVoiceMessagesTooltip);
const memo = useMemo(() => ({
position: "top",
label: intl.string(t["hP6+07"]),
visible: voiceMessagesUIStore
}), [voiceMessagesUIStore]);
useEffect(() => {
if (voiceMessagesUIStore) {
let c27064_2;
const keyboardIsOpen = getKeyboardIsOpen({
includeCustomKeyboard: true
});
let c27064_1 = subscribeToKeyboardUIStore(function() {
if (keyboardIsOpen !== getKeyboardIsOpen({
includeCustomKeyboard: true
})) {
hideVoiceMessagesTooltip();
}
});
c27064_2 = setTimeout(() => {
hideVoiceMessagesTooltip();
}, 2000);
return () => {
clearTimeout(c27064_2);
c27064_1();
};
}
}, [voiceMessagesUIStore]);
useTooltip(ref, memo);
return {
tooltipTargetRef: ref,
showVoiceMessagesTooltip
};
};