Files
discord-decomp/sources/modules/notification_center/getNotificationCenterItemBody.tsx
T
2026-07-27 16:20:00 +03:00

189 lines
9.9 KiB
TypeScript

/* Metro module 14787; source: modules/notification_center/getNotificationCenterItemBody.tsx; dependencies: [4117, 1867, 3793, 1878, 661, 1244, 3995, 4624, 1861, 44, 2] */
function _fun111695(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#111695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14984:6, offset: 0x023acf2c, size: 257 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const guildScheduledEventStore = importDefault(4117) /* metro dependency 4117: GuildScheduledEventStore */;
const env0_4 = (require(4117) /* metro dependency 4117: GuildScheduledEventStore */).isGuildEventEnded;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_8 = constantsModule.EMPTY_STRING_SNOWFLAKE_ID;
const env0_9 = constantsModule.RelationshipTypes;
const env0_10 = RegExp('[\\\\`*_~|<>[\\]:]', 'g');
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/notification_center/getNotificationCenterItemBody.tsx');
exports.default = getNotificationCenterItemBody;
}
function escapeMarkdown(a0) { // fn#111696, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14984:247, offset: 0x023ad02d, size: 37 bytes, params: 2, frame: 13
if (a0 !== undefined) {
return a0.replace(env0_10, '\\$&');
}
}
function getFriendRequestItemBody({username, applicationId, renderApplication, withApplication, withDefault}) { // fn#111697, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14984:315, offset: 0x023ad052, size: 160 bytes, params: 2, frame: 17
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
return applicationId != null ? intl.format(withApplication, {username: username, applicationName: function() {
return renderApplication(applicationId);
}}) : intl.format(withDefault, {username: username});
}
function getNotificationCenterItemBody({item, renderApplication}) { // fn#111699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14984:649, offset: 0x023ad0f2, size: 1960 bytes, params: 2, frame: 25
var r3;
var r6;
var name;
var name2;
var length;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var format;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var object2;
var guild_scheduled_event_id;
var value9;
var isGuildEventEndedBinding;
var isGuildEventEnded2;
var moduleValue;
var moduleValue2;
var AyvfXR;
var local_id;
var defaultImport4;
var other_users;
var value11;
var defaultImport5;
var value12;
var Math;
var max;
var value13;
let value = undefined;
let other_user = item.other_user;
let id = other_user == null ? value : other_user.id;
const r5 = id ?? EMPTY_STRING_SNOWFLAKE_ID;
let escapeMarkdownBinding = escapeMarkdown;
const defaultImport = importDefault(3995) /* metro dependency 3995: UserUtils */;
let getName = defaultImport.getName;
let getUser = UserStore.getUser;
other_user = item.other_user;
const value5 = escapeMarkdownBinding(Reflect.apply(getName, defaultImport, [Reflect.apply(getUser, UserStore,
[other_user == null ? value : other_user.id])]));
const applicationId = item.applicationId;
const type = item.type;
const NotificationCenterLocalItems = (require(4624) /* metro dependency 4624: NotificationCenterItemsTypes */).NotificationCenterLocalItems;
const FRIEND_REQUESTS_GROUPED = NotificationCenterLocalItems.FRIEND_REQUESTS_GROUPED;
if (FRIEND_REQUESTS_GROUPED === type) {
escapeMarkdownBinding = escapeMarkdown;
defaultImport4 = defaultImport;
getName = defaultImport4.getName;
getUser = UserStore.getUser;
other_users = item.other_users;
id = other_users == null || other_users[0] == null ? value : other_users[0].id;
value11 = escapeMarkdownBinding(Reflect.apply(getName, defaultImport4, [Reflect.apply(getUser, UserStore,
[id])]));
escapeMarkdownBinding = escapeMarkdown;
defaultImport5 = importDefault(3995) /* metro dependency 3995: UserUtils */;
getName = defaultImport5.getName;
getUser = UserStore.getUser;
other_users = item.other_users;
id = other_users == null || other_users[1] == null ? value : other_users[1].id;
value12 = escapeMarkdownBinding(Reflect.apply(getName, defaultImport5, [Reflect.apply(getUser, UserStore,
[id])]));
Math = global.Math;
max = Math.max;
other_users = item.other_users;
length = other_users == null ? value : other_users.length;
value13 = 0;
return intl.format(t.g5xyIC, {user: value11, user2: value12, count: Reflect.apply(max, Math,
[(length ?? value13) - 2, value13])});
}
const MOBILE_NATIVE_UPDATE_AVAILABLE = NotificationCenterLocalItems.MOBILE_NATIVE_UPDATE_AVAILABLE;
if (MOBILE_NATIVE_UPDATE_AVAILABLE === type) {
local_id = item.local_id;
if (local_id == null) {
r3 = value;
} else {
value = local_id.split('_');
value = value.pop();
r3 = value;
}
value = 'unknown';
return 'Update to build ' + (r3 ?? value) + ' available!';
}
const NotificationCenterItems = (require(4624) /* metro dependency 4624: NotificationCenterItemsTypes */).NotificationCenterItems;
const FRIEND_SUGGESTION_CREATED = NotificationCenterItems.FRIEND_SUGGESTION_CREATED;
if (FRIEND_SUGGESTION_CREATED === type) {
return RelationshipStore.getRelationshipType(r5) === RelationshipTypes.PENDING_OUTGOING ? intl.format(t.gZVTy2,
{user: value5}) : item.body ?? '';
}
const GUILD_SCHEDULED_EVENT_STARTED = NotificationCenterItems.GUILD_SCHEDULED_EVENT_STARTED;
if (GUILD_SCHEDULED_EVENT_STARTED === type) {
guild_scheduled_event_id = item.guild_scheduled_event_id;
r6 = guild_scheduled_event_id != null ? GuildScheduledEventStore.getGuildScheduledEvent(guild_scheduled_event_id) : null;
name = r6 == null ? value : r6.name;
value9 = GuildStore.getGuild(r6 == null ? value : r6.guild_id);
name2 = value9 == null ? value : value9.name;
isGuildEventEndedBinding = isGuildEventEnded;
r3 = r6 ?? value;
isGuildEventEnded2 = isGuildEventEndedBinding(r3);
moduleValue = require(1861) /* metro dependency 1861: StringUtils */;
if (moduleValue.isNullOrEmpty(name2)) {
r3 = item.body ?? '';
} else {
moduleValue2 = require(1861) /* metro dependency 1861: StringUtils */;
if (moduleValue2.isNullOrEmpty(name)) {
r3 = item.body ?? '';
} else if (isGuildEventEnded2) {
format = intl.format;
AyvfXR = t.AyvfXR;
object2 = {};
escapeMarkdownBinding = escapeMarkdown;
object2.event_name = escapeMarkdownBinding(name);
object2.guild_name = escapeMarkdownBinding(name2);
r3 = Reflect.apply(format, intl, [AyvfXR, object2]);
} else {
r3 = item.body ?? '';
}
}
return r3;
}
const INCOMING_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS;
if (INCOMING_FRIEND_REQUESTS === type) {
return getFriendRequestItemBody({username: value5, applicationId: applicationId,
renderApplication: renderApplication, withApplication: t['9Dgf1L'], withDefault: t.uIomXw});
}
const INCOMING_FRIEND_REQUESTS_ACCEPTED = NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS_ACCEPTED;
if (INCOMING_FRIEND_REQUESTS_ACCEPTED === type) {
return getFriendRequestItemBody({username: value5, applicationId: applicationId,
renderApplication: renderApplication, withApplication: t.nnC1q9, withDefault: t['5Uzkdp']});
}
const FRIEND_REQUEST_ACCEPTED = NotificationCenterItems.FRIEND_REQUEST_ACCEPTED;
if (FRIEND_REQUEST_ACCEPTED === type) {
return getFriendRequestItemBody({username: value5, applicationId: applicationId,
renderApplication: renderApplication, withApplication: t.jXlYiF, withDefault: t.McYRBk});
}
const INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED = NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED;
if (INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED === type) {
(importDefault(44) /* metro dependency 44 */)(applicationId != null,
'Expected application id for ' + item.type);
return intl.format(t['BB/0vn'], {username: value5, applicationName: function() {
return renderApplication(applicationId);
}});
}
const INCOMING_GAME_FRIEND_REQUESTS = NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS;
if (INCOMING_GAME_FRIEND_REQUESTS === type) {
(importDefault(44) /* metro dependency 44 */)(applicationId != null,
'Expected application id for ' + item.type);
return intl.format(t['7cqOLI'], {username: value5, applicationName: function() {
return renderApplication(applicationId);
}});
}
const GAME_FRIEND_REQUEST_ACCEPTED = NotificationCenterItems.GAME_FRIEND_REQUEST_ACCEPTED;
if (GAME_FRIEND_REQUEST_ACCEPTED === type) {
return applicationId == null ? item.body : intl.format(t.Wi64vN, {username: value5,
applicationName: function() {
return renderApplication(applicationId);
}});
}
return item.body ?? '';
}