Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
300 lines
14 KiB
TypeScript
300 lines
14 KiB
TypeScript
// Module ID: 9172
|
|
// Function ID: 9173
|
|
// Name: CallsUtils
|
|
// Dependencies: [32, 5, 19, 17, 4628, 1957, 1908, 2011, 4625, 9173, 9176, 4816, 9178, 4951, 1114, 5190, 9179, 9200, 1874, 4813, 5462, 12, 9201, 9202, 9203, 1115, 504, 9204, 9177, 9556, 9174, 2]
|
|
// Exports: getAudioDeviceToDisplayText, handleDisconnect, handleToggleSelfDeaf, handleToggleSelfMute, handleToggleVideo, showCameraDisabledAlert, showMinOSScreenshareRequirementAlert, showScreenshareDisabledAlert, showServerDeafenAlert, showServerMuteAlert, showSuppressedAlert, showTabletRequirementAlert, useImmediateMaskedSpeakerStates
|
|
|
|
// Module 9172 (CallsUtils)
|
|
import initialize from "initialize" /* 504 */;
|
|
import util from "util" /* 1114 */;
|
|
import KeyboardManagerUtilsAll from "KeyboardManagerUtils" /* 1874 */;
|
|
import PrivateChannelCallUtils from "PrivateChannelCallUtils" /* 4813 */;
|
|
import actions_AlertActionCreatorsDefault from "actions/AlertActionCreators" /* 4951 */;
|
|
import SelectedChannelActionCreatorsDefault from "SelectedChannelActionCreators" /* 5462 */;
|
|
import AudioActionCreatorsDefault from "AudioActionCreators" /* 9179 */;
|
|
import AVError from "AVError" /* 9200 */;
|
|
import _modDef9201 from "module_9201" /* 9201 */;
|
|
import _modDef9202 from "module_9202" /* 9202 */;
|
|
import _modDef9203 from "module_9203" /* 9203 */;
|
|
import useIsVideoModeDefault from "useIsVideoMode" /* 9556 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import ApplicationStreamingStore from "ApplicationStreamingStore" /* 4628 */;
|
|
import ChannelStore from "ChannelStore" /* 1957 */;
|
|
import MediaEngineStore from "MediaEngineStore" /* 1908 */;
|
|
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
|
|
import VoiceStateStore from "VoiceStateStore" /* 4625 */;
|
|
import AudioRouteStore from "AudioRouteStore" /* 9173 */;
|
|
import AudioManagerStore from "AudioManagerStore" /* 9176 */;
|
|
import apply_mod from "module_12" /* 12 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
require = fn;
|
|
let closure_16 = async function _handleToggleVideo(arg0, value) {
|
|
closure_2 = tmp2;
|
|
closure_130_0 = closure_0;
|
|
let flag3 = closure_1;
|
|
if (closure_1 === undefined) {
|
|
flag3 = true;
|
|
}
|
|
closure_130_1 = flag3;
|
|
await "PX_16";
|
|
if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
return { value, done: true };
|
|
} else {
|
|
closure_130_2 = closure_131_10.isVideoEnabled();
|
|
const channelVideoLimit = closure_131_0(closure_131_3[12]).getChannelVideoLimit(closure_130_0);
|
|
const reachedLimit = channelVideoLimit.reachedLimit;
|
|
const limit = channelVideoLimit.limit;
|
|
if (reachedLimit) {
|
|
if (closure_130_1) {
|
|
const obj5 = { title: null, body: null };
|
|
const intl = closure_131_0(closure_131_3[14]).intl;
|
|
obj5.title = intl.string(closure_131_0(closure_131_3[14]).t["3ffmE+"]);
|
|
const intl2 = closure_131_0(closure_131_3[14]).intl;
|
|
obj5.body = intl2.formatToPlainString(closure_131_0(closure_131_3[14]).t.x9mtl4, { limit: limit.toString() });
|
|
closure_131_1(closure_131_3[13]).show(obj5);
|
|
closure_131_1(closure_131_3[13]);
|
|
{ limit: limit.toString() };
|
|
}
|
|
} else if (closure_130_2) {
|
|
tmp12(tmp13[16]).setVideoEnabled(false);
|
|
tmp12(tmp13[16]);
|
|
} else {
|
|
c4 = 2;
|
|
c5 = 1;
|
|
return { value: tmp12(tmp13[15]).requestPermission(closure_131_15.CAMERA), done: false };
|
|
}
|
|
c5 = 3;
|
|
closure_131_0(closure_131_3[12]);
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
if (value) {
|
|
closure_131_1(closure_131_3[16]).setVideoEnabled(true);
|
|
closure_131_1(closure_131_3[16]);
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const NativeModules = fn(17).NativeModules;
|
|
const NativePermissionTypes = fn(4816).NativePermissionTypes;
|
|
let apply = apply_mod;
|
|
let closure_17 = apply.debounce((arg0) => {
|
|
const AudioRoutePicker = NativeModules.AudioRoutePicker;
|
|
if (AudioRoutePicker != null) {
|
|
AudioRoutePicker.handleAudioRoute(arg0);
|
|
}
|
|
}, 250);
|
|
let apply = apply_mod;
|
|
let closure_18 = apply.debounce((fn) => {
|
|
fn();
|
|
}, 1);
|
|
const audioDeviceToIconMap = { EARPIECE: _modDef9201, BLUETOOTH_HEADSET: _modDef9202, WIRED_HEADSET: _modDef9203, SPEAKERPHONE: _modDef9203, INVALID: _modDef9203 };
|
|
const constants = { TYPE_UNKNOWN: 0, [0]: "TYPE_UNKNOWN", TYPE_BUILTIN_EARPIECE: 1, [1]: "TYPE_BUILTIN_EARPIECE", TYPE_BUILTIN_SPEAKER: 2, [2]: "TYPE_BUILTIN_SPEAKER", TYPE_WIRED_HEADSET: 3, [3]: "TYPE_WIRED_HEADSET", TYPE_WIRED_HEADPHONES: 4, [4]: "TYPE_WIRED_HEADPHONES", TYPE_LINE_ANALOG: 5, [5]: "TYPE_LINE_ANALOG", TYPE_LINE_DIGITAL: 6, [6]: "TYPE_LINE_DIGITAL", TYPE_BLUETOOTH_SCO: 7, [7]: "TYPE_BLUETOOTH_SCO", TYPE_BLUETOOTH_A2DP: 8, [8]: "TYPE_BLUETOOTH_A2DP", TYPE_HDMI: 9, [9]: "TYPE_HDMI", TYPE_HDMI_ARC: 10, [10]: "TYPE_HDMI_ARC", TYPE_USB_DEVICE: 11, [11]: "TYPE_USB_DEVICE", TYPE_USB_ACCESSORY: 12, [12]: "TYPE_USB_ACCESSORY", TYPE_DOCK: 13, [13]: "TYPE_DOCK", TYPE_FM: 14, [14]: "TYPE_FM", TYPE_BUILTIN_MIC: 15, [15]: "TYPE_BUILTIN_MIC", TYPE_FM_TUNER: 16, [16]: "TYPE_FM_TUNER", TYPE_TV_TUNER: 17, [17]: "TYPE_TV_TUNER", TYPE_TELEPHONY: 18, [18]: "TYPE_TELEPHONY", TYPE_AUX_LINE: 19, [19]: "TYPE_AUX_LINE", TYPE_IP: 20, [20]: "TYPE_IP", TYPE_BUS: 21, [21]: "TYPE_BUS", TYPE_USB_HEADSET: 22, [22]: "TYPE_USB_HEADSET", TYPE_HEARING_AID: 23, [23]: "TYPE_HEARING_AID", TYPE_BUILTIN_SPEAKER_SAFE: 24, [24]: "TYPE_BUILTIN_SPEAKER_SAFE", TYPE_REMOTE_SUBMIX: 25, [25]: "TYPE_REMOTE_SUBMIX", TYPE_BLE_HEADSET: 26, [26]: "TYPE_BLE_HEADSET", TYPE_BLE_SPEAKER: 27, [27]: "TYPE_BLE_SPEAKER", TYPE_ECHO_REFERENCE: 28, [28]: "TYPE_ECHO_REFERENCE", TYPE_HDMI_EARC: 29, [29]: "TYPE_HDMI_EARC", TYPE_BLE_BROADCAST: 30, [30]: "TYPE_BLE_BROADCAST", TYPE_DOCK_ANALOG: 31, [31]: "TYPE_DOCK_ANALOG" };
|
|
const PlatformUtils = fn(1115);
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/voice_calls/native/CallsUtils.tsx");
|
|
|
|
export const handleToggleVideo = function handleToggleVideo() {
|
|
const self = this;
|
|
const apply = closure_16.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
};
|
|
export const handleToggleSelfDeaf = function handleToggleSelfDeaf() {
|
|
AudioActionCreatorsDefault.toggleSelfDeaf();
|
|
};
|
|
export const handleToggleSelfMute = function handleToggleSelfMute() {
|
|
AudioActionCreatorsDefault.toggleSelfMute();
|
|
};
|
|
export const showSuppressedAlert = function showSuppressedAlert() {
|
|
const obj2 = { title: null, body: null, hideActionSheet: false };
|
|
const intl = util.intl;
|
|
obj2.title = intl.string(util.t.FJSZVM);
|
|
const intl2 = util.intl;
|
|
obj2.body = intl2.string(util.t.etJjgW);
|
|
actions_AlertActionCreatorsDefault.show(obj2);
|
|
};
|
|
export const showServerMuteAlert = function showServerMuteAlert() {
|
|
const obj2 = { title: null, body: null, hideActionSheet: false };
|
|
const intl = util.intl;
|
|
obj2.title = intl.string(util.t["+JQCa/"]);
|
|
const intl2 = util.intl;
|
|
obj2.body = intl2.string(util.t.hsNm7d);
|
|
actions_AlertActionCreatorsDefault.show(obj2);
|
|
};
|
|
export const showServerDeafenAlert = function showServerDeafenAlert() {
|
|
const obj2 = { title: null, body: null, hideActionSheet: false };
|
|
const intl = util.intl;
|
|
obj2.title = intl.string(util.t.QZ7WSS);
|
|
const intl2 = util.intl;
|
|
obj2.body = intl2.string(util.t.Tl9JpL);
|
|
actions_AlertActionCreatorsDefault.show(obj2);
|
|
};
|
|
export const showCameraDisabledAlert = function showCameraDisabledAlert() {
|
|
const obj2 = { title: null, body: null, hideActionSheet: false };
|
|
const intl = util.intl;
|
|
obj2.title = intl.string(util.t.OYzPcW);
|
|
const intl2 = util.intl;
|
|
obj2.body = intl2.string(util.t.oBH7Y2);
|
|
actions_AlertActionCreatorsDefault.show(obj2);
|
|
};
|
|
export const showScreenshareDisabledAlert = function showScreenshareDisabledAlert() {
|
|
const obj2 = { title: null, body: null, hideActionSheet: false };
|
|
const intl = util.intl;
|
|
obj2.title = intl.string(util.t["/x4knx"]);
|
|
const intl2 = util.intl;
|
|
obj2.body = intl2.string(util.t.PpfzUE);
|
|
actions_AlertActionCreatorsDefault.show(obj2);
|
|
};
|
|
export const showMinOSScreenshareRequirementAlert = function showMinOSScreenshareRequirementAlert() {
|
|
const intl = util.intl;
|
|
const errorInfo = AVError.getErrorInfo(AVError.AVError.SCREENSHARE_OS_NOT_SUPPORTED);
|
|
let errorCode;
|
|
if (errorInfo != null) {
|
|
errorCode = errorInfo.errorCode;
|
|
}
|
|
const formatToPlainStringResult = intl.formatToPlainString(util.t.ejOT95, { errorCode });
|
|
const obj3 = { title: null, body: null, hideActionSheet: false };
|
|
const intl2 = tmp(1114).intl;
|
|
obj3.title = intl2.string(util.t.oblMYa);
|
|
const intl3 = tmp(1114).intl;
|
|
obj3.body = "" + intl3.string(util.t.Wnhd3q) + "\n\n" + formatToPlainStringResult;
|
|
actions_AlertActionCreatorsDefault.show(obj3);
|
|
};
|
|
export const showTabletRequirementAlert = function showTabletRequirementAlert() {
|
|
const obj2 = { title: null, body: null, hideActionSheet: false };
|
|
const intl = util.intl;
|
|
obj2.title = intl.string(util.t["1N0dxa"]);
|
|
const intl2 = util.intl;
|
|
obj2.body = intl2.string(util.t.qqDFVb);
|
|
actions_AlertActionCreatorsDefault.show(obj2);
|
|
};
|
|
export const handleDisconnect = function handleDisconnect(channel) {
|
|
const result = KeyboardManagerUtilsAll.dismissGlobalKeyboard();
|
|
const result1 = PrivateChannelCallUtils.dismissVoiceChannelScreens(channel, () => {
|
|
const voiceChannel = SelectedChannelActionCreatorsDefault.selectVoiceChannel(null);
|
|
});
|
|
};
|
|
export { audioDeviceToIconMap };
|
|
export const getAudioDeviceToDisplayText = function getAudioDeviceToDisplayText(deviceType) {
|
|
const obj = { EARPIECE: null, BLUETOOTH_HEADSET: null, WIRED_HEADSET: null, SPEAKERPHONE: null, INVALID: null };
|
|
const intl = util.intl;
|
|
obj.EARPIECE = intl.string(util.t.Ouoi6E);
|
|
const intl2 = util.intl;
|
|
obj.BLUETOOTH_HEADSET = intl2.string(util.t.i6eV3z);
|
|
const intl3 = util.intl;
|
|
obj.WIRED_HEADSET = intl3.string(util.t.Dluojr);
|
|
const intl4 = util.intl;
|
|
obj.SPEAKERPHONE = intl4.string(util.t.snEhlu);
|
|
const intl5 = util.intl;
|
|
obj.INVALID = intl5.string(util.t.kCBL6t);
|
|
if (deviceType.deviceType === constants.TYPE_BLE_HEADSET) {
|
|
const intl6 = tmp(1114).intl;
|
|
let stringResult = intl6.string(tmp(1114).t.BtXSp9);
|
|
} else {
|
|
stringResult = obj[deviceType.simpleDeviceType];
|
|
}
|
|
return stringResult;
|
|
};
|
|
export const useMaskedSpeakerStates = PlatformUtils.isAndroid() ? (() => {
|
|
const items = [AudioManagerStore];
|
|
return initialize.useStateFromStoresObject(items, () => {
|
|
activeAudioDevice = activeAudioDevice.getActiveAudioDevice();
|
|
const obj = { isAudioRouteEnabled: true, toggleAudio: require("showAudioOutputSelector").showAudioOutputSelector, routeSource: null };
|
|
let simpleDeviceType;
|
|
if (activeAudioDevice != null) {
|
|
simpleDeviceType = activeAudioDevice.simpleDeviceType;
|
|
}
|
|
if (simpleDeviceType == null) {
|
|
simpleDeviceType = require("NativeAudioManagerModule").AudioDeviceType.INVALID;
|
|
}
|
|
obj.routeSource = audioDeviceToIconMap[simpleDeviceType];
|
|
return obj;
|
|
}, []);
|
|
}) : (() => {
|
|
const items = [ChannelStore, SelectedChannelStore, ApplicationStreamingStore, VoiceStateStore, MediaEngineStore, AudioRouteStore];
|
|
const stateFromStoresObject = isEnabled(504).useStateFromStoresObject(items, () => {
|
|
isVideoMode = isEnabled(9556).isVideoMode(ChannelStore, SelectedChannelStore, ApplicationStreamingStore, VoiceStateStore, MediaEngineStore);
|
|
currentRouteType = currentRouteType.getCurrentRouteType();
|
|
isEnabled = currentRouteType === isEnabled(9174).RouteTypes.SPEAKER;
|
|
const isBluetoothRoute = currentRouteType === isEnabled(9174).RouteTypes.BLUETOOTH;
|
|
if (!isEnabled) {
|
|
isEnabled = isBluetoothRoute;
|
|
}
|
|
if (!isEnabled) {
|
|
isEnabled = isVideoMode;
|
|
}
|
|
return { isEnabled, isVideoMode, isBluetoothRoute };
|
|
});
|
|
isEnabled = stateFromStoresObject.isEnabled;
|
|
let isVideoMode = stateFromStoresObject.isVideoMode;
|
|
[isAudioRouteEnabled, dependencyMap] = noop.useState(isEnabled);
|
|
const items1 = [isAudioRouteEnabled, isVideoMode];
|
|
const items2 = [isEnabled, isVideoMode];
|
|
const callback = noop.useCallback(() => {
|
|
if (!AudioRouteStore.getMultipleRoutesAvailable()) {
|
|
closure_18.cancel();
|
|
if (!isVideoMode) {
|
|
dependencyMap(!first);
|
|
}
|
|
}
|
|
closure_17(!first);
|
|
}, items1);
|
|
const effect = noop.useEffect(() => {
|
|
if (!AudioRouteStore.getMultipleRoutesAvailable()) {
|
|
if (!isVideoMode) {
|
|
closure_18(() => dependencyMap(isEnabled));
|
|
}
|
|
}
|
|
dependencyMap(isEnabled);
|
|
}, items2);
|
|
const obj = isEnabled(504);
|
|
return { isAudioRouteEnabled, toggleAudio: callback, routeSource: isVideoMode(stateFromStoresObject.isBluetoothRoute ? 9202 : 9203) };
|
|
});
|
|
export const useImmediateMaskedSpeakerStates = () => {
|
|
const items = [AudioRouteStore];
|
|
const stateFromStores = require("initialize").useStateFromStores(items, () => currentRouteType.getCurrentRouteType());
|
|
const tmp4 = useIsVideoModeDefault();
|
|
_require = tmp4;
|
|
let tmp5 = stateFromStores === require("VoiceCallTypes").RouteTypes.SPEAKER;
|
|
const tmp6 = stateFromStores === require("VoiceCallTypes").RouteTypes.BLUETOOTH;
|
|
if (!tmp5) {
|
|
tmp5 = tmp6;
|
|
}
|
|
if (!tmp5) {
|
|
tmp5 = tmp4;
|
|
}
|
|
importDefault = tmp5;
|
|
[isAudioRouteEnabled, dependencyMap] = noop.useState(tmp5);
|
|
const items1 = [isAudioRouteEnabled, tmp4];
|
|
const items2 = [tmp5, tmp4];
|
|
const callback = noop.useCallback(() => {
|
|
if (!AudioRouteStore.getMultipleRoutesAvailable()) {
|
|
closure_18.cancel();
|
|
if (!closure_0) {
|
|
closure_3(!first);
|
|
}
|
|
}
|
|
closure_17(!first);
|
|
}, items1);
|
|
const effect = noop.useEffect(() => {
|
|
closure_3(closure_1);
|
|
}, items2);
|
|
const obj = require("initialize");
|
|
return { isAudioRouteEnabled, toggleAudio: callback, routeSource: importDefault(tmp6 ? 9202 : 9203) };
|
|
};
|