Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
122 lines
3.7 KiB
TypeScript
122 lines
3.7 KiB
TypeScript
// Module ID: 13883
|
|
// Function ID: 13884
|
|
// Name: CallStateHooks
|
|
// Dependencies: [4652, 502, 5359, 4659, 1074, 4657, 504, 9344, 2]
|
|
// Exports: default
|
|
|
|
// Module 13883 (CallStateHooks)
|
|
import ChannelRTCStore from "ChannelRTCStore" /* 4652 */;
|
|
import AuthenticationStore from "AuthenticationStore" /* 502 */;
|
|
import CallStore from "CallStore" /* 5359 */;
|
|
import RTCConnectionStore from "RTCConnectionStore" /* 4659 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
const require = fn;
|
|
const Constants = fn(1074);
|
|
({ EMPTY_STRING_SNOWFLAKE_ID: closure_7, RTCConnectionStates: closure_8 } = Constants);
|
|
const ParticipantTypes = fn(4657).ParticipantTypes;
|
|
let obj = {};
|
|
const merged = Object.assign({ initialized: false, callId: "PX_16" });
|
|
let obj2 = { DISCONNECTED: "disconneted", DISCONNECTING: "disconnecting", CONNECTING: "connecting", RINGING: "ringing", CONNECTED: "connected" };
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/voice_calls/native/CallStateHooks.tsx");
|
|
|
|
export default function _default() {
|
|
let tmp = arg0;
|
|
if (arg0 === undefined) {
|
|
tmp = closure_7;
|
|
}
|
|
_require = tmp;
|
|
let flag = arg1;
|
|
if (arg1 === undefined) {
|
|
flag = false;
|
|
}
|
|
let flag2 = arg2;
|
|
if (arg2 === undefined) {
|
|
flag2 = false;
|
|
}
|
|
let stateFromStores;
|
|
const id = AuthenticationStore.getId();
|
|
obj = require("initialize");
|
|
const items = [CallStore];
|
|
const items1 = [tmp, id];
|
|
const stateFromStoresArray = obj.useStateFromStoresArray(items, () => {
|
|
const call = CallStore.getCall(closure_0);
|
|
if (null != call) {
|
|
const ringing = call.ringing;
|
|
let found = ringing.filter((item) => item !== id);
|
|
} else {
|
|
found = [];
|
|
}
|
|
let initialized = obj.initialized;
|
|
if (!initialized) {
|
|
initialized = found.length > 0;
|
|
}
|
|
obj.initialized = initialized;
|
|
return found;
|
|
}, items1);
|
|
const participants = stateFromStores.getParticipants(tmp);
|
|
let found = participants.filter((type) => {
|
|
let tmp = type.type !== ParticipantTypes.ACTIVITY;
|
|
if (tmp) {
|
|
tmp = type.user.id !== id;
|
|
}
|
|
return tmp;
|
|
});
|
|
const tmp3 = id(9344)();
|
|
dependencyMap = tmp3;
|
|
obj2 = require("initialize");
|
|
const items2 = [RTCConnectionStore];
|
|
stateFromStores = obj2.useStateFromStores(items2, RTCConnectionStore.getRTCConnectionId, []);
|
|
const items3 = [RTCConnectionStore];
|
|
const items4 = [stateFromStores, tmp3, tmp];
|
|
const stateFromStores1 = require("initialize").useStateFromStores(items3, () => {
|
|
channelId = undefined;
|
|
if (channelId != null) {
|
|
channelId = channelId.channelId;
|
|
}
|
|
if (channelId === closure_0) {
|
|
obj.initialized = true;
|
|
return constants.RTC_CONNECTED;
|
|
} else {
|
|
if (!tmp2) {
|
|
obj.initialized = false;
|
|
}
|
|
obj.callId = stateFromStores;
|
|
const state = RTCConnectionStore.getState();
|
|
let initialized = obj.initialized;
|
|
if (!initialized) {
|
|
let tmp10 = state !== constants.DISCONNECTED;
|
|
if (tmp10) {
|
|
tmp10 = state !== constants.RTC_DISCONNECTED;
|
|
}
|
|
initialized = tmp10;
|
|
}
|
|
obj.initialized = initialized;
|
|
return state;
|
|
}
|
|
}, items4);
|
|
obj.initialized = obj.initialized || flag2;
|
|
let state = obj2.CONNECTING;
|
|
let initialized = tmp6.initialized;
|
|
if (flag) {
|
|
state = tmp7.DISCONNECTING;
|
|
} else {
|
|
if (initialized) {
|
|
if (stateFromStores1 === constants.DISCONNECTED) {
|
|
state = tmp7.DISCONNECTED;
|
|
}
|
|
}
|
|
if (stateFromStoresArray.length > 0) {
|
|
if (found.length === stateFromStoresArray.length) {
|
|
state = tmp7.RINGING;
|
|
}
|
|
}
|
|
if (stateFromStores1 === constants.RTC_CONNECTED) {
|
|
state = tmp7.CONNECTED;
|
|
}
|
|
}
|
|
return { state, initialized };
|
|
};
|
|
export const CallStates = obj2;
|