Files
discord-decomp/sources/utils/native/PrivateChannelCallUtils.tsx
2026-07-28 01:06:53 +03:00

462 lines
25 KiB
TypeScript

/* Metro module 7709; source: utils/native/PrivateChannelCallUtils.tsx; dependencies: [5, 31, 3849, 7710, 1379, 3793, 1934, 1878, 661, 1229, 4661, 33, 5072, 7712, 7713, 1239, 5080, 7714, 1962, 5459, 5075, 4080, 12084, 4796, 4496, 1244, 4662, 4015, 12120, 4497, 8916, 4007, 8114, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import ActionSheetStore from '../../modules/action_sheet/native/ActionSheetStore.tsx'; /* Metro dependency 3849 */
import AlertActionCreators from '../../actions/native/AlertActionCreators.tsx'; /* Metro dependency 4496 */
import SelectedChannelActionCreators from '../../actions/SelectedChannelActionCreators.tsx'; /* Metro dependency 4796 */
import ModalActionCreators from '../../actions/ModalActionCreators.tsx'; /* Metro dependency 5080 */
import VoicePanelStore from '../../modules/voice_panel/VoicePanelStore.tsx'; /* Metro dependency 7710 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as AgeGateConstantsModule from '../../modules/age_gate/AgeGateConstants.tsx'; /* Metro dependency 1229 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as NativePermissionConstantsModule from '../../modules/native_permissions/NativePermissionConstants.tsx'; /* Metro dependency 4661 */
import * as AgeGateUtilsModule from '../../modules/age_gate/AgeGateUtils.tsx'; /* Metro dependency 5072 */
function _fun61571(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:6, offset: 0x01b4599f, size: 554 bytes, params: 8, frame: 26
const env0_0 = require;
const closure = function(a0) {
return getVoiceChannelKeyByChannelId(a0);
};
const openChannelCallModal2 = openChannelCallModal;
const dismissVoiceChannelScreens2 = dismissVoiceChannelScreens;
const closure4 = function() {
var Promise = global.Promise;
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
var value2 = new Promise(_fun61576);
return value2 instanceof Object ? value2 : value;
};
const showGuardCallAlert2 = showGuardCallAlert;
const guardPrivateCallForChannel2 = guardPrivateCallForChannel;
const closure7 = function(a0, a1) {
if (!require(dependencyMap[31]).isModalOpen(getVoiceChannelKey(a0.id))) {
openChannelCallModal(a0);
}
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const closure8 = function(a0) {
return '' + 'voice-channel' + '-' + a0;
};
(FileImportTrackerModule).fileFinishedImporting('utils/native/PrivateChannelCallUtils.tsx');
exports.getVoiceChannelKeyByChannelId = closure8;
exports.getVoiceChannelKey = closure;
exports.isVoiceChannelModalKey = function(a0) {
return a0.startsWith('voice-channel');
};
exports.openChannelCallModal = openChannelCallModal2;
exports.maybeShowAgeGateModal = maybeShowAgeGateModal;
exports.openVoiceChannelActionSheet = openVoiceChannelActionSheet;
exports.hideVoiceChannelActionSheet = function(a0) {
importDefault(dependencyMap[21]).hideActionSheet(getVoiceChannelKey(a0.id));
};
exports.dismissVoiceChannelScreens = dismissVoiceChannelScreens2;
exports.monkeyPatchCall = closure4;
exports.showGuardCallAlert = showGuardCallAlert2;
exports.guardPrivateCallForChannel = guardPrivateCallForChannel2;
exports.handleJoinCall = handleJoinCall;
exports.handleStartCall = handleStartCall;
exports.handleRedesignGroupDMCall = handleRedesignGroupDMCall;
exports.handleRedesignJoinCall = handleRedesignJoinCall;
exports.openGuildVoiceModal = closure7;
exports.navigateToVoiceChannel = function(a0, a1) {
if (a0.isPrivate()) {
openChannelCallModal(a0);
} else if (a0.isGuildStageVoice()) {
require(dependencyMap[32]).openStageChannel(a0);
} else {
openGuildVoiceModal(a0);
}
};
function openChannelCallModal(a0) { // fn#61573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:439, offset: 0x01b45bdc, size: 289 bytes, params: 2, frame: 19
var moduleValue2;
var defaultImport2;
var state;
var openChannel;
var ComponentDispatch;
var dispatch;
var VOICE_PANEL_OPEN;
const moduleValue = require(dependencyMap[12]);
const maybeOpenAgeGateForVoiceChannel = moduleValue.maybeOpenAgeGateForVoiceChannel;
let id = a0.id;
if (!Reflect.apply(maybeOpenAgeGateForVoiceChannel, moduleValue, [id])) {
importDefault(dependencyMap[13]).rebuildRTCActiveChannels();
moduleValue2 = require(dependencyMap[14]);
if (moduleValue2.isVoicePanelEnabled(a0)) {
state = VoicePanelStore.getState();
openChannel = state.openChannel;
id = a0.id;
Reflect.apply(openChannel, state, [id]);
ComponentDispatch = require(dependencyMap[15]).ComponentDispatch;
dispatch = ComponentDispatch.dispatch;
VOICE_PANEL_OPEN = ComponentActions.VOICE_PANEL_OPEN;
id = a0.id;
Reflect.apply(dispatch, ComponentDispatch, [VOICE_PANEL_OPEN, {channelId: id}]);
} else {
defaultImport2 = importDefault(dependencyMap[16]);
defaultImport2.pushLazy(require(dependencyMap[18])(dependencyMap[17], dependencyMap.paths), {channel: a0},
getVoiceChannelKey(a0.id));
}
}
}
function dismissVoiceChannelScreens({id}, a1) { // fn#61574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:776, offset: 0x01b45cfd, size: 107 bytes, params: 3, frame: 15
const voiceChannelKey = getVoiceChannelKey(id);
(ModalActionCreators).popWithKey(voiceChannelKey, a1);
const actionSheetStoreBinding = ActionSheetStore;
const getKey = actionSheetStoreBinding.getKey;
if (Reflect.apply(getKey, actionSheetStoreBinding, []) === voiceChannelKey) {
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
}
}
function monkeyPatchCall() { // fn#61575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:916, offset: 0x01b45d68, size: 37 bytes, params: 1, frame: 11
const Promise = global.Promise;
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(_fun61576);
return promise instanceof Object ? promise : value;
function _fun61576(a0) { // fn#61576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:963, offset: 0x01b45d8d, size: 106 bytes, params: 2, frame: 14
const value = environment.__proto__;
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
if (channel != null) {
dismissVoiceChannelScreens(channel);
}
(SelectedChannelActionCreators).selectVoiceChannel(null);
global.setTimeout(a0, 500);
}
}
function showGuardCallAlert(a0) { // fn#61577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1107, offset: 0x01b45df7, size: 224 bytes, params: 2, frame: 20
const env0_0 = a0;
const defaultImport = AlertActionCreators;
const show = defaultImport.show;
const object = {};
const intl = (IndexNativeModule).intl;
const string = intl.string;
const t = (IndexNativeModule).t;
object.title = Reflect.apply(string, intl, [t['91WuJ9']]);
object.body = intl.string(t['Rs+Vk1']);
object.cancelText = intl.string(t['ETE/oC']);
object.onConfirm = onConfirm_61578;
object.onCancel = NOOP;
Reflect.apply(show, defaultImport, [object]);
function showGuardCallAlertOnConfirm() { // fn#61578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1314, owner: showGuardCallAlert.onConfirm, offset: 0x00cefeb4, size: 15 bytes, params: 1, frame: 9
return env0_0();
}
}
function guardPrivateCallForChannel(a0, a1) { // fn#61579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1335, offset: 0x01b45ed7, size: 123 bytes, params: 3, frame: 16
const env0_0 = a1;
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
if (channel == null) {
a1();
} else if (channel.type === ChannelTypes.GUILD_VOICE) {
a1();
} else if (a0 == null) {
a1();
} else if (a0.id !== channel.id) {
showGuardCallAlert(Module00005(_fun61581));
} else {
a1();
}
function* _fun61581() { // fn#61581, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1498, offset: 0x01b45f5b, size: 50 bytes, params: 1, frame: 11
if (true) {
value = environment.__proto__.__proto__;
yield env2_21();
if (false) {
return undefined;
}
value = environment.__proto__;
require();
}
}
}
function maybeShowAgeGateModal(a0) { // fn#61585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:1989, offset: 0x01b4600d, size: 86 bytes, params: 2, frame: 14
if (AgeGateUtilsModule.shouldShowAgeGateForChannelId(a0)) {
(require(5459) /* metro dependency 5459: RunAfterInteractionsUtils */).runAfterInteractions(function() {
require(dependencyMap[20]).openAgeGateModal(AgeGateSource.NSFW_VOICE_CHANNEL);
}, 150);
}
}
function openVoiceChannelActionSheet(a0) { // fn#61587, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2188, offset: 0x01b46093, size: 97 bytes, params: 2, frame: 18
const defaultImport = importDefault(dependencyMap[21]);
defaultImport.openLazy(require(dependencyMap[18])(dependencyMap[22], dependencyMap.paths),
getVoiceChannelKey(a0.id), {channel: a0});
}
function handleJoinCall(a0) { // fn#61589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2634, offset: 0x01b4612b, size: 53 bytes, params: 2, frame: 14
const value = a1;
const env0_0 = a0;
const env0_1 = value !== undefined ? value : false;
guardPrivateCallForChannel(a0, function() {
return _onConfirm.apply(this, arguments);
});
function _onConfirm() { // fn#61590, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2666, owner: handleJoinCall._onConfirm, offset: 0x01b46160, size: 51 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_3(_fun61592).apply(this, arguments);
function* _fun61592() { // fn#61592, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2709, offset: 0x01b4619c, size: 167 bytes, params: 1, frame: 17
var value3;
var binding;
var value4;
var value5;
var value7;
var binding2;
var value9;
if (true) {
value = environment.__proto__.__proto__;
if (importDefault) {
value3 = environment.__proto__.__proto__.__proto__;
binding = env3_1;
value4 = binding(env3_2[26]);
yield value4.requestPermission(env3_15.CAMERA);
value5 = undefined;
if (false) {
return value5;
}
if (value5) {
value7 = environment.__proto__.__proto__.__proto__;
binding = env3_0;
binding2 = env3_2;
binding(binding2[27]).dismissKeyboard();
binding = env3_1;
value9 = binding(binding2[23]);
value9.selectVoiceChannel(require.id, importDefault);
return undefined;
}
} else {
binding = env3_0;
binding2 = env3_2;
binding(binding2[27]).dismissKeyboard();
binding = env3_1;
value9 = binding(binding2[23]);
value9.selectVoiceChannel(require.id, importDefault);
}
}
}
}
}
function handleStartCall(a0) { // fn#61594, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:2982, offset: 0x01b46243, size: 66 bytes, params: 2, frame: 14
const value = a1;
const env0_0 = a0;
const env0_1 = value !== undefined ? value : false;
if (!guardAgainstCallingProvisionalAccount(a0)) {
guardPrivateCallForChannel(a0, function() {
return _onConfirm2.apply(this, arguments);
});
}
function _onConfirm2() { // fn#61595, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3015, owner: handleStartCall._onConfirm2, offset: 0x01b46285, size: 51 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_3(_fun61597).apply(this, arguments);
function* _fun61597() { // fn#61597, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3060, offset: 0x01b462c1, size: 280 bytes, params: 1, frame: 22
var r8;
var r7;
var value3;
var binding;
var value4;
var value5;
var value7;
var value12;
var call;
var id;
if (true) {
value = environment.__proto__.__proto__;
if (importDefault) {
value3 = environment.__proto__.__proto__.__proto__;
binding = env3_1;
value4 = binding(env3_2[26]);
yield value4.requestPermission(env3_15.CAMERA);
value5 = undefined;
if (false) {
return value5;
}
if (value5) {
value7 = environment.__proto__.__proto__.__proto__;
binding = env3_0;
binding(env3_2[27]).dismissKeyboard();
r8 = require.type !== env3_11.DM || env3_8.isFriend(require.getRecipientId());
r7 = r8 ? null : require.getRecipientId();
binding = env3_1;
value12 = binding(env3_2[30]);
call = value12.call;
id = require.id;
r8 = r8 && !require.isManaged();
Reflect.apply(call, value12, [id, importDefault, r8, r7]);
return undefined;
}
} else {
binding = env3_0;
binding(env3_2[27]).dismissKeyboard();
r8 = require.type !== env3_11.DM || env3_8.isFriend(require.getRecipientId());
r7 = r8 ? null : require.getRecipientId();
binding = env3_1;
value12 = binding(env3_2[30]);
call = value12.call;
id = require.id;
r8 = r8 && !require.isManaged();
Reflect.apply(call, value12, [id, importDefault, r8, r7]);
}
}
}
}
function guardAgainstCallingProvisionalAccount(a0) { // fn#61598, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3307, owner: handleStartCall.guardAgainstCallingProvisionalAccount, offset: 0x01b463d9, size: 141 bytes, params: 2, frame: 15
var environment;
var value;
var userStoreBinding;
var value2;
if (a0.isDM()) {
value = environment.__proto__;
userStoreBinding = UserStore;
value2 = userStoreBinding.getUser(a0.getRecipientId());
if (value2 == null) {
return false;
}
if (value2.isProvisional) {
(require(4497) /* metro dependency 4497: useAlertStoreNative */).openAlert('ProvisionalAccountNocallAllowed',
((Component) => <Component />)(env1_4.lazy(_fun61599)));
return true;
}
}
return false;
function _fun61599() { // fn#61599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3448, offset: 0x01b46466, size: 45 bytes, params: 1, frame: 13
const value = environment.__proto__.__proto__;
return require(dependencyMap[18])(dependencyMap[28], dependencyMap.paths);
}
}
}
function handleRedesignGroupDMCall(a0) { // fn#61601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3689, offset: 0x01b46493, size: 53 bytes, params: 2, frame: 14
const value = a1;
const env0_0 = a0;
const env0_1 = value !== undefined ? value : false;
guardPrivateCallForChannel(a0, function() {
return _onConfirm3.apply(this, arguments);
});
function _onConfirm3() { // fn#61602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3732, owner: handleRedesignGroupDMCall._onConfirm3, offset: 0x01b464c8, size: 51 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_3(_fun61604).apply(this, arguments);
function* _fun61604() { // fn#61604, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:3777, offset: 0x01b46504, size: 169 bytes, params: 1, frame: 18
var value3;
var binding;
var value4;
var value5;
var value7;
var binding2;
var value9;
if (true) {
value = environment.__proto__.__proto__;
if (importDefault) {
value3 = environment.__proto__.__proto__.__proto__;
binding = env3_1;
value4 = binding(env3_2[26]);
yield value4.requestPermission(env3_15.CAMERA);
value5 = undefined;
if (false) {
return value5;
}
if (value5) {
value7 = environment.__proto__.__proto__.__proto__;
binding = env3_0;
binding2 = env3_2;
binding(binding2[27]).dismissKeyboard();
binding = env3_1;
value9 = binding(binding2[30]);
value9.call(require.id, importDefault, true);
return undefined;
}
} else {
binding = env3_0;
binding2 = env3_2;
binding(binding2[27]).dismissKeyboard();
binding = env3_1;
value9 = binding(binding2[30]);
value9.call(require.id, importDefault, true);
}
}
}
}
}
function handleRedesignJoinCall(a0) { // fn#61606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:4047, offset: 0x01b465ad, size: 53 bytes, params: 2, frame: 14
const value = a1;
const env0_0 = a0;
const env0_1 = value !== undefined ? value : false;
guardPrivateCallForChannel(a0, function() {
return _onConfirm4.apply(this, arguments);
});
function _onConfirm4() { // fn#61607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:4087, owner: handleRedesignJoinCall._onConfirm4, offset: 0x01b465e2, size: 51 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_3(_fun61609).apply(this, arguments);
function* _fun61609() { // fn#61609, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7887:4132, offset: 0x01b4619c, size: 167 bytes, params: 1, frame: 17
var value3;
var binding;
var value4;
var value5;
var value7;
var binding2;
var value9;
if (true) {
value = environment.__proto__.__proto__;
if (importDefault) {
value3 = environment.__proto__.__proto__.__proto__;
binding = env3_1;
value4 = binding(env3_2[26]);
yield value4.requestPermission(env3_15.CAMERA);
value5 = undefined;
if (false) {
return value5;
}
if (value5) {
value7 = environment.__proto__.__proto__.__proto__;
binding = env3_0;
binding2 = env3_2;
binding(binding2[27]).dismissKeyboard();
binding = env3_1;
value9 = binding(binding2[23]);
value9.selectVoiceChannel(require.id, importDefault);
return undefined;
}
} else {
binding = env3_0;
binding2 = env3_2;
binding(binding2[27]).dismissKeyboard();
binding = env3_1;
value9 = binding(binding2[23]);
value9.selectVoiceChannel(require.id, importDefault);
}
}
}
}
}
}
global.__d(_fun61571, 7709, [5, 31, 3849, 7710, 1379, 3793, 1934, 1878, 661, 1229, 4661, 33, 5072, 7712, 7713, 1239,
5080, 7714, 1962, 5459, 5075, 4080, 12084, 4796, 4496, 1244, 4662, 4015, 12120, 4497, 8916, 4007, 8114,
2]) /* metro module 7709, dependencies: [5, 31, 3849, 7710, 1379, 3793, 1934, 1878, 661, 1229, 4661, 33, 5072, 7712, 7713, 1239, 5080, 7714, 1962, 5459, 5075, 4080, 12084, 4796, 4496, 1244, 4662, 4015, 12120, 4497, 8916, 4007, 8114, 2] */;