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

134 lines
4.5 KiB
TypeScript

// Metro module 10518 (f10519).
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import { VoiceCallOverlayType } from "./ChannelCallConstants";
import { OrientationType } from "../../device/native/DeviceOrientation";
import isUndefinedOrNull from "../../../_bundle/isUndefinedOrNull";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
import { HermesBuiltin } from "../../../_hermes/prelude";
let voiceChannelId;
let c7060_4 = false;
let c7060_5 = false;
let c7060_6 = false;
const visible = false;
const r23 = {};
r23[VoiceCallOverlayType.VOICE_CONTROLS_TOGGLE_BUTTON] = {
x: void 0,
y: void 0,
width: void 0,
height: void 0,
screenOrientation: OrientationType.PORTRAIT,
hasUserInteractedSinceOrientationChange: false,
isInitialized: false,
isVisible: false
};
r23[VoiceCallOverlayType.CAMERA_PREVIEW_PICTURE_IN_PICTURE] = {
x: void 0,
y: void 0,
width: void 0,
height: void 0,
screenOrientation: OrientationType.PORTRAIT,
hasUserInteractedSinceOrientationChange: false,
isInitialized: false,
isVisible: false
};
let c7060_8 = r23;
let c7060_9 = c7060_8;
let pipEnabledWhileFocusedOnActivityOrStream = true;
class ChannelCallLifecycleStore extends Module589.Store {
static displayName = "ChannelCallLifecycleStore";
initialize() {
this.waitFor(SelectedChannelStore);
}
shouldReactToSeriousThermalStateWhenActivityFocused() {
return c7060_4;
}
consumedRequestToRespondToSeriousThermalState() {
return c7060_5;
}
disregardSeriousThermalState() {
return c7060_6;
}
isReactingToThermalState() {
return c7060_5 && !c7060_6;
}
getShowActivitiesDebugOverlay() {
return visible;
}
getVoiceCallOverlayLayoutStates() {
return c7060_9;
}
isPipEnabledWhileFocusedOnActivityOrStream() {
return pipEnabledWhileFocusedOnActivityOrStream;
}
}
const channelCallLifecycleStore = new ChannelCallLifecycleStore(Dispatcher, {
VOICE_CHANNEL_SELECT: function handleVoiceChannelSelect(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
const voiceChannelId2 = SelectedChannelStore.getVoiceChannelId();
if (voiceChannelId2 !== voiceChannelId) {
c7060_4 = false;
c7060_5 = false;
visible = false;
c7060_6 = false;
c7060_9 = c7060_8;
}
voiceChannelId = voiceChannelId2;
},
EMBEDDED_ACTIVITY_REQUEST_RESPOND_TO_SERIOUS_THERMAL_STATE: function handleRequestRespondToSeriousThermalState(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
c7060_4 = true;
},
EMBEDDED_ACTIVITY_CONSUME_RESPOND_TO_SERIOUS_THERMAL_STATE_REQUEST: function handleConsumeReactToSeriousThermalStateRequest(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
c7060_5 = true;
},
EMBEDDED_ACTIVITY_DISREGARD_SERIOUS_THERMAL_STATE: function handleDisregardSeriousThermalState(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
c7060_6 = true;
},
EMBEDDED_ACTIVITY_SET_DEBUG_OVERLAY_VISIBILITY: function handleSetDebugOverlayVisibility(a0) {
visible = a0.visible;
},
VOICE_CALL_OVERLAY_LAYOUT_STATE_UPDATE: function handleVoiceCallOverlayLayoutStateUpdate({ voiceCallOverlayType, voiceCallOverlayLayoutState }) {
const r4 = c7060_9;
const r9 = {
...r4
};
r9[voiceCallOverlayType] = voiceCallOverlayLayoutState;
if (!isUndefinedOrNull(r9, r4)) {
c7060_9 = r9;
}
},
VOICE_CALL_SET_PIP_ENABLED_FOR_ACTIVITY_OR_STREAM: function handleSetPipEnabledForActivityOrStream(a0) {
pipEnabledWhileFocusedOnActivityOrStream = a0.pipEnabledWhileFocusedOnActivityOrStream;
},
EMBEDDED_ACTIVITY_OPEN: function handleEmbeddedActivityOpen(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
pipEnabledWhileFocusedOnActivityOrStream = true;
},
STREAM_WATCH: function handleStreamWatch(a0) {
if (a0 == null) {
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
throw new Error("unreachable");
}
pipEnabledWhileFocusedOnActivityOrStream = true;
}
});
export default channelCallLifecycleStore;