Files
discord-decomp/sources/components_native/common/NativePortalView.tsx
T
2026-07-27 16:20:00 +03:00

173 lines
9.0 KiB
TypeScript

/* Metro module 9548; source: components_native/common/NativePortalView.tsx; dependencies: [31, 27, 33, 4501, 477, 9549, 9550, 2] */
function _fun74544(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74544, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:6, offset: 0x01d91b00, size: 398 bytes, params: 8, frame: 26
var value5;
var value6;
let env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = importAll(31) /* metro dependency 31 */;
const {requireNativeComponent, NativeEventEmitter, NativeModules} = require(27) /* metro dependency 27 */;
const env0_4 = (require(33) /* metro dependency 33 */).jsx;
const env0_5 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({base: {overflow: 'hidden'}});
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
if (platformUtilsModule.isAndroid()) {
value6 = importDefault(9549) /* metro dependency 9549: PortalViewNativeComponent */;
} else {
value5 = requireNativeComponent('DCDPortalView');
}
const MediaPlayerManager = NativeModules.MediaPlayerManager;
const env0_8 = NativeModules.DCDPortalViewManager;
const nativeEventEmitter = new NativeEventEmitter(MediaPlayerManager);
const Set = global.Set;
const set = new Set();
value = value.memo(_fun74545);
(require(2) /* metro dependency 2 */).fileFinishedImporting('components_native/common/NativePortalView.tsx');
exports.default = value;
exports.createPortalControls = function(a0) {
var env0_0 = a0;
return {seek: _fun74552, pause: _fun74553, useSubscribe: _fun74554};
};
exports.markPortalAlive = markPortalAlive;
exports.isPortalExpired = isPortalExpired;
}
function _fun74545(a0) { // fn#74545, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:381, offset: 0x01d91c8e, size: 439 bytes, params: 2, frame: 23
var r0;
const style = a0.style;
const children = a0.children;
const paused = a0.paused;
const muted = a0.muted;
const onLoad = a0.onLoad;
const object2 = {'style': 0, 'children': 0, 'paused': 0, 'muted': 0, 'onLoad': 0};
silentSetPrototypeOf(object2, null, undefined);
let value = copyDataProperties({}, a0, object2, undefined);
const env0_3 = value;
const styles = useStyles();
if (children != null) {
throw new global.Error('The <NativePortalView> component cannot contain children.');
}
let binding = env0_3;
binding.useLayoutEffect(_fun74546, [value.portal, paused]);
binding.useLayoutEffect(_fun74547, [value.portal, muted]);
binding.useLayoutEffect(_fun74548, [onLoad, value.portal]);
const value3 = binding.useCallback(_fun74550, [onLoad, value.portal]);
const isAndroid2 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid();
binding = env0_6;
if (isAndroid2) {
value = ((Component) => <Component {...value} {...{['style']: [styles.base,
style]}} {...{['onPortalViewLoaded']: value3}} />)(binding);
r0 = value;
} else {
value = ((Component) => <Component {...value} {...{['style']: [styles.base, style]}} />)(binding);
r0 = value;
}
return r0;
}
function createPortalControls(a0) { // fn#74551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1248, offset: 0x01d91ffe, size: 49 bytes, params: 2, frame: 3
const env0_0 = a0;
return {seek: seek_74552, pause: pause_74553, useSubscribe: useSubscribe};
}
function markPortalAlive(a0) { // fn#74561, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1849, offset: 0x01d92233, size: 24 bytes, params: 2, frame: 11
env0_10.delete(a0);
}
function _fun74546() { // fn#74546, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:560, offset: 0x01d91e45, size: 59 bytes, params: 1, frame: 13
var value2;
if (env0_3.portal != null) {
value2 = environment.__proto__;
MediaPlayerManager.toggle(env0_3.portal, !paused);
}
}
function _fun74547() { // fn#74547, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:638, offset: 0x01d91e80, size: 56 bytes, params: 1, frame: 13
var value2;
if (env0_3.portal != null) {
value2 = environment.__proto__;
MediaPlayerManager.setMuted(env0_3.portal, muted);
}
}
function _fun74548() { // fn#74548, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:717, offset: 0x01d91eb8, size: 107 bytes, params: 1, frame: 14
if (!((require(477) /* metro dependency 477: PlatformUtils */).isAndroid() || onLoad == null)) {
onLoad();
}
MediaPlayerManager.setLoopPlayback(env0_3.portal, true);
return _fun74549;
}
function _fun74550({nativeEvent}) { // fn#74550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:957, offset: 0x01d91fc6, size: 56 bytes, params: 2, frame: 10
if (env0_3.portal === nativeEvent.portal) {
if (onLoad != null) {
onLoad();
}
}
}
function createPortalControlsSeek(a0) { // fn#74552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1288, owner: createPortalControls.seek, offset: 0x01d9202f, size: 35 bytes, params: 2, frame: 13
MediaPlayerManager.changeProgress(env0_0, a0);
}
function createPortalControlsPause(a0) { // fn#74553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1345, owner: createPortalControls.pause, offset: 0x01d92052, size: 36 bytes, params: 2, frame: 13
MediaPlayerManager.toggle(env0_0, !a0);
}
function createPortalControlsUseSubscribe(a0, a1, a2) { // fn#74554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1397, owner: createPortalControls.useSubscribe, offset: 0x01d92076, size: 35 bytes, params: 4, frame: 17
useSubscribe_body(env0_0, a0, a1, a2);
}
function _fun74549() { // fn#74549, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:787, offset: 0x01d91f23, size: 163 bytes, params: 1, frame: 15
var defaultImport;
MediaPlayerManager.setLoopPlayback(env1_3.portal, false);
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
if (platformUtilsModule.isAndroid()) {
defaultImport = importDefault(9550) /* metro dependency 9550: NativePortalFromNativeModule */;
defaultImport.unregisterView(env1_3.portal);
} else {
DCDPortalViewManager.unregisterView(env1_3.portal);
}
const binding = env2_10;
binding.add(env1_3.portal);
}
function useSubscribe_body(a0, a1, a2, a3) { // fn#74555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1418, owner: createPortalControls.useSubscribe.body, offset: 0x01d92099, size: 79 bytes, params: 5, frame: 17
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const env0_3 = a3;
env2_3.useEffect(_fun74556, [a0, a2, a1, a3]);
}
function _fun74556() { // fn#74556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1462, offset: 0x01d920e8, size: 113 bytes, params: 1, frame: 15
const env0_0 = env3_9.addListener('MediaPlayerProgress', _fun74557);
const env0_1 = env3_9.addListener('MediaPlayerDownloadProgress', _fun74558);
const env0_2 = env3_9.addListener('MediaPlayerPause', _fun74559);
return _fun74560;
}
function _fun74557({id, time, duration}) { // fn#74557, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1510, offset: 0x01d92159, size: 58 bytes, params: 2, frame: 14
if (id === env1_0 && duration > 0) {
require(time, duration);
}
}
function _fun74558({id, progressPercent, totalDurationSeconds}) { // fn#74558, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1608, offset: 0x01d92193, size: 71 bytes, params: 2, frame: 13
if (id === env1_0 && totalDurationSeconds > 0 && importAll != null) {
importAll(progressPercent);
}
}
function _fun74559({id, paused}) { // fn#74559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1725, offset: 0x01d921da, size: 40 bytes, params: 2, frame: 12
if (id === env1_0) {
importDefault(paused);
}
}
function _fun74560() { // fn#74560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9734:1766, offset: 0x01d92202, size: 49 bytes, params: 1, frame: 10
env0_0.remove();
env0_1.remove();
env0_2.remove();
}