255 lines
14 KiB
TypeScript
255 lines
14 KiB
TypeScript
/* Metro module 13081; source: modules/soundboard/native/SoundboardManager.tsx; dependencies: [5, 7, 6, 15, 17, 18, 4259, 1934, 4613, 3, 13082, 13083, 10756, 6944, 13084, 2] */
|
|
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import SelectedChannelStore from '../../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
|
|
import MediaEngineStore from '../../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */
|
|
import SoundboardStore from '../SoundboardStore.tsx'; /* Metro dependency 4613 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
|
|
function _fun99948(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99948, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:6, offset: 0x021da43a, size: 366 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const Map = global.Map;
|
|
let map = new Map();
|
|
map = importDefault(3) /* metro dependency 3: Logger */;
|
|
map = new map('SoundboardManagerNative');
|
|
map = importDefault(13084) /* metro dependency 13084: BaseSoundboardManager */;
|
|
map = _fun99952(map);
|
|
map = new map();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/soundboard/native/SoundboardManager.tsx');
|
|
exports.default = map;
|
|
function _isNativeReflectConstruct_99949() { // fn#99949, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:188, offset: 0x021da5a8, 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_99949_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun99952(a0) { // fn#99952, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:439, offset: 0x021da60a, size: 42 bytes, params: 2, frame: 14
|
|
const SoundboardManager2 = SoundboardManager;
|
|
Inherits(SoundboardManager2, a0);
|
|
return CreateClass(SoundboardManager2);
|
|
function SoundboardManager(a0) { // fn#99953, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:451, offset: 0x021da634, size: 175 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_5;
|
|
binding(this, SoundboardManager);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_7(SoundboardManager);
|
|
binding = env1_6;
|
|
if (_isNativeReflectConstruct_99949()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_7(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value._stopAndClearSounds = _stopAndClearSounds;
|
|
value._playSound = _playSound;
|
|
value._playSoundWithListener = _fun99957();
|
|
return value;
|
|
function _stopAndClearSounds() { // fn#99954, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:710, owner: SoundboardManager._stopAndClearSounds, offset: 0x021da6e3, size: 62 bytes, params: 1, frame: 12
|
|
env2_12.forEach(function(a0) {
|
|
a0.stop();
|
|
});
|
|
const Map = global.Map;
|
|
const map = new Map();
|
|
}
|
|
|
|
function _playSound(a0) { // fn#99956, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:766, owner: SoundboardManager._playSound, offset: 0x021da732, size: 321 bytes, params: 2, frame: 22
|
|
var mediaEngineStoreBinding;
|
|
var soundboardStoreBinding;
|
|
var value2;
|
|
var value3;
|
|
var binding;
|
|
var value4;
|
|
var sound;
|
|
let value = a1;
|
|
const r3 = value !== undefined ? value : 1;
|
|
value = environment.__proto__.__proto__;
|
|
const selectedChannelStoreBinding = SelectedChannelStore;
|
|
const getVoiceChannelId = selectedChannelStoreBinding.getVoiceChannelId;
|
|
if (Reflect.apply(getVoiceChannelId, selectedChannelStoreBinding, []) === a3) {
|
|
mediaEngineStoreBinding = MediaEngineStore;
|
|
if (!mediaEngineStoreBinding.isDeaf()) {
|
|
soundboardStoreBinding = SoundboardStore;
|
|
if (!soundboardStoreBinding.isLocalSoundboardMuted(a2)) {
|
|
value2 = (importDefault(13082) /* metro dependency 13082: getVolumeForSound */)(r3);
|
|
value3 = '' + a2 + '-' + a0;
|
|
binding = env2_12;
|
|
value4 = binding.get(value3);
|
|
if (value4 != null) {
|
|
value4.stop();
|
|
}
|
|
sound = (require(10756) /* metro dependency 10756: SoundUtils */).createSound((importDefault(13083) /* metro dependency 13083: getSoundboardSoundURL */)(a0),
|
|
|
|
|
|
|
|
'soundboard_sound', value2);
|
|
sound.volume = value2;
|
|
binding = env2_12;
|
|
binding.set(value3, sound);
|
|
(require(6944) /* metro dependency 6944: SoundboardActionCreators */).reportSoundStartedPlaying(a0, a2);
|
|
binding = env0_0;
|
|
binding._playSoundWithListener({sound: sound, soundKey: value3, soundId: a0, userId: a2});
|
|
}
|
|
}
|
|
} else if (a3 == null) {
|
|
mediaEngineStoreBinding = MediaEngineStore;
|
|
if (!mediaEngineStoreBinding.isDeaf()) {
|
|
soundboardStoreBinding = SoundboardStore;
|
|
if (!soundboardStoreBinding.isLocalSoundboardMuted(a2)) {
|
|
value2 = (importDefault(13082) /* metro dependency 13082: getVolumeForSound */)(r3);
|
|
value3 = '' + a2 + '-' + a0;
|
|
binding = env2_12;
|
|
value4 = binding.get(value3);
|
|
if (value4 != null) {
|
|
value4.stop();
|
|
}
|
|
sound = (require(10756) /* metro dependency 10756: SoundUtils */).createSound((importDefault(13083) /* metro dependency 13083: getSoundboardSoundURL */)(a0),
|
|
|
|
|
|
|
|
'soundboard_sound', value2);
|
|
sound.volume = value2;
|
|
binding = env2_12;
|
|
binding.set(value3, sound);
|
|
(require(6944) /* metro dependency 6944: SoundboardActionCreators */).reportSoundStartedPlaying(a0, a2);
|
|
binding = env0_0;
|
|
binding._playSoundWithListener({sound: sound, soundKey: value3, soundId: a0, userId: a2});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun99957() { // fn#99957, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:1147, offset: 0x021da873, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env2_3(_fun99959);
|
|
return _fun99960;
|
|
async function _fun99959({sound, soundKey, soundId, userId}) { // fn#99959, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:1167, offset: 0x021da8ab, size: 181 bytes, params: 2, frame: 20
|
|
var r5;
|
|
var playWithListener;
|
|
var value4;
|
|
var error;
|
|
var binding;
|
|
if (true) {
|
|
await undefined;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
try {
|
|
playWithListener = sound.playWithListener;
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__.__proto__.__proto__;
|
|
binding = env4_13;
|
|
binding.error('Failed to play sound', {error: error});
|
|
value = true;
|
|
r5 = value;
|
|
if (r5) {
|
|
value = environment.__proto__.__proto__.__proto__.__proto__;
|
|
binding = env4_12;
|
|
binding.delete(soundKey);
|
|
binding = env4_0;
|
|
value = binding(env4_2[13]);
|
|
value.reportSoundFinishedPlaying(soundId, userId);
|
|
}
|
|
return undefined;
|
|
}
|
|
try {
|
|
value = Reflect.apply(playWithListener, sound, []);
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__.__proto__.__proto__;
|
|
binding = env4_13;
|
|
binding.error('Failed to play sound', {error: error});
|
|
value = true;
|
|
r5 = value;
|
|
if (r5) {
|
|
value = environment.__proto__.__proto__.__proto__.__proto__;
|
|
binding = env4_12;
|
|
binding.delete(soundKey);
|
|
binding = env4_0;
|
|
value = binding(env4_2[13]);
|
|
value.reportSoundFinishedPlaying(soundId, userId);
|
|
}
|
|
return undefined;
|
|
}
|
|
await value;
|
|
try {
|
|
value = undefined;
|
|
value4 = false;
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__.__proto__.__proto__;
|
|
binding = env4_13;
|
|
binding.error('Failed to play sound', {error: error});
|
|
value = true;
|
|
r5 = value;
|
|
if (r5) {
|
|
value = environment.__proto__.__proto__.__proto__.__proto__;
|
|
binding = env4_12;
|
|
binding.delete(soundKey);
|
|
binding = env4_0;
|
|
value = binding(env4_2[13]);
|
|
value.reportSoundFinishedPlaying(soundId, userId);
|
|
}
|
|
return undefined;
|
|
}
|
|
if (value4) {
|
|
return value;
|
|
}
|
|
if (value) {
|
|
value = environment.__proto__.__proto__.__proto__.__proto__;
|
|
binding = env4_12;
|
|
binding.delete(soundKey);
|
|
binding = env4_0;
|
|
value = binding(env4_2[13]);
|
|
value.reportSoundFinishedPlaying(soundId, userId);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun99960() { // fn#99960, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13271:1384, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
|
|
return env0_0.apply(this, arguments);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun99948, 13081, [5, 7, 6, 15, 17, 18, 4259, 1934, 4613, 3, 13082, 13083, 10756, 6944, 13084,
|
|
2]) /* metro module 13081, dependencies: [5, 7, 6, 15, 17, 18, 4259, 1934, 4613, 3, 13082, 13083, 10756, 6944, 13084, 2] */;
|