Files
discord-decomp/modules/voice_calls/native/VoiceActionSheetManager.tsx
T
2026-11-01 12:12:55 +02:00

31 lines
1.2 KiB
TypeScript

// Metro module 12823 (f12824).
import MediaEngineStore from "../../../stores/MediaEngineStore";
import VoiceStateStore from "../../../stores/VoiceStateStore";
import LifecycleManager from "../../../lib/LifecycleManager";
import Dispatcher from "../../../Dispatcher";
import { dismissVoiceChannelScreens, openChannelCallModal } from "../../../utils/native/PrivateChannelCallUtils";
class VoiceActionSheetManager extends LifecycleManager {
channel = null;
handleOpenChannelCallModal = () => {
const channel = this.channel;
if (channel != null) {
Dispatcher.wait(() => {
dismissVoiceChannelScreens(channel);
openChannelCallModal(channel);
});
this.terminate();
}
};
_initialize(a0) {
this.channel = a0;
VoiceStateStore.addChangeListener(this.handleOpenChannelCallModal);
MediaEngineStore.addChangeListener(this.handleOpenChannelCallModal);
}
_terminate() {
VoiceStateStore.removeChangeListener(this.handleOpenChannelCallModal);
MediaEngineStore.removeChangeListener(this.handleOpenChannelCallModal);
}
}
const voiceActionSheetManager = new VoiceActionSheetManager();
export default voiceActionSheetManager;