Files
discord-decomp/sources/stores/PermissionVADStore.tsx
T
2026-07-27 16:20:00 +03:00

127 lines
6.3 KiB
TypeScript

/* Metro module 12951; source: stores/PermissionVADStore.tsx; dependencies: [6, 7, 15, 17, 18, 1226, 1379, 4259, 3784, 4294, 4297, 661, 694, 566, 2] */
function _fun98658(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#98658, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13141:6, offset: 0x021b1b28, size: 491 bytes, params: 8, frame: 21
const closure = RTC_CONNECTION_STATE_98662;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const mediaEngineStore = importDefault(4259) /* metro dependency 4259: MediaEngineStore */;
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
const rtcConnectionStore = importDefault(4294) /* metro dependency 4294: RTCConnectionStore */;
const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_13 = value.InputModes;
const env0_14 = value.Permissions;
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun98663(Store).displayName = 'PermissionVADStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {RTC_CONNECTION_STATE: closure,
MEDIA_ENGINE_SET_AUDIO_ENABLED: closure, AUDIO_SET_MODE: closure, CHANNEL_UPDATES: closure,
THREAD_UPDATE: closure, GUILD_ROLE_UPDATE: closure, GUILD_MEMBER_UPDATE: closure, IMPERSONATE_UPDATE: closure,
IMPERSONATE_STOP: closure, VOICE_STATE_UPDATES: function({voiceStates}) {
return voiceStates.some(_fun98669);
}, AUDIO_TOGGLE_SELF_MUTE: AUDIO_TOGGLE_SELF_MUTE_98670, PERMISSION_CLEAR_VAD_WARNING: function() {
env0_16 = true;
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/PermissionVADStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_98659() { // fn#98659, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13141:251, offset: 0x021b1d13, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_98659_isNativeReflectConstruct = function() {
return !!result;
})();
}
function AUDIO_SET_MODE_98662() { // fn#98662, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13141:458, offset: 0x021b1d75, size: 301 bytes, params: 1, frame: 19
var r3;
var r0;
var r2;
var channel;
var getVoiceState;
var value7;
var defaultImport;
const channelId = RTCConnectionStore.getChannelId();
const value3 = true;
if (channelId == null) {
r2 = value3;
} else {
channel = ChannelStore.getChannel(channelId);
getVoiceState = VoiceStateStore.getVoiceState;
r3 = channel?.getGuildId();
value7 = Reflect.apply(getVoiceState, VoiceStateStore, [r3, AuthenticationStore.getId()]);
r0 = MediaEngineStore.getMode() !== InputModes.VOICE_ACTIVITY || channel == null;
r0 = !r0 ? channel.isPrivate() : r0;
r0 = !r0 ? channel.isGuildStageVoice() : r0;
r0 = !r0 ? PermissionStore.can(Permissions.USE_VAD, channel) : r0;
if (!r0) {
r3 = value7 == null || !!value7.suppress;
r3 = !r3 ? value7.requestToSpeakTimestamp != null : r3;
r0 = r3;
}
r2 = r0;
}
const value15 = env0_15 !== r2;
if (value15) {
env0_15 = r2;
defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */;
defaultImport.dispatch({type: 'SET_VAD_PERMISSION', hasPermission: env0_15});
r0 = value3;
} else {
r0 = value15;
}
return r0;
}
function _fun98663(a0) { // fn#98663, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13141:917, offset: 0x021b1ea2, size: 124 bytes, params: 2, frame: 16
const closure = PermissionVADStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'initialize', value: function() {
this.waitFor(AuthenticationStore, ChannelStore, MediaEngineStore, PermissionStore, RTCConnectionStore,
VoiceStateStore);
}}, {key: 'shouldShowWarning', value: value_98666}, {key: 'canUseVoiceActivity', value: value_98667}]);
}
function VOICE_STATE_UPDATES_98668({voiceStates}) { // fn#98668, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13141:1885, offset: 0x021b1f59, size: 31 bytes, params: 2, frame: 11
return voiceStates.some(_fun98669);
}
function value_98666() { // fn#98666, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13141:1307, offset: 0x021b1f4d, size: 12 bytes, params: 1, frame: 1
return !env1_16;
}
function _fun98669({userId}) { // fn#98669, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13141:1950, offset: 0x021b1f78, size: 44 bytes, params: 2, frame: 11
const value = environment.__proto__;
const getId = AuthenticationStore.getId;
return userId === Reflect.apply(getId, AuthenticationStore, []) && RTC_CONNECTION_STATE_98662();
}