Files
discord-decomp/sources/modules/media_panel/native/MediaPlaybackPanelController.tsx
T
2026-07-28 01:06:53 +03:00

153 lines
10 KiB
TypeScript

/* Metro module 15568; source: modules/media_panel/native/MediaPlaybackPanelController.tsx; dependencies: [57, 31, 4502, 1378, 7710, 13080, 8044, 11796, 33, 4017, 1585, 15363, 13079, 566, 15569, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import EmbeddedActivitiesStore from '../../activities/EmbeddedActivitiesStore.tsx'; /* Metro dependency 1378 */
import AccessibilityStore from '../../a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */
import VoicePanelStore from '../../voice_panel/VoicePanelStore.tsx'; /* Metro dependency 7710 */
import MediaPlaybackPanelStateContext from './MediaPlaybackPanelStateContext.tsx'; /* Metro dependency 15569 */
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 ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import * as ActivityPanelConstantsModule from '../../activities/panel/ActivityPanelConstants.tsx'; /* Metro dependency 8044 */
import * as MorphablePanelConstantsModule from '../../panels/morphable/native/MorphablePanelConstants.tsx'; /* Metro dependency 11796 */
import * as MediaPlaybackPanelConstantsModule from './MediaPlaybackPanelConstants.tsx'; /* Metro dependency 13080 */
function _fun119231(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#119231, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:6, offset: 0x0250221e, size: 288 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {code: 'function MediaPlaybackPanelControllerTsx1(){const{mode,MediaPlaybackPanelModes,MorphablePanelModes}=this.__closure;switch(mode.get()){case MediaPlaybackPanelModes.PIP:{return MorphablePanelModes.PIP;}default:{return MorphablePanelModes.UNDEFINED;}}}'};
(FileImportTrackerModule).fileFinishedImporting('modules/media_panel/native/MediaPlaybackPanelController.tsx');
exports.default = MediaPlaybackPanelController;
function MediaPlaybackPanelController({children}) { // fn#119232, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:618, offset: 0x0250233e, size: 410 bytes, params: 2, frame: 24
const value = useCoreState();
const mode = value.mode;
const env0_1 = value.morphablePanelMode;
const env0_2 = value.wrapperDimensions;
const useReducedMotion = value.useReducedMotion;
const pipState = value.pipState;
const env0_5 = value.pipAvoidanceSpecs;
const env0_6 = value.scrollPosition;
const canShowPIP = value.canShowPIP;
const env0_8 = value.lockScrolling;
const env0_9 = value.wrapperOffset;
const binding = pipState;
const env0_10 = binding.useRef(undefined);
let useState = binding.useState;
const get = mode.get;
const value2 = Reflect.apply(useState, binding, [Reflect.apply(get, mode, [])]);
const binding2 = useReducedMotion;
const value3 = binding2(value2, 2);
let property = value3[0];
const env0_13 = binding.useCallback(_fun119238, [property, value3[1]]);
binding.useLayoutEffect(_fun119241, [canShowPIP, VoicePanelStore(function(a0) {
return a0.voicePanelsPIP.size > 0;
}), (require(566) /* metro dependency 566: flux */).useStateFromStores([EmbeddedActivitiesStore], function() {
return EmbeddedActivitiesStore.getActivityPanelMode() === ActivityPanelModes.PIP;
})]);
useState = binding.useState;
property = binding2(Reflect.apply(useState, binding, [_fun119242]), 1)[0];
const Provider = (MediaPlaybackPanelStateContext).Provider;
return (
<Provider value={property}>
{children}
</Provider>
);
function useCoreState() { // fn#119233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:676, owner: MediaPlaybackPanelController.useCoreState, offset: 0x025024d8, size: 445 bytes, params: 1, frame: 26
var environment;
let value = environment.__proto__;
let useSharedValue = ReanimatedRexportModule.useSharedValue;
const PIP = MediaPlaybackPanelModes.PIP;
const value2 = Reflect.apply(useSharedValue, ReanimatedRexportModule, [PIP]);
const value3 = ReanimatedRexportModule.useSharedValue({'height': 0, 'width': 0});
const value4 = ReanimatedRexportModule.useSharedValue({'x': -1, 'y': -1});
useSharedValue = ReanimatedRexportModule.useSharedValue;
const useReducedMotion = AccessibilityStore.useReducedMotion;
const value5 = Reflect.apply(useSharedValue, ReanimatedRexportModule, [useReducedMotion]);
env1_4.useEffect(function() {
var closure = _fun119235;
var env0_0 = closure;
AccessibilityStore.addReactChangeListener(closure);
return _fun119236;
}, [value5]);
const value6 = ReanimatedRexportModule.useSharedValue(true);
const value7 = ReanimatedRexportModule.useSharedValue(0);
const useDerivedValue = ReanimatedRexportModule.useDerivedValue;
const useCoreStateP2 = useCoreStateP;
useCoreStateP2.__closure = {mode: value2, MediaPlaybackPanelModes: MediaPlaybackPanelModes,
MorphablePanelModes: MorphablePanelModes};
useCoreStateP2.__workletHash = 10375114450450;
useCoreStateP2.__initData = env1_12;
const value8 = Reflect.apply(useDerivedValue, ReanimatedRexportModule, [useCoreStateP2]);
value = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)();
value = (importDefault(15363) /* metro dependency 15363: usePIPAvoidanceSpecs */)(value);
return {mode: value2, morphablePanelMode: value8, wrapperDimensions: value3, useReducedMotion: value5,
pipState: value4, pipAvoidanceSpecs: value, scrollPosition: value7, canShowPIP: value6,
lockScrolling: ReanimatedRexportModule.useSharedValue(false),
wrapperOffset: ReanimatedRexportModule.useSharedValue({'x': 0, 'y': 0, 'gestureActive': false})};
function _fun119234() { // fn#119234, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:877, offset: 0x02502695, size: 40 bytes, params: 1, frame: 12
AccessibilityStore.addReactChangeListener(onChange_119235);
return function() {
AccessibilityStore.removeReactChangeListener(onChange_119235);
};
function onChange_119235() { // fn#119235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:882, offset: 0x025026bd, size: 51 bytes, params: 1, frame: 12
const useReducedMotion = AccessibilityStore.useReducedMotion;
const binding = env1_1;
const get = binding.get;
if (useReducedMotion !== Reflect.apply(get, binding, [])) {
env1_1.set(useReducedMotion);
}
}
function _fun119236() { // fn#119236, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:991, offset: 0x025026f0, size: 29 bytes, params: 1, frame: 11
const accessibilityStoreBinding = AccessibilityStore;
accessibilityStoreBinding.removeReactChangeListener(onChange_119235);
}
}
function useCoreStateP() { // fn#119237, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:1135, owner: MediaPlaybackPanelController.useCoreState.p, offset: 0x0250270d, size: 57 bytes, params: 1, frame: 10
const value = env0_0.get();
const PIP = MediaPlaybackPanelModes.PIP;
return value === PIP ? MorphablePanelModes.PIP : MorphablePanelModes.UNDEFINED;
}
}
function _fun119238() { // fn#119238, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:1846, offset: 0x02502746, size: 82 bytes, params: 1, frame: 13
var r0;
var value;
const PIP = MediaPlaybackPanelModes.PIP;
const value3 = JsxRuntimeModule.jsx === PIP;
if (value3) {
env0_12(MediaPlaybackPanelModes.DISMISSED);
value = importDefault(13079) /* metro dependency 13079: MediaPlayerManager */;
value.userDidClosePip();
value = true;
r0 = value;
} else {
r0 = value3;
}
return r0;
}
function _fun119241() { // fn#119241, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:2043, offset: 0x025027cf, size: 38 bytes, params: 1, frame: 13
const canShowPIPBinding = canShowPIP;
canShowPIPBinding.set(!env0_14 && !env0_15);
}
function _fun119242() { // fn#119242, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15765:2091, offset: 0x025027f5, size: 123 bytes, params: 1, frame: 3
return {mode: mode, setMode: env0_12, morphablePanelMode: morphablePanelMode, wrapperDimensions: wrapperDimensions,
useReducedMotion: useReducedMotion, pipState: pipState, pipAvoidanceSpecs: pipAvoidanceSpecs,
dismissToPipGestureRef: env0_10, dismissPanel: env0_13, scrollPosition: scrollPosition, canShowPIP: canShowPIP,
lockScrolling: lockScrolling, wrapperOffset: wrapperOffset};
}
}
}
global.__d(_fun119231, 15568, [57, 31, 4502, 1378, 7710, 13080, 8044, 11796, 33, 4017, 1585, 15363, 13079, 566,
15569,
2]) /* metro module 15568, dependencies: [57, 31, 4502, 1378, 7710, 13080, 8044, 11796, 33, 4017, 1585, 15363, 13079, 566, 15569, 2] */;