751 lines
37 KiB
TypeScript
751 lines
37 KiB
TypeScript
/* Metro module 13079; source: modules/media/native/MediaPlayerManager.tsx; dependencies: [6, 7, 15, 17, 18, 27, 1378, 7710, 1379, 4814, 3784, 7030, 661, 8044, 13080, 482, 3, 629, 690, 4008, 694, 477, 628, 7067, 10915, 4561, 2] */
|
|
function _fun99904(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99904, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:6, offset: 0x021d8da4, size: 554 bytes, params: 8, frame: 20
|
|
let env0_0 = require;
|
|
const closure = function(a0) {
|
|
if (a0.duration <= 0) {
|
|
return undefined;
|
|
}
|
|
return a0.duration - a0.time <= PLAYBACK_COMPLETION_DETECTION_TOLERANCE;
|
|
};
|
|
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.NativeEventEmitter;
|
|
const env0_9 = value.NativeModules;
|
|
const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */;
|
|
const voicePanelStore = importDefault(7710) /* metro dependency 7710: VoicePanelStore */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const messageStore = importDefault(4814) /* metro dependency 4814: MessageStore */;
|
|
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
|
|
const appStateStore = importDefault(7030) /* metro dependency 7030: AppStateStore */;
|
|
const env0_16 = (require(661) /* metro dependency 661: Constants */).AppStates;
|
|
const env0_17 = (require(8044) /* metro dependency 8044: ActivityPanelConstants */).ActivityPanelModes;
|
|
value = require(13080) /* metro dependency 13080: MediaPlaybackPanelConstants */;
|
|
const env0_18 = value.PLAYBACK_COMPLETION_DETECTION_TOLERANCE;
|
|
const env0_19 = value.PLAYBACK_PROGRESS_UPDATE_INTERVAL;
|
|
const env0_20 = (require(482) /* metro dependency 482: Constants */).Permissions;
|
|
value = importDefault(3) /* metro dependency 3: Logger */;
|
|
value = new value('MediaPlayerManager');
|
|
value = require(629) /* metro dependency 629 */;
|
|
value = value.create(function(a0) {
|
|
var env0_0 = a0;
|
|
return {'activeMediaPlayerSource': null, 'mediaSourceMessage': null, 'canAccessMedia': true, 'isPlaying': false,
|
|
'wasPipClosedByUser': false, 'progress': null, 'rate': 0, 'showPip': false,
|
|
activeMediaPlayerSource: undefined,
|
|
mediaSourceMessage: undefined, progress: undefined, closePip: _fun99910,
|
|
displayedMediaItemIdsPerChannel: {},
|
|
currentlyDisplayedChannelId: undefined};
|
|
});
|
|
const value6 = new _fun99912(importDefault(4561) /* metro dependency 4561: LifecycleManager */)();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/media/native/MediaPlayerManager.tsx');
|
|
exports.default = value6;
|
|
exports.useMediaPlayerManagerStore = value;
|
|
exports.isPlaybackComplete = closure;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_99905() { // fn#99905, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:430, offset: 0x021d8fce, 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_99905_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun99909(a0) { // fn#99909, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:684, offset: 0x021d905e, size: 69 bytes, params: 2, frame: 4
|
|
const env0_0 = a0;
|
|
return {'activeMediaPlayerSource': null, 'mediaSourceMessage': null, 'canAccessMedia': true, 'isPlaying': false,
|
|
'wasPipClosedByUser': false, 'progress': null, 'rate': 0, 'showPip': false, activeMediaPlayerSource: undefined,
|
|
mediaSourceMessage: undefined, progress: undefined, closePip: closePip, displayedMediaItemIdsPerChannel: {},
|
|
currentlyDisplayedChannelId: undefined};
|
|
}
|
|
|
|
function _fun99912(a0) { // fn#99912, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:1056, offset: 0x021d90eb, size: 478 bytes, params: 2, frame: 16
|
|
const closure = MediaPlayerManager;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{key: '_initialize', value: value_99914}, {key: 'updateMediaPermissions',
|
|
value: value_99916}, {key: '_terminate', value: value_99918}, {key: 'pauseCurrentPlayer', value: function() {
|
|
var MediaPlayerManager = NativeModules.MediaPlayerManager;
|
|
MediaPlayerManager.pauseCurrentPlayer();
|
|
}}, {key: 'playCurrentPlayer', value: function() {
|
|
var MediaPlayerManager = NativeModules.MediaPlayerManager;
|
|
MediaPlayerManager.playCurrentPlayer();
|
|
}}, {key: 'userDidClosePip', value: value_99922}, {key: 'pauseAndClosePip', value: value_99924},
|
|
{key: 'handleVoicePanelStateUpdated', value: value_99926}, {key: 'handleEmbeddedActivitiesUpdated',
|
|
value: function() {
|
|
if (EmbeddedActivitiesStore.getActivityPanelMode() === ActivityPanelModes.PIP) {
|
|
this.pauseAndClosePip();
|
|
}
|
|
}}, {key: 'handleMediaPlayerPlaybackRateChanged', value: value_99928},
|
|
{key: 'handleMediaPlayerPlaybackProgressUpdated', value: value_99930},
|
|
{key: 'handleMediaPlayerPlaybackSourceChanged', value: value_99932}, {key: 'getOrFetchMediaSourceMessage',
|
|
value: value_99934}, {key: 'handleMediaSourceMessageUpdated', value: value_99938},
|
|
{key: 'handleMediaPlayerViewWillAppear', value: value_99940}, {key: 'handleMediaPlayerViewDidDisappear',
|
|
value: value_99942}, {key: 'updateDisplayState', value: value_99945}]);
|
|
}
|
|
|
|
function closePip() { // fn#99910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:842, offset: 0x021d90a3, size: 47 bytes, params: 1, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99911);
|
|
}
|
|
|
|
function MediaPlayerManager() { // fn#99913, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:1068, offset: 0x021d92c9, size: 328 bytes, params: 1, frame: 19
|
|
let value = environment.__proto__;
|
|
env1_3(this, MediaPlayerManager);
|
|
const value3 = env1_6(MediaPlayerManager);
|
|
value = env1_5(this, _isNativeReflectConstruct_99905() ? global.Reflect.construct(value3, [],
|
|
env1_6(this).constructor) : value3.apply(this, undefined));
|
|
value.subscriptions = [];
|
|
value.voicePanelStoreUnsubscribe = undefined;
|
|
value.showPipUnsubscribe = undefined;
|
|
value.pauseAndClosePip = value.pauseAndClosePip.bind(value);
|
|
value.handleVoicePanelStateUpdated = value.handleVoicePanelStateUpdated.bind(value);
|
|
value.handleEmbeddedActivitiesUpdated = value.handleEmbeddedActivitiesUpdated.bind(value);
|
|
value.handleMediaPlayerPlaybackRateChanged = value.handleMediaPlayerPlaybackRateChanged.bind(value);
|
|
value.handleMediaPlayerPlaybackSourceChanged = value.handleMediaPlayerPlaybackSourceChanged.bind(value);
|
|
value.handleMediaPlayerViewWillAppear = value.handleMediaPlayerViewWillAppear.bind(value);
|
|
value.handleMediaPlayerViewDidDisappear = value.handleMediaPlayerViewDidDisappear.bind(value);
|
|
value.updateDisplayState = value.updateDisplayState.bind(value);
|
|
value.updateMediaPermissions = value.updateMediaPermissions.bind(value);
|
|
return value;
|
|
}
|
|
|
|
function value_99914() { // fn#99914, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:2092, offset: 0x021d9411, size: 484 bytes, params: 1, frame: 17
|
|
var binding;
|
|
let MediaPlayerManager = NativeModules.MediaPlayerManager;
|
|
const nativeEventEmitter = new NativeEventEmitter(MediaPlayerManager);
|
|
this.subscriptions = [nativeEventEmitter.addListener('MediaPlayerPlaybackSourceChanged',
|
|
this.handleMediaPlayerPlaybackSourceChanged),
|
|
nativeEventEmitter.addListener('MediaPlayerPlaybackProgressUpdated',
|
|
this.handleMediaPlayerPlaybackProgressUpdated), nativeEventEmitter.addListener('MediaPlayerPlaybackRateChanged',
|
|
this.handleMediaPlayerPlaybackRateChanged), nativeEventEmitter.addListener('MediaPlayerViewWillAppear',
|
|
this.handleMediaPlayerViewWillAppear), nativeEventEmitter.addListener('MediaPlayerViewDidDisappear',
|
|
this.handleMediaPlayerViewDidDisappear)];
|
|
MediaPlayerManager = NativeModules.MediaPlayerManager;
|
|
MediaPlayerManager.subscribeToPlaybackEvents();
|
|
const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef();
|
|
if (rootNavigationRef != null) {
|
|
rootNavigationRef.addListener('state', this.updateDisplayState);
|
|
}
|
|
let subscribe = VoicePanelStore.subscribe;
|
|
this.voicePanelStoreUnsubscribe = Reflect.apply(subscribe, VoicePanelStore, [this.handleVoicePanelStateUpdated]);
|
|
EmbeddedActivitiesStore.addChangeListener(this.handleEmbeddedActivitiesUpdated);
|
|
ChannelStore.addChangeListener(this.updateMediaPermissions);
|
|
PermissionStore.addChangeListener(this.updateMediaPermissions);
|
|
const defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
subscribe = defaultImport.subscribe;
|
|
const userDidClosePip = this.userDidClosePip;
|
|
Reflect.apply(subscribe, defaultImport, ['LOGOUT', userDidClosePip]);
|
|
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (platformUtilsModule.isIOS()) {
|
|
binding = env1_22;
|
|
this.showPipUnsubscribe = binding.subscribe(_fun99915);
|
|
}
|
|
env1_21.verbose('Initialized and subscribed to playback events');
|
|
}
|
|
|
|
function value_99916() { // fn#99916, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:3364, offset: 0x021d968b, size: 54 bytes, params: 1, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99917);
|
|
}
|
|
|
|
function value_99918() { // fn#99918, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:3677, offset: 0x021d9777, size: 248 bytes, params: 1, frame: 17
|
|
var environment;
|
|
this.subscriptions.forEach(function(a0) {
|
|
return a0.remove();
|
|
});
|
|
this.subscriptions = [];
|
|
let value = environment.__proto__;
|
|
const rootNavigationRef = (require(4008) /* metro dependency 4008: RootNavigationRefNative */).getRootNavigationRef();
|
|
if (rootNavigationRef != null) {
|
|
rootNavigationRef.removeListener('state', this.updateDisplayState);
|
|
}
|
|
const voicePanelStoreUnsubscribe = this.voicePanelStoreUnsubscribe;
|
|
if (voicePanelStoreUnsubscribe != null) {
|
|
voicePanelStoreUnsubscribe.call(this);
|
|
}
|
|
const showPipUnsubscribe = this.showPipUnsubscribe;
|
|
if (showPipUnsubscribe != null) {
|
|
showPipUnsubscribe.call(this);
|
|
}
|
|
EmbeddedActivitiesStore.removeChangeListener(this.handleEmbeddedActivitiesUpdated);
|
|
ChannelStore.removeChangeListener(this.updateMediaPermissions);
|
|
PermissionStore.removeChangeListener(this.updateMediaPermissions);
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
const unsubscribe = value.unsubscribe;
|
|
const userDidClosePip = this.userDidClosePip;
|
|
Reflect.apply(unsubscribe, value, ['LOGOUT', userDidClosePip]);
|
|
}
|
|
|
|
function value_99922() { // fn#99922, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:4381, offset: 0x021d98a5, size: 47 bytes, params: 1, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99923);
|
|
}
|
|
|
|
function value_99924() { // fn#99924, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:4500, offset: 0x021d98f6, size: 54 bytes, params: 1, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99925);
|
|
}
|
|
|
|
function value_99926() { // fn#99926, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:4659, offset: 0x021d9961, size: 67 bytes, params: 1, frame: 11
|
|
let value = environment.__proto__;
|
|
value = VoicePanelStore.getState();
|
|
if (value.isVoicePanelFullscreen() || value.voicePanelsPIP.size > 0) {
|
|
this.pauseAndClosePip();
|
|
}
|
|
}
|
|
|
|
function value_99928({source, rate}) { // fn#99928, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:4936, offset: 0x021d99d4, size: 76 bytes, params: 2, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99929);
|
|
}
|
|
|
|
function value_99930({source, time, duration}) { // fn#99930, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:5507, offset: 0x021d9b74, size: 78 bytes, params: 2, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99931);
|
|
}
|
|
|
|
function value_99932({source}) { // fn#99932, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:6010, offset: 0x021d9cf8, size: 66 bytes, params: 2, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99933);
|
|
}
|
|
|
|
function value_99934({channelId, messageId, assetUrl}) { // fn#99934, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:6503, offset: 0x021d9e4e, size: 190 bytes, params: 2, frame: 18
|
|
var environment;
|
|
if (messageId != null) {
|
|
if (channelId == null) {
|
|
return undefined;
|
|
}
|
|
var value = environment.__proto__;
|
|
var message = MessageStore.getMessage(channelId, messageId);
|
|
if (message != null) {
|
|
return message;
|
|
}
|
|
if (assetUrl == null) {
|
|
value = importDefault(7067) /* metro dependency 7067: MessageActionCreators */;
|
|
value = value.fetchMessage({channelId: channelId, messageId: messageId});
|
|
value.then(_fun99937);
|
|
return undefined;
|
|
}
|
|
var value5 = MessageStore.getMessages(channelId).toArray().find(function(a0) {
|
|
var value = a0.getContentMessage();
|
|
return value == null || value.attachments == null ? undefined : value.attachments.some(_fun99936);
|
|
});
|
|
if (value5 != null) {
|
|
return value5;
|
|
}
|
|
value = importDefault(7067) /* metro dependency 7067: MessageActionCreators */;
|
|
value = value.fetchMessage({channelId: channelId, messageId: messageId});
|
|
value.then(_fun99937);
|
|
}
|
|
}
|
|
|
|
function value_99938(a0) { // fn#99938, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:6962, offset: 0x021d9f7f, size: 54 bytes, params: 2, frame: 12
|
|
var environment;
|
|
const env0_0 = a0;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99939);
|
|
}
|
|
|
|
function value_99940({mediaItemIds, channelId}) { // fn#99940, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:7167, offset: 0x021da00a, size: 76 bytes, params: 2, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99941);
|
|
}
|
|
|
|
function value_99942({mediaItemIds, channelId}) { // fn#99942, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:7465, offset: 0x021da0ec, size: 76 bytes, params: 2, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99943);
|
|
}
|
|
|
|
function value_99945() { // fn#99945, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:7795, offset: 0x021da1fe, size: 47 bytes, params: 1, frame: 12
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
(require(690) /* metro dependency 690: ReactBatchUpdatesNative */).batchUpdates(_fun99946);
|
|
}
|
|
|
|
function _fun99911() { // fn#99911, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:870, offset: 0x021d90d2, size: 25 bytes, params: 1, frame: 11
|
|
return env1_0({showPip: false});
|
|
}
|
|
|
|
function _fun99915(a0, a1) { // fn#99915, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:3086, offset: 0x021d95f5, size: 150 bytes, params: 3, frame: 11
|
|
var r0;
|
|
var value;
|
|
if (a1.showPip) {
|
|
if (a0.showPip) {
|
|
value = a1.rate !== 0;
|
|
r0 = value && a0.rate === 0;
|
|
r0 = r0 && !a0.showPip;
|
|
if (r0) {
|
|
value = environment.__proto__.__proto__;
|
|
value = AppStateStore.getState() === AppStates.ACTIVE;
|
|
r0 = value;
|
|
}
|
|
if (r0) {
|
|
value = environment.__proto__.__proto__;
|
|
NativeModules.MediaPlayerManager.clearNowPlayingInfo();
|
|
}
|
|
} else {
|
|
value = environment.__proto__.__proto__;
|
|
NativeModules.MediaPlayerManager.clearNowPlayingInfo();
|
|
}
|
|
} else {
|
|
value = a1.rate !== 0;
|
|
r0 = value && a0.rate === 0;
|
|
r0 = r0 && !a0.showPip;
|
|
if (r0) {
|
|
value = environment.__proto__.__proto__;
|
|
value = AppStateStore.getState() === AppStates.ACTIVE;
|
|
r0 = value;
|
|
}
|
|
if (r0) {
|
|
value = environment.__proto__.__proto__;
|
|
NativeModules.MediaPlayerManager.clearNowPlayingInfo();
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun99917() { // fn#99917, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:3398, offset: 0x021d96c1, size: 182 bytes, params: 1, frame: 17
|
|
let binding = env2_22;
|
|
const getState = binding.getState;
|
|
const activeMediaPlayerSource = Reflect.apply(getState, binding, []).activeMediaPlayerSource;
|
|
const getChannel = ChannelStore.getChannel;
|
|
const value2 = null;
|
|
const value3 = undefined;
|
|
const channelId = value2 == activeMediaPlayerSource ? value3 : activeMediaPlayerSource.channelId;
|
|
const value4 = Reflect.apply(getChannel, ChannelStore, [value2 != channelId ? channelId : value2]);
|
|
if (value2 == value4) {
|
|
env2_22.setState({canAccessMedia: true});
|
|
} else if (value4.isPrivate()) {
|
|
env2_22.setState({canAccessMedia: true});
|
|
} else if (PermissionStore.can(Permissions.VIEW_CHANNEL, value4)) {
|
|
env2_22.setState({canAccessMedia: true});
|
|
} else {
|
|
binding = env2_22;
|
|
binding.setState({canAccessMedia: false});
|
|
binding = env0_0;
|
|
binding.pauseCurrentPlayer();
|
|
}
|
|
return value3;
|
|
}
|
|
|
|
function _fun99923() { // fn#99923, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:4415, offset: 0x021d98d4, size: 34 bytes, params: 1, frame: 11
|
|
return env2_22.setState({'wasPipClosedByUser': true, 'showPip': false});
|
|
}
|
|
|
|
function _fun99925() { // fn#99925, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:4534, offset: 0x021d992c, size: 53 bytes, params: 1, frame: 11
|
|
env0_0.pauseCurrentPlayer();
|
|
env2_22.setState({'wasPipClosedByUser': true, 'showPip': false});
|
|
}
|
|
|
|
function _fun99929() { // fn#99929, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:4987, offset: 0x021d9a20, size: 340 bytes, params: 1, frame: 21
|
|
var value2;
|
|
var setState;
|
|
if (source == null) {
|
|
value2 = environment.__proto__.__proto__;
|
|
env2_22.setState({'rate': 0, 'isPlaying': false});
|
|
}
|
|
let binding = env2_21;
|
|
const verbose = binding.verbose;
|
|
let rateBinding = rate;
|
|
sourceBinding = source;
|
|
const value4 = undefined;
|
|
Reflect.apply(verbose, binding,
|
|
['Playback rate changed to ' + rateBinding + ': ' + (sourceBinding == null ? value4 : source.id)]);
|
|
const state = env2_22.getState();
|
|
if ((importDefault(628) /* metro dependency 628: shallowEqual */)(state.activeMediaPlayerSource,
|
|
source ?? value4)) {
|
|
binding = env2_22;
|
|
setState = binding.setState;
|
|
rateBinding = rate;
|
|
Reflect.apply(setState, binding, [{rate: rateBinding, isPlaying: rateBinding !== 0,
|
|
wasPipClosedByUser: !(state.isPlaying === false && rate > 0) && state.wasPipClosedByUser}]);
|
|
binding = env0_0;
|
|
binding.updateDisplayState();
|
|
} else {
|
|
binding = env0_0;
|
|
var handleMediaPlayerPlaybackSourceChanged = binding.handleMediaPlayerPlaybackSourceChanged;
|
|
sourceBinding = source;
|
|
Reflect.apply(handleMediaPlayerPlaybackSourceChanged, binding, [{source: sourceBinding}]);
|
|
binding.handleMediaPlayerPlaybackRateChanged({source: sourceBinding, rate: rate});
|
|
}
|
|
return value4;
|
|
}
|
|
|
|
function _fun99931() { // fn#99931, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:5569, offset: 0x021d9bc2, size: 310 bytes, params: 1, frame: 19
|
|
var r4;
|
|
var r2;
|
|
var currentlyDisplayedChannelId;
|
|
var durationBinding;
|
|
var object2;
|
|
var timeBinding;
|
|
var isPlaybackComplete2;
|
|
var progress;
|
|
let binding = env2_22;
|
|
const state = binding.getState();
|
|
const value3 = undefined;
|
|
if ((importDefault(628) /* metro dependency 628: shallowEqual */)(state.activeMediaPlayerSource,
|
|
source ?? value3)) {
|
|
currentlyDisplayedChannelId = state.currentlyDisplayedChannelId;
|
|
if (state.showPip) {
|
|
durationBinding = duration;
|
|
if (durationBinding > 0) {
|
|
object2 = {};
|
|
timeBinding = time;
|
|
object2.time = timeBinding;
|
|
durationBinding = duration;
|
|
object2.duration = durationBinding;
|
|
isPlaybackComplete2 = isPlaybackComplete({time: timeBinding, duration: durationBinding});
|
|
object2.isCompleted = isPlaybackComplete2 != null && isPlaybackComplete2;
|
|
r4 = object2;
|
|
} else {
|
|
r4 = value3;
|
|
}
|
|
progress = state.progress;
|
|
r2 = progress != null && r4 != null;
|
|
r2 = r2 && global.Math.abs(r4.time - progress.time) < PLAYBACK_PROGRESS_UPDATE_INTERVAL;
|
|
r2 = r2 && r4.time !== r4.duration;
|
|
if (!r2) {
|
|
binding = env2_22;
|
|
binding.setState({progress: r4});
|
|
}
|
|
} else if (currentlyDisplayedChannelId != null) {
|
|
if (currentlyDisplayedChannelId === (source == null ? value3 : source.channelId)) {
|
|
durationBinding = duration;
|
|
if (durationBinding > 0) {
|
|
object2 = {};
|
|
timeBinding = time;
|
|
object2.time = timeBinding;
|
|
durationBinding = duration;
|
|
object2.duration = durationBinding;
|
|
isPlaybackComplete2 = isPlaybackComplete({time: timeBinding, duration: durationBinding});
|
|
object2.isCompleted = isPlaybackComplete2 != null && isPlaybackComplete2;
|
|
r4 = object2;
|
|
} else {
|
|
r4 = value3;
|
|
}
|
|
progress = state.progress;
|
|
r2 = progress != null && r4 != null;
|
|
r2 = r2 && global.Math.abs(r4.time - progress.time) < PLAYBACK_PROGRESS_UPDATE_INTERVAL;
|
|
r2 = r2 && r4.time !== r4.duration;
|
|
if (!r2) {
|
|
binding = env2_22;
|
|
binding.setState({progress: r4});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return value3;
|
|
}
|
|
|
|
function _fun99933() { // fn#99933, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:6054, offset: 0x021d9d3a, size: 276 bytes, params: 1, frame: 19
|
|
const value = environment.__proto__.__proto__;
|
|
let binding = env2_22;
|
|
const state = binding.getState();
|
|
binding = env2_21;
|
|
const verbose = binding.verbose;
|
|
const sourceBinding = source;
|
|
const value4 = undefined;
|
|
Reflect.apply(verbose, binding, ['Playback source changed: ' + (sourceBinding == null ? value4 : source.id)]);
|
|
if (!(importDefault(628) /* metro dependency 628: shallowEqual */)(state.activeMediaPlayerSource ?? value4,
|
|
source ?? value4)) {
|
|
binding = env2_22;
|
|
binding.setState({'activeMediaPlayerSource': null, 'mediaSourceMessage': null, 'progress': null, 'rate': 0,
|
|
'isPlaying': false, 'wasPipClosedByUser': false, activeMediaPlayerSource: source ?? value4,
|
|
mediaSourceMessage: source != null ? env0_0.getOrFetchMediaSourceMessage(source) : value4,
|
|
progress: value4});
|
|
binding = env0_0;
|
|
binding.updateMediaPermissions();
|
|
binding.updateDisplayState();
|
|
}
|
|
return value4;
|
|
}
|
|
|
|
function _fun99935(a0) { // fn#99935, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:6676, offset: 0x021d9f0c, size: 61 bytes, params: 2, frame: 13
|
|
const contentMessage = a0.getContentMessage();
|
|
return contentMessage == null || contentMessage.attachments == null ? undefined : contentMessage.attachments.some(function({url}) {
|
|
return url === assetUrl;
|
|
});
|
|
}
|
|
|
|
function _fun99937(a0) { // fn#99937, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:6858, offset: 0x021d9f5e, size: 33 bytes, params: 2, frame: 11
|
|
if (a0 != null) {
|
|
env0_0.handleMediaSourceMessageUpdated(a0);
|
|
}
|
|
}
|
|
|
|
function _fun99939() { // fn#99939, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:6997, offset: 0x021d9fb5, size: 85 bytes, params: 1, frame: 13
|
|
let binding = env2_22;
|
|
const getState = binding.getState;
|
|
const activeMediaPlayerSource = Reflect.apply(getState, binding, []).activeMediaPlayerSource;
|
|
const value2 = undefined;
|
|
if ((activeMediaPlayerSource == null ? value2 : activeMediaPlayerSource.messageId) === env0_0.id) {
|
|
binding = env2_22;
|
|
binding.setState({mediaSourceMessage: env0_0});
|
|
}
|
|
return value2;
|
|
}
|
|
|
|
function _fun99941() { // fn#99941, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:7229, offset: 0x021da056, size: 150 bytes, params: 1, frame: 17
|
|
let binding = env2_22;
|
|
const getState = binding.getState;
|
|
const displayedMediaItemIdsPerChannel = Reflect.apply(getState, binding, []).displayedMediaItemIdsPerChannel;
|
|
const r6 = displayedMediaItemIdsPerChannel[channelId] ?? [];
|
|
const Set = global.Set;
|
|
const items = [];
|
|
arraySpread(items, mediaItemIds, arraySpread(items, r6, 0, r6), r6);
|
|
const value4 = Object.create(Set.prototype, {constructor: {value: Set}});
|
|
const set = new Set(items);
|
|
displayedMediaItemIdsPerChannel[channelId] = set instanceof Object ? set : value4;
|
|
binding = env2_22;
|
|
binding.setState({displayedMediaItemIdsPerChannel: displayedMediaItemIdsPerChannel});
|
|
env0_0.updateDisplayState();
|
|
}
|
|
|
|
function _fun99943() { // fn#99943, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:7527, offset: 0x021da138, size: 198 bytes, params: 1, frame: 18
|
|
var r2;
|
|
var set;
|
|
let binding = env2_22;
|
|
const getState = binding.getState;
|
|
const displayedMediaItemIdsPerChannel = Reflect.apply(getState, binding, []).displayedMediaItemIdsPerChannel;
|
|
const Set = global.Set;
|
|
const property = displayedMediaItemIdsPerChannel[channelId];
|
|
if (property != null) {
|
|
r2 = property;
|
|
} else {
|
|
set = new global.Set();
|
|
}
|
|
const items = [];
|
|
arraySpread(items, r2, 0, items);
|
|
set = new Set(items.filter(function(a0) {
|
|
return !mediaItemIds.includes(a0);
|
|
}));
|
|
if (set.size === 0) {
|
|
delete displayedMediaItemIdsPerChannel[channelId];
|
|
} else {
|
|
displayedMediaItemIdsPerChannel[channelId] = set;
|
|
}
|
|
binding = env2_22;
|
|
binding.setState({displayedMediaItemIdsPerChannel: displayedMediaItemIdsPerChannel});
|
|
env0_0.updateDisplayState();
|
|
}
|
|
|
|
function _fun99946() { // fn#99946, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13269:7829, offset: 0x021da22d, size: 384 bytes, params: 1, frame: 22
|
|
var r4;
|
|
var r2;
|
|
var r7;
|
|
var r8;
|
|
var value3;
|
|
var value4;
|
|
var moduleValue;
|
|
var getFocusedChannelId;
|
|
var value5;
|
|
var properties;
|
|
var properties2;
|
|
var properties3;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var setState;
|
|
var property;
|
|
var has;
|
|
let value = environment.__proto__.__proto__;
|
|
let binding = env2_22;
|
|
const state = binding.getState();
|
|
const displayedMediaItemIdsPerChannel = state.displayedMediaItemIdsPerChannel;
|
|
const currentlyDisplayedChannelId = state.currentlyDisplayedChannelId;
|
|
const activeMediaPlayerSource = state.activeMediaPlayerSource;
|
|
reducibleJoin2: while (true) {
|
|
if (activeMediaPlayerSource !== undefined) {
|
|
r4 = activeMediaPlayerSource;
|
|
break reducibleJoin2;
|
|
}
|
|
r4 = {};
|
|
break reducibleJoin2;
|
|
}
|
|
const id = r4.id;
|
|
const wasPipClosedByUser = state.wasPipClosedByUser;
|
|
const progress = state.progress;
|
|
const isPlaying = state.isPlaying;
|
|
if (wasPipClosedByUser) {
|
|
env2_22.setState({showPip: false});
|
|
} else {
|
|
reducibleJoin25: while (true) {
|
|
reducibleJoin15: while (true) {
|
|
if (isPlaying) {
|
|
reducibleJoin9: while (true) {
|
|
if (isPlaying) {
|
|
r7 = isPlaying;
|
|
break reducibleJoin9;
|
|
}
|
|
value3 = progress != null;
|
|
reducibleJoin8: while (true) {
|
|
if (value3) {
|
|
value4 = !isPlaybackComplete(progress);
|
|
r2 = value4;
|
|
break reducibleJoin8;
|
|
}
|
|
r2 = value3;
|
|
break reducibleJoin8;
|
|
}
|
|
r7 = r2;
|
|
break reducibleJoin9;
|
|
}
|
|
moduleValue = require(10915) /* metro dependency 10915: isChannelFocusedNative */;
|
|
getFocusedChannelId = moduleValue.getFocusedChannelId;
|
|
value5 = Reflect.apply(getFocusedChannelId, moduleValue, []);
|
|
if (value5 == null) {
|
|
break reducibleJoin15;
|
|
}
|
|
if (currentlyDisplayedChannelId === value5) {
|
|
break reducibleJoin15;
|
|
}
|
|
properties = Object.keys(displayedMediaItemIdsPerChannel);
|
|
properties2 = 0;
|
|
properties3 = properties.length;
|
|
if (properties === undefined) {
|
|
break reducibleJoin15;
|
|
}
|
|
r8 = properties2;
|
|
reducibleLoop12: while (true) {
|
|
propertyName = properties[r8];
|
|
propertyName2 = r8 + 1;
|
|
if (propertyName === undefined) {
|
|
break reducibleJoin15;
|
|
}
|
|
if (propertyName === value5) {
|
|
r8 = propertyName2;
|
|
continue reducibleLoop12;
|
|
}
|
|
delete displayedMediaItemIdsPerChannel[propertyName];
|
|
r8 = propertyName2;
|
|
continue reducibleLoop12;
|
|
}
|
|
} else {
|
|
if (!state.showPip) {
|
|
break reducibleJoin25;
|
|
}
|
|
reducibleJoin9: while (true) {
|
|
if (isPlaying) {
|
|
r7 = isPlaying;
|
|
break reducibleJoin9;
|
|
}
|
|
value3 = progress != null;
|
|
reducibleJoin8: while (true) {
|
|
if (value3) {
|
|
value4 = !isPlaybackComplete(progress);
|
|
r2 = value4;
|
|
break reducibleJoin8;
|
|
}
|
|
r2 = value3;
|
|
break reducibleJoin8;
|
|
}
|
|
r7 = r2;
|
|
break reducibleJoin9;
|
|
}
|
|
moduleValue = require(10915) /* metro dependency 10915: isChannelFocusedNative */;
|
|
getFocusedChannelId = moduleValue.getFocusedChannelId;
|
|
value5 = Reflect.apply(getFocusedChannelId, moduleValue, []);
|
|
if (value5 == null) {
|
|
break reducibleJoin15;
|
|
}
|
|
if (currentlyDisplayedChannelId === value5) {
|
|
break reducibleJoin15;
|
|
}
|
|
properties = Object.keys(displayedMediaItemIdsPerChannel);
|
|
properties2 = 0;
|
|
properties3 = properties.length;
|
|
if (properties === undefined) {
|
|
break reducibleJoin15;
|
|
}
|
|
r8 = properties2;
|
|
reducibleLoop12: while (true) {
|
|
propertyName = properties[r8];
|
|
propertyName2 = r8 + 1;
|
|
if (propertyName === undefined) {
|
|
break reducibleJoin15;
|
|
}
|
|
if (propertyName === value5) {
|
|
r8 = propertyName2;
|
|
continue reducibleLoop12;
|
|
}
|
|
delete displayedMediaItemIdsPerChannel[propertyName];
|
|
r8 = propertyName2;
|
|
continue reducibleLoop12;
|
|
}
|
|
}
|
|
}
|
|
if (id != null) {
|
|
if (value5 != null) {
|
|
property = displayedMediaItemIdsPerChannel[value5];
|
|
if (property != null) {
|
|
binding = env2_22;
|
|
setState = binding.setState;
|
|
reducibleJoin23: while (true) {
|
|
if (r7) {
|
|
has = property.has;
|
|
value = !Reflect.apply(has, property, [id]);
|
|
r7 = value;
|
|
break reducibleJoin23;
|
|
}
|
|
break reducibleJoin23;
|
|
}
|
|
Reflect.apply(setState, binding, [{showPip: r7, currentlyDisplayedChannelId: value5,
|
|
displayedMediaItemIdsPerChannel: displayedMediaItemIdsPerChannel}]);
|
|
break reducibleJoin25;
|
|
}
|
|
binding = env2_22;
|
|
setState = binding.setState;
|
|
Reflect.apply(setState, binding, [{showPip: r7, currentlyDisplayedChannelId: value5,
|
|
displayedMediaItemIdsPerChannel: displayedMediaItemIdsPerChannel}]);
|
|
break reducibleJoin25;
|
|
}
|
|
binding = env2_22;
|
|
setState = binding.setState;
|
|
Reflect.apply(setState, binding, [{showPip: r7, currentlyDisplayedChannelId: value5,
|
|
displayedMediaItemIdsPerChannel: displayedMediaItemIdsPerChannel}]);
|
|
break reducibleJoin25;
|
|
}
|
|
binding = env2_22;
|
|
setState = binding.setState;
|
|
Reflect.apply(setState, binding, [{showPip: r7, currentlyDisplayedChannelId: value5,
|
|
displayedMediaItemIdsPerChannel: displayedMediaItemIdsPerChannel}]);
|
|
break reducibleJoin25;
|
|
}
|
|
}
|
|
}
|
|
|