200 lines
10 KiB
TypeScript
200 lines
10 KiB
TypeScript
/* Metro module 13085; source: modules/voice_messages/native/VoiceMessagesPlaybackManager.tsx; dependencies: [6, 7, 15, 17, 18, 27, 4502, 1934, 477, 13086, 4560, 694, 4561, 2] */
|
|
function _fun99980(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99980, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:6, offset: 0x021db066, size: 349 bytes, params: 8, frame: 22
|
|
const env0_0 = require;
|
|
const closure = pauseCurrentAudioPlayer;
|
|
const closure2 = playCurrentAudioPlayer;
|
|
const closure3 = handleVoiceMessageDeleted;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_5 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_6 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_7 = importDefault(18) /* metro dependency 18 */;
|
|
let value = require(27) /* metro dependency 27 */;
|
|
const env0_8 = value.AppState;
|
|
const env0_9 = value.NativeModules;
|
|
const accessibilityStore = importDefault(4502) /* metro dependency 4502: AccessibilityStore */;
|
|
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
|
|
value = importDefault(4561) /* metro dependency 4561: LifecycleManager */;
|
|
value = _fun99987(value);
|
|
value = new value();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/voice_messages/native/VoiceMessagesPlaybackManager.tsx');
|
|
exports.default = value;
|
|
exports.pauseCurrentAudioPlayer = closure;
|
|
exports.playCurrentAudioPlayer = closure2;
|
|
exports.handleVoiceMessageDeleted = closure3;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_99981() { // fn#99981, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:209, offset: 0x021db1c3, 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_99981_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function pauseCurrentAudioPlayer(a0) { // fn#99984, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:402, offset: 0x021db225, size: 103 bytes, params: 2, frame: 13
|
|
var DCDAudioPlayerManager;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
(importDefault(13086) /* metro dependency 13086: NativeAudioPlayerModule */).pauseCurrentPlayer(a0);
|
|
} else {
|
|
DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
|
|
if (DCDAudioPlayerManager != null) {
|
|
DCDAudioPlayerManager.pauseCurrentPlayer(a0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function playCurrentAudioPlayer() { // fn#99985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:553, offset: 0x021db28c, size: 98 bytes, params: 1, frame: 12
|
|
var DCDAudioPlayerManager;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
(importDefault(13086) /* metro dependency 13086: NativeAudioPlayerModule */).maybePlayCurrentPlayer();
|
|
} else {
|
|
DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
|
|
if (DCDAudioPlayerManager != null) {
|
|
DCDAudioPlayerManager.maybePlayCurrentPlayer();
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleVoiceMessageDeleted(a0) { // fn#99986, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:708, offset: 0x021db2ee, size: 103 bytes, params: 2, frame: 13
|
|
var DCDAudioPlayerManager;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
(importDefault(13086) /* metro dependency 13086: NativeAudioPlayerModule */).handleVoiceMessageDeleted(a0);
|
|
} else {
|
|
DCDAudioPlayerManager = NativeModules.DCDAudioPlayerManager;
|
|
if (DCDAudioPlayerManager != null) {
|
|
DCDAudioPlayerManager.handleVoiceMessageDeleted(a0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun99987(a0) { // fn#99987, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:885, offset: 0x021db355, size: 97 bytes, params: 2, frame: 16
|
|
const closure = VoiceMessagesPlaybackManager;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{key: '_terminate', value: value_99993}, {key: '_initialize', value: value_99994}]);
|
|
}
|
|
|
|
function VoiceMessagesPlaybackManager(a0) { // fn#99988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:897, offset: 0x021db3b6, size: 200 bytes, params: 2, frame: 21
|
|
var environment;
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let value2 = environment.__proto__;
|
|
let binding = env1_3;
|
|
binding(this, VoiceMessagesPlaybackManager);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(VoiceMessagesPlaybackManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_99981()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.appState = AppState.currentState;
|
|
value.handleSetPrefersReducedMotion = handleSetPrefersReducedMotion;
|
|
value.handleMessageDelete = function({id, channelId}) {
|
|
var value2 = channelId === SelectedChannelStore.getCurrentlySelectedChannelId();
|
|
if (value2 != null && value2) {
|
|
if (handleVoiceMessageDeleted != null) {
|
|
handleVoiceMessageDeleted(id);
|
|
}
|
|
}
|
|
};
|
|
value.handleLogout = function() {
|
|
pauseCurrentAudioPlayer(false);
|
|
};
|
|
value.handleAppStateChanged = handleAppStateChanged_99992;
|
|
return value;
|
|
}
|
|
|
|
function value_99993() { // fn#99993, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:1911, offset: 0x021db5a5, size: 147 bytes, params: 1, frame: 18
|
|
let value = environment.__proto__;
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.unsubscribe('LOGOUT', this.handleLogout);
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.unsubscribe('MESSAGE_DELETE', this.handleMessageDelete);
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.unsubscribe('APP_STATE_UPDATE', this.handleAppStateChanged);
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.unsubscribe('ACCESSIBILITY_SET_PREFERS_REDUCED_MOTION', this.handleSetPrefersReducedMotion);
|
|
}
|
|
|
|
function value_99994() { // fn#99994, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:2230, offset: 0x021db638, size: 179 bytes, params: 1, frame: 19
|
|
const defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
defaultImport.subscribe('LOGOUT', this.handleLogout);
|
|
const defaultImport2 = defaultImport;
|
|
defaultImport2.subscribe('MESSAGE_DELETE', this.handleMessageDelete);
|
|
const defaultImport3 = defaultImport;
|
|
defaultImport3.subscribe('APP_STATE_UPDATE', this.handleAppStateChanged);
|
|
const defaultImport4 = defaultImport;
|
|
defaultImport4.subscribe('ACCESSIBILITY_SET_PREFERS_REDUCED_MOTION', this.handleSetPrefersReducedMotion);
|
|
this.handleSetPrefersReducedMotion({type: 'ACCESSIBILITY_SET_PREFERS_REDUCED_MOTION',
|
|
prefersReducedMotion: AccessibilityStore.rawPrefersReducedMotion});
|
|
}
|
|
|
|
function handleSetPrefersReducedMotion(a0) { // fn#99989, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:1225, owner: VoiceMessagesPlaybackManager.handleSetPrefersReducedMotion, offset: 0x021db47e, size: 109 bytes, params: 2, frame: 14
|
|
var DCDAccessibilityManager;
|
|
let value = environment.__proto__.__proto__;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
value = importDefault(4560) /* metro dependency 4560: NativeDeviceAccessibilityModule */;
|
|
value.handleSetPrefersReducedMotion(a0.prefersReducedMotion);
|
|
} else {
|
|
DCDAccessibilityManager = NativeModules.DCDAccessibilityManager;
|
|
DCDAccessibilityManager.handleSetPrefersReducedMotion(a0.prefersReducedMotion);
|
|
}
|
|
}
|
|
|
|
function VoiceMessagesPlaybackManagerHandleAppStateChanged({state}) { // fn#99992, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13275:1634, owner: VoiceMessagesPlaybackManager.handleAppStateChanged, offset: 0x021db533, size: 114 bytes, params: 2, frame: 14
|
|
var binding;
|
|
var appState;
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isAndroid()) {
|
|
binding = env0_0;
|
|
appState = binding.appState;
|
|
binding.appState = state;
|
|
if (state !== 'active') {
|
|
if (state !== 'active' && appState === 'active') {
|
|
pauseCurrentAudioPlayer(true);
|
|
}
|
|
} else if (appState !== 'active') {
|
|
playCurrentAudioPlayer();
|
|
} else if (state !== 'active' && appState === 'active') {
|
|
pauseCurrentAudioPlayer(true);
|
|
}
|
|
}
|
|
}
|
|
|