decord/alpha/source/modules/notification_center/getNotificationCenterItemBody.tsx

248 lines
8.4 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 16788
// Function ID: 16789
2026-07-29 08:29:29 +00:00
// Name: getNotificationCenterItemBody
2026-10-09 10:00:15 +00:00
// Dependencies: [6061, 2086, 4719, 1390, 1085, 1126, 4923, 6065, 2031, 38, 2]
2026-08-26 06:04:24 +00:00
// Exports: default, getFriendRequestSentBody
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 16788 (getNotificationCenterItemBody)
2026-10-03 08:58:59 +00:00
import _modDef38 from "module_38" /* 38 */;
import intl13 from "intl" /* 1126 */;
2026-10-09 10:00:15 +00:00
import StringUtils from "StringUtils" /* 2031 */;
import UserUtilsDefault from "UserUtils" /* 4923 */;
import GuildScheduledEventStore2 from "GuildScheduledEventStore" /* 6061 */;
import NotificationCenterItemsTypes from "NotificationCenterItemsTypes" /* 6065 */;
2026-10-08 09:57:35 +00:00
import GuildStore from "GuildStore" /* 2086 */;
2026-10-09 10:00:15 +00:00
import RelationshipStore from "RelationshipStore" /* 4719 */;
import UserStore from "UserStore" /* 1390 */;
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const GuildScheduledEventStore = GuildScheduledEventStore2;
let c9;
let metroImportAll;
const isGuildEventEnded = GuildScheduledEventStore2.isGuildEventEnded;
({ EMPTY_STRING_SNOWFLAKE_ID: metroImportAll, RelationshipTypes: c9 } = Constants);
const result = size.fileFinishedImporting("modules/notification_center/getNotificationCenterItemBody.tsx");
2026-07-20 16:05:17 +00:00
export default function getNotificationCenterItemBody(arg0) {
2026-10-03 08:58:59 +00:00
let item;
let renderApplication;
function applicationName() {
return renderApplication(applicationId);
}
2026-07-20 16:05:17 +00:00
({ item, renderApplication } = arg0);
2026-10-03 08:58:59 +00:00
let applicationId;
2026-07-20 16:05:17 +00:00
const other_user = item.other_user;
let id;
2026-07-29 08:29:29 +00:00
if (other_user != null) {
2026-07-20 16:05:17 +00:00
id = other_user.id;
}
2026-07-29 08:29:29 +00:00
if (id == null) {
2026-10-03 08:58:59 +00:00
id = metroImportAll;
2026-07-20 16:05:17 +00:00
}
const other_user2 = item.other_user;
let id1;
2026-10-03 08:58:59 +00:00
const getName = UserUtilsDefault.getName;
const getUser = UserStore.getUser;
UserUtilsDefault;
2026-07-29 08:29:29 +00:00
if (other_user2 != null) {
2026-07-20 16:05:17 +00:00
id1 = other_user2.id;
}
2026-10-03 08:58:59 +00:00
const name1 = getName(getUser(id1));
2026-07-23 10:11:24 +00:00
applicationId = item.applicationId;
2026-07-20 16:05:17 +00:00
const type = item.type;
if (NotificationCenterItemsTypes.NotificationCenterLocalItems.FRIEND_REQUESTS_GROUPED === type) {
const other_users = item.other_users;
2026-07-20 16:05:17 +00:00
let id2;
2026-10-03 08:58:59 +00:00
const getName2 = UserUtilsDefault.getName;
const getUser2 = tmp5.getUser;
UserUtilsDefault;
2026-07-29 08:29:29 +00:00
if (other_users != null) {
2026-07-20 16:05:17 +00:00
const first = other_users[0];
2026-07-29 08:29:29 +00:00
if (first != null) {
2026-07-20 16:05:17 +00:00
id2 = first.id;
}
}
2026-10-03 08:58:59 +00:00
const name2 = getName2(getUser2(id2));
2026-07-20 16:05:17 +00:00
const other_users2 = item.other_users;
let id3;
2026-10-03 08:58:59 +00:00
const getName3 = UserUtilsDefault.getName;
const getUser3 = tmp5.getUser;
UserUtilsDefault;
2026-07-29 08:29:29 +00:00
if (other_users2 != null) {
if (other_users2[1] != null) {
2026-10-03 08:58:59 +00:00
id3 = tmp42.id;
2026-07-20 16:05:17 +00:00
}
}
const other_users1 = item.other_users;
2026-07-29 08:29:29 +00:00
let num;
2026-10-03 08:58:59 +00:00
const name3 = getName3(getUser3(id3));
const _Math = Math;
if (other_users1 != null) {
num = other_users1.length;
2026-07-29 08:29:29 +00:00
}
if (num == null) {
num = 0;
}
2026-10-03 08:58:59 +00:00
const maxResult = max(num - 2, 0);
const intl12 = tmp8(1126).intl;
const obj2 = { user: name2, user2: name3, count: maxResult };
return intl12.format(intl13.t.g5xyIC, obj2);
} else if (NotificationCenterItemsTypes.NotificationCenterLocalItems.MOBILE_NATIVE_UPDATE_AVAILABLE === type) {
2026-08-26 06:04:24 +00:00
let str7;
2026-07-29 08:29:29 +00:00
if (item.local_id != null) {
2026-08-26 06:04:24 +00:00
const parts = str6.split("_");
str7 = parts.pop();
2026-07-29 08:29:29 +00:00
}
2026-08-26 06:04:24 +00:00
if (str7 == null) {
str7 = "unknown";
2026-07-20 16:05:17 +00:00
}
const _HermesInternal3 = HermesInternal;
2026-08-26 06:04:24 +00:00
return "Update to build " + str7 + " available!";
2026-10-03 08:58:59 +00:00
} else if (NotificationCenterItemsTypes.NotificationCenterItems.FRIEND_SUGGESTION_CREATED === type) {
let str5;
if (RelationshipStore.getRelationshipType(id) === constants.PENDING_OUTGOING) {
2026-10-03 08:58:59 +00:00
const intl11 = tmp8(1126).intl;
const obj3 = { user: name1 };
str5 = intl11.format(tmp8(1126).t.gZVTy2, obj3);
2026-07-20 16:05:17 +00:00
} else {
2026-08-26 06:04:24 +00:00
str5 = item.body;
if (str5 == null) {
str5 = "";
2026-07-20 16:05:17 +00:00
}
}
2026-08-26 06:04:24 +00:00
return str5;
2026-10-03 08:58:59 +00:00
} else if (NotificationCenterItemsTypes.NotificationCenterItems.GUILD_SCHEDULED_EVENT_STARTED === type) {
let name;
2026-07-20 16:05:17 +00:00
const guild_scheduled_event_id = item.guild_scheduled_event_id;
let guildScheduledEvent = null;
if (null != guild_scheduled_event_id) {
guildScheduledEvent = GuildScheduledEventStore.getGuildScheduledEvent(guild_scheduled_event_id);
2026-07-20 16:05:17 +00:00
}
2026-08-26 06:04:24 +00:00
if (guildScheduledEvent != null) {
2026-10-03 08:58:59 +00:00
name = guildScheduledEvent.name;
2026-08-26 06:04:24 +00:00
}
2026-07-20 16:05:17 +00:00
let guild_id;
2026-10-03 08:58:59 +00:00
const getGuild = GuildStore.getGuild;
2026-07-29 08:29:29 +00:00
if (guildScheduledEvent != null) {
2026-07-20 16:05:17 +00:00
guild_id = guildScheduledEvent.guild_id;
}
2026-10-03 08:58:59 +00:00
const guild = getGuild(guild_id);
let name4;
2026-07-29 08:29:29 +00:00
if (guild != null) {
name4 = guild.name;
2026-08-26 06:04:24 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp30Result = isGuildEventEnded(guildScheduledEvent);
const tmp8Result = StringUtils;
if (!tmp8Result.isNullOrEmpty(name4)) {
const tmp8Result2 = StringUtils;
if (!tmp8Result2.isNullOrEmpty(name)) {
let formatResult;
if (tmp30Result) {
const intl10 = tmp8(1126).intl;
const obj4 = { event_name: name, guild_name: name4 };
formatResult = intl10.format(tmp8(1126).t.AyvfXR, obj4);
2026-07-20 16:05:17 +00:00
}
return formatResult;
}
2026-07-29 08:29:29 +00:00
}
2026-08-26 06:04:24 +00:00
let str4 = item.body;
if (str4 == null) {
str4 = "";
2026-07-29 08:29:29 +00:00
}
2026-08-26 06:04:24 +00:00
formatResult = str4;
2026-10-03 08:58:59 +00:00
} else if (NotificationCenterItemsTypes.NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS === type) {
let formatResult1;
const v9Dgf1L = tmp8(1126).t["9Dgf1L"];
2026-07-29 08:29:29 +00:00
if (null != applicationId) {
2026-10-03 08:58:59 +00:00
const intl9 = tmp8(1126).intl;
const obj5 = { username: name1, applicationName };
formatResult1 = intl9.format(v9Dgf1L, obj5);
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
const intl8 = tmp8(1126).intl;
const obj6 = { username: name1 };
formatResult1 = intl8.format(tmp22, obj6);
2026-07-29 08:29:29 +00:00
}
return formatResult1;
2026-10-03 08:58:59 +00:00
} else if (NotificationCenterItemsTypes.NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS_ACCEPTED === type) {
let formatResult2;
const nnC1q9 = tmp8(1126).t.nnC1q9;
2026-07-29 08:29:29 +00:00
if (null != applicationId) {
2026-10-03 08:58:59 +00:00
const intl7 = tmp8(1126).intl;
const obj7 = { username: name1, applicationName };
formatResult2 = intl7.format(nnC1q9, obj7);
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
const intl6 = tmp8(1126).intl;
const obj8 = { username: name1 };
formatResult2 = intl6.format(tmp19, obj8);
2026-07-29 08:29:29 +00:00
}
return formatResult2;
2026-10-03 08:58:59 +00:00
} else if (NotificationCenterItemsTypes.NotificationCenterItems.FRIEND_REQUEST_ACCEPTED === type) {
let formatResult3;
const jXlYiF = tmp8(1126).t.jXlYiF;
2026-07-29 08:29:29 +00:00
if (null != applicationId) {
2026-10-03 08:58:59 +00:00
const intl5 = tmp8(1126).intl;
const obj9 = { username: name1, applicationName };
formatResult3 = intl5.format(jXlYiF, obj9);
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
const intl4 = tmp8(1126).intl;
const obj10 = { username: name1 };
formatResult3 = intl4.format(tmp17, obj10);
2026-07-29 08:29:29 +00:00
}
return formatResult3;
2026-10-03 08:58:59 +00:00
} else if (NotificationCenterItemsTypes.NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED === type) {
2026-07-20 16:05:17 +00:00
const _HermesInternal2 = HermesInternal;
2026-10-03 08:58:59 +00:00
const tmp14 = null != applicationId;
const tmp2Result5 = _modDef38;
tmp2Result5(tmp14, "Expected application id for " + item.type);
const intl3 = tmp8(1126).intl;
const obj11 = {
username: name1,
applicationName() {
2026-10-03 08:58:59 +00:00
return renderApplication(applicationId);
}
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
return intl3.format(intl13.t["BB/0vn"], obj11);
} else if (NotificationCenterItemsTypes.NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS === type) {
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-10-03 08:58:59 +00:00
const tmp10 = null != applicationId;
const tmp2Result6 = _modDef38;
tmp2Result6(tmp10, "Expected application id for " + item.type);
const intl2 = tmp8(1126).intl;
const obj12 = {
username: name1,
applicationName() {
2026-10-03 08:58:59 +00:00
return renderApplication(applicationId);
}
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
return intl2.format(intl13.t["7cqOLI"], obj12);
} else if (NotificationCenterItemsTypes.NotificationCenterItems.GAME_FRIEND_REQUEST_ACCEPTED === type) {
let body;
2026-07-20 16:05:17 +00:00
if (null == applicationId) {
2026-10-03 08:58:59 +00:00
body = item.body;
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
const intl = tmp8(1126).intl;
const obj = {
username: name1,
applicationName() {
2026-10-03 08:58:59 +00:00
return renderApplication(applicationId);
}
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
body = intl.format(tmp8(1126).t.Wi64vN, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return body;
2026-07-20 16:05:17 +00:00
} else {
2026-08-26 06:04:24 +00:00
let str = item.body;
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
2026-08-26 06:04:24 +00:00
return str;
2026-07-20 16:05:17 +00:00
}
};
2026-08-26 06:04:24 +00:00
export const getFriendRequestSentBody = function getFriendRequestSentBody(user) {
2026-10-03 08:58:59 +00:00
const intl = intl13.intl;
const obj = { user };
return intl.format(intl13.t.gZVTy2, obj);
2026-08-26 06:04:24 +00:00
};