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

112 lines
6.8 KiB
TypeScript

/* Metro module 9571; source: modules/content_inventory/matchUtils.tsx; dependencies: [661, 8847, 6868, 9572, 9574, 8846, 8375, 2] */
import IsCrunchyrollActivity from '../activities/utils/isCrunchyrollActivity.tsx'; /* Metro dependency 8846 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as SpotifyConstantsModule from '../spotify/SpotifyConstants.tsx'; /* Metro dependency 6868 */
import * as UtilsModule from './utils.tsx'; /* Metro dependency 8375 */
import * as CrunchyrollConnectionConstantsModule from '../connections/CrunchyrollConnectionConstants.tsx'; /* Metro dependency 8847 */
import * as ContentInventoryTypesModule from './ContentInventoryTypes.tsx'; /* Metro dependency 9572 */
import * as ContentInventoryListenedMediaProviderModule from '../../external/discord_common/js/shared/shared-constants/ContentInventoryListenedMediaProvider.tsx'; /* Metro dependency 9574 */
function _fun74889(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#74889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9757:6, offset: 0x01d9d22e, size: 257 bytes, params: 8, frame: 23
const env0_0 = require;
const isSpotifyEntry2 = isSpotifyEntry;
const isCrunchyrollEntry2 = isCrunchyrollEntry;
const closure3 = function({extra}, a1) {
var r1;
var r0;
var value = extra != null;
if (value) {
r1 = 'application_id' in a1 && a1.application_id === extra.application_id;
r1 = !r1 ? 'game_name' in extra ? a1.name === extra.game_name : 'activity_name' in extra && a1.name === extra.activity_name : r1;
r0 = r1;
} else {
r0 = value;
}
return r0;
};
const isMatchingListeningActivity2 = isMatchingListeningActivity;
const isMatchingWatchActivity2 = isMatchingWatchActivity;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/content_inventory/matchUtils.tsx');
exports.isSpotifyEntry = isSpotifyEntry2;
exports.isCrunchyrollEntry = isCrunchyrollEntry2;
exports.isMatchingApplicationActivity = closure3;
exports.isMatchingListeningActivity = isMatchingListeningActivity2;
exports.isMatchingWatchActivity = isMatchingWatchActivity2;
exports.findMatchingEntry = findMatchingEntry;
function isSpotifyEntry(a0) { // fn#74890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9757:177, offset: 0x01d9d32f, size: 223 bytes, params: 2, frame: 16
var r0;
var isTopArtistEntry2;
const ContentInventoryListenedMediaProvider = (ContentInventoryListenedMediaProviderModule).ContentInventoryListenedMediaProvider;
var property;
const value2 = undefined;
if (ContentInventoryTypesModule.isListenedSessionEntry(a0)) {
property = a0.extra.entries[0];
r0 = (property == null || property.media == null ? value2 : property.media.provider) === ContentInventoryListenedMediaProvider.SPOTIFY;
} else {
isTopArtistEntry2 = ContentInventoryTypesModule.isTopArtistEntry(a0);
r0 = isTopArtistEntry2 ? a0.extra.media.provider === ContentInventoryListenedMediaProvider.SPOTIFY : !!isTopArtistEntry2;
}
return r0;
}
function isCrunchyrollEntry(a0) { // fn#74891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9757:485, offset: 0x01d9d40e, size: 70 bytes, params: 2, frame: 13
const isWatchedMediaEntry2 = (ContentInventoryTypesModule).isWatchedMediaEntry(a0);
return isWatchedMediaEntry2 ? a0.extra.application_id === CRUNCHYROLL_CLIENT_ID : !!isWatchedMediaEntry2;
}
function isMatchingListeningActivity(a0, a1) { // fn#74893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9757:803, offset: 0x01d9d4c5, size: 62 bytes, params: 3, frame: 14
const isSpotifyEntryBinding = isSpotifyEntry;
const value2 = undefined;
const isSpotifyEntry2 = isSpotifyEntryBinding(a0);
return isSpotifyEntry2 ? isSpotifyParty(a1.party == null ? value2 : a1.party.id) : !!isSpotifyEntry2;
}
function isMatchingWatchActivity(a0, a1) { // fn#74894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9757:911, offset: 0x01d9d503, size: 84 bytes, params: 3, frame: 14
const value2 = (IsCrunchyrollActivity)(a1);
return !(value2 ? !isCrunchyrollEntry(a0) : !value2) && a0.extra.media_title === a1.details;
}
function findMatchingEntry(a0, a1) { // fn#74895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9757:1363, offset: 0x01d9d557, size: 283 bytes, params: 3, frame: 18
var r0;
const env0_0 = a1;
var value;
const value2 = undefined;
const value3 = a0.filter((UtilsModule).isEntryActive);
const type = a1.type;
const PLAYING = ActivityTypes.PLAYING;
if (type === PLAYING) {
value = value3.filter((require(9572) /* metro dependency 9572: ContentInventoryTypes */).isGamingLikeEntry);
value = value.find(function(a0) {
return isMatchingApplicationActivity(a0, require);
});
r0 = value;
} else if (a1.type === ActivityTypes.LISTENING) {
value = value3.filter((require(9572) /* metro dependency 9572: ContentInventoryTypes */).isListenedSessionEntry);
value = value.find(_fun74897);
r0 = value;
} else if (a1.type !== ActivityTypes.WATCHING) {
r0 = value2;
} else {
value = a0.filter((require(9572) /* metro dependency 9572: ContentInventoryTypes */).isWatchedMediaEntry);
value = value.find(_fun74898);
r0 = value;
}
return r0;
function _fun74897(a0) { // fn#74897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9757:1609, offset: 0x01d9d672, size: 27 bytes, params: 2, frame: 13
return isMatchingListeningActivity(a0, require);
}
function _fun74898(a0) { // fn#74898, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9757:1711, offset: 0x01d9d68d, size: 27 bytes, params: 2, frame: 13
return isMatchingWatchActivity(a0, require);
}
}
}
global.__d(_fun74889, 9571, [661, 8847, 6868, 9572, 9574, 8846, 8375,
2]) /* metro module 9571, dependencies: [661, 8847, 6868, 9572, 9574, 8846, 8375, 2] */;