Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
344 lines
15 KiB
TypeScript
344 lines
15 KiB
TypeScript
// Module ID: 9114
|
|
// Function ID: 9115
|
|
// Name: CallsUtils
|
|
// Dependencies: [32, 5, 19, 17, 4596, 1957, 1908, 2011, 4593, 9115, 9118, 4784, 9120, 4919, 1114, 5153, 9121, 9142, 1874, 4781, 5425, 12, 9143, 9144, 9145, 1115, 504, 9146, 9119, 9497, 9116, 2]
|
|
// Exports: getAudioDeviceToDisplayText, handleDisconnect, handleToggleSelfDeaf, handleToggleSelfMute, handleToggleVideo, showCameraDisabledAlert, showMinOSScreenshareRequirementAlert, showScreenshareDisabledAlert, showServerDeafenAlert, showServerMuteAlert, showSuppressedAlert, showTabletRequirementAlert, useImmediateMaskedSpeakerStates
|
|
|
|
// Module 9114 (CallsUtils)
|
|
import initialize from "initialize" /* 504 */;
|
|
import util from "util" /* 1114 */;
|
|
import KeyboardManagerUtilsAll from "KeyboardManagerUtils" /* 1874 */;
|
|
import PrivateChannelCallUtils from "PrivateChannelCallUtils" /* 4781 */;
|
|
import actions_AlertActionCreatorsDefault from "actions/AlertActionCreators" /* 4919 */;
|
|
import SelectedChannelActionCreatorsDefault from "SelectedChannelActionCreators" /* 5425 */;
|
|
import AudioActionCreatorsDefault from "AudioActionCreators" /* 9121 */;
|
|
import AVError from "AVError" /* 9142 */;
|
|
import _modDef9143 from "module_9143" /* 9143 */;
|
|
import _modDef9144 from "module_9144" /* 9144 */;
|
|
import _modDef9145 from "module_9145" /* 9145 */;
|
|
import useIsVideoModeDefault from "useIsVideoMode" /* 9497 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import ApplicationStreamingStore from "ApplicationStreamingStore" /* 4596 */;
|
|
import ChannelStore from "ChannelStore" /* 1957 */;
|
|
import MediaEngineStore from "MediaEngineStore" /* 1908 */;
|
|
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
|
|
import VoiceStateStore from "VoiceStateStore" /* 4593 */;
|
|
import AudioRouteStore from "AudioRouteStore" /* 9115 */;
|
|
import AudioManagerStore from "AudioManagerStore" /* 9118 */;
|
|
import apply_mod from "module_12" /* 12 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
require = fn;
|
|
let closure_16 = async function _handleToggleVideo(arg0, value) {
|
|
if (c5 === 2) {
|
|
c5 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c5 = 2;
|
|
if (0 === c4) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
c3 = 0;
|
|
closure_2 = tmp2;
|
|
closure_130_1 = undefined;
|
|
closure_130_0 = closure_0;
|
|
let flag3 = closure_1;
|
|
if (closure_1 === undefined) {
|
|
flag3 = true;
|
|
}
|
|
closure_130_1 = flag3;
|
|
closure_130_2 = undefined;
|
|
let channelVideoLimit;
|
|
let reachedLimit;
|
|
let limit;
|
|
c4 = 1;
|
|
c5 = 1;
|
|
return { value: "PX_16", done: true };
|
|
}
|
|
} else {
|
|
if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else {
|
|
closure_130_2 = closure_131_10.isVideoEnabled();
|
|
channelVideoLimit = closure_131_0(closure_131_3[12]).getChannelVideoLimit(closure_130_0);
|
|
reachedLimit = channelVideoLimit.reachedLimit;
|
|
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;
|
|
const obj7 = { limit: limit.toString() };
|
|
obj5.body = intl2.formatToPlainString(closure_131_0(closure_131_3[14]).t.x9mtl4, obj7);
|
|
closure_131_1(closure_131_3[13]).show(obj5);
|
|
const obj6 = closure_131_1(closure_131_3[13]);
|
|
}
|
|
} else if (closure_130_2) {
|
|
tmp12(tmp13[16]).setVideoEnabled(false);
|
|
const tmp12Result = tmp12(tmp13[16]);
|
|
} else {
|
|
c4 = 2;
|
|
c5 = 1;
|
|
const obj8 = { value: tmp12(tmp13[15]).requestPermission(closure_131_15.CAMERA), done: false };
|
|
return obj8;
|
|
}
|
|
c5 = 3;
|
|
const obj12 = 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);
|
|
const obj = closure_131_1(closure_131_3[16]);
|
|
}
|
|
}
|
|
c5 = 3;
|
|
const obj9 = { value, done: true };
|
|
return obj9;
|
|
}
|
|
} catch (tmp31) {
|
|
c5 = tmp;
|
|
throw tmp31;
|
|
}
|
|
}
|
|
};
|
|
const NativeModules = fn(17).NativeModules;
|
|
const NativePermissionTypes = fn(4784).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: _modDef9143, BLUETOOTH_HEADSET: _modDef9144, WIRED_HEADSET: _modDef9145, SPEAKERPHONE: _modDef9145, INVALID: _modDef9145 };
|
|
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(9497).isVideoMode(ChannelStore, SelectedChannelStore, ApplicationStreamingStore, VoiceStateStore, MediaEngineStore);
|
|
currentRouteType = currentRouteType.getCurrentRouteType();
|
|
isEnabled = currentRouteType === isEnabled(9116).RouteTypes.SPEAKER;
|
|
const isBluetoothRoute = currentRouteType === isEnabled(9116).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 ? 9144 : 9145) };
|
|
});
|
|
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 ? 9144 : 9145) };
|
|
};
|