decord/source/modules/notification_center/getNotificationCenterItemBody.tsx

246 lines
8.3 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 15781
// Function ID: 15782
2026-07-29 08:29:29 +00:00
// Name: getNotificationCenterItemBody
2026-08-25 06:04:03 +00:00
// Dependencies: [7132, 1910, 4034, 1922, 676, 1236, 4224, 7246, 1903, 38, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 15781 (getNotificationCenterItemBody)
import closure_3 from "scheduledEventSort" /* 7132 */;
import { isGuildEventEnded } from "scheduledEventSort" /* 7132 */;
2026-08-24 06:08:38 +00:00
import closure_5 from "createGuildRecordFromRust" /* 1910 */;
2026-08-25 06:04:03 +00:00
import closure_6 from "markAllUserIdListsStale" /* 4034 */;
2026-08-24 06:08:38 +00:00
import closure_7 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
({ EMPTY_STRING_SNOWFLAKE_ID: closure_8, RelationshipTypes: c9 } = ME);
2026-07-23 10:11:24 +00:00
const re10 = /[\\`*_~|<>[\]:]/g;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/notification_center/getNotificationCenterItemBody.tsx");
2026-07-20 16:05:17 +00:00
export default function getNotificationCenterItemBody(arg0) {
({ item, renderApplication } = arg0);
2026-07-29 08:29:29 +00:00
let applicationId = renderApplication;
renderApplication = undefined;
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-07-20 16:05:17 +00:00
id = closure_8;
}
2026-08-25 06:04:03 +00:00
let obj = renderApplication(4224);
2026-08-24 06:08:38 +00:00
obj1 = user;
2026-07-20 16:05:17 +00:00
const other_user2 = item.other_user;
let id1;
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-07-29 08:29:29 +00:00
const str = obj.getName(user.getUser(id1));
if (undefined !== str) {
const replaced = str.replace(closure_10, "\\$&");
}
2026-07-23 10:11:24 +00:00
applicationId = item.applicationId;
2026-07-29 08:29:29 +00:00
renderApplication = applicationId;
2026-07-20 16:05:17 +00:00
const type = item.type;
2026-08-25 06:04:03 +00:00
if (applicationId(7246).NotificationCenterLocalItems.FRIEND_REQUESTS_GROUPED === type) {
let tmp2Result = tmp2(4224);
2026-07-20 16:05:17 +00:00
let other_users = item.other_users;
let id2;
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-07-29 08:29:29 +00:00
const str16 = tmp2Result.getName(obj1.getUser(id2));
let replaced1;
if (undefined !== str16) {
replaced1 = str16.replace(closure_10, "\\$&");
}
2026-08-25 06:04:03 +00:00
tmp2Result = tmp2(4224);
2026-07-20 16:05:17 +00:00
const other_users2 = item.other_users;
let id3;
2026-07-29 08:29:29 +00:00
if (other_users2 != null) {
if (other_users2[1] != null) {
id3 = tmp43.id;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const str18 = tmp2Result.getName(obj1.getUser(id3));
let replaced2;
if (undefined !== str18) {
replaced2 = str18.replace(closure_10, "\\$&");
}
2026-07-20 16:05:17 +00:00
other_users = item.other_users;
2026-07-29 08:29:29 +00:00
let num;
if (other_users != null) {
num = other_users.length;
}
if (num == null) {
num = 0;
}
const bound = Math.max(num - 2, 0);
const intl12 = tmp7(1236).intl;
obj = { user: null, user2: null, count: null };
obj[0] = replaced1;
obj[1] = replaced2;
obj[2] = bound;
return intl12.format(tmp7(1236).t.g5xyIC, obj);
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterLocalItems.MOBILE_NATIVE_UPDATE_AVAILABLE === type) {
2026-07-29 08:29:29 +00:00
let str12;
if (item.local_id != null) {
const parts = str11.split("_");
str12 = parts.pop();
}
if (str12 == null) {
str12 = "unknown";
2026-07-20 16:05:17 +00:00
}
const _HermesInternal3 = HermesInternal;
2026-07-29 08:29:29 +00:00
return "Update to build " + str12 + " available!";
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterItems.FRIEND_SUGGESTION_CREATED === type) {
2026-07-20 16:05:17 +00:00
if (relationshipType.getRelationshipType(id) === constants.PENDING_OUTGOING) {
2026-07-29 08:29:29 +00:00
const intl11 = tmp7(1236).intl;
obj = { user: null };
obj[0] = replaced;
let str10 = intl11.format(tmp7(1236).t.gZVTy2, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
str10 = item.body;
if (str10 == null) {
str10 = "";
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return str10;
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterItems.GUILD_SCHEDULED_EVENT_STARTED === type) {
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 = guildScheduledEvent.getGuildScheduledEvent(guild_scheduled_event_id);
}
let guild_id;
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-07-23 10:11:24 +00:00
guild = guild.getGuild(guild_id);
2026-07-29 08:29:29 +00:00
let name;
if (guild != null) {
2026-07-20 16:05:17 +00:00
name = guild.name;
}
2026-08-11 06:20:06 +00:00
let tmp7Result = tmp7(1903);
2026-07-29 08:29:29 +00:00
if (!tmp7Result.isNullOrEmpty(name)) {
2026-08-11 06:20:06 +00:00
tmp7Result = tmp7(1903);
2026-07-29 08:29:29 +00:00
if (!tmp7Result.isNullOrEmpty(str6)) {
if (tmp28Result) {
const intl10 = tmp7(1236).intl;
let replaced3;
if (undefined !== str6) {
replaced3 = str6.replace(closure_10, "\\$&");
}
obj1 = { event_name: null, guild_name: null };
obj1[0] = replaced3;
let replaced4;
if (undefined !== name) {
replaced4 = name.replace(closure_10, "\\$&");
}
obj1[1] = replaced4;
let formatResult = intl10.format(tmp7(1236).t.AyvfXR, obj1);
2026-07-20 16:05:17 +00:00
}
return formatResult;
}
2026-07-29 08:29:29 +00:00
}
let str9 = item.body;
if (str9 == null) {
str9 = "";
}
formatResult = str9;
const tmp28 = isGuildEventEnded;
tmp28Result = isGuildEventEnded(guildScheduledEvent);
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS === type) {
2026-07-29 08:29:29 +00:00
if (null != applicationId) {
const intl9 = tmp7(1236).intl;
const obj2 = { username: null, applicationName: null };
obj2[0] = replaced;
obj2[1] = function applicationName() {
return renderApplication(applicationId);
};
let formatResult1 = intl9.format(tmp7(1236).t["9Dgf1L"], obj2);
} else {
const intl8 = tmp7(1236).intl;
const obj3 = { username: null };
obj3[0] = replaced;
formatResult1 = intl8.format(tmp20, obj3);
}
return formatResult1;
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS_ACCEPTED === type) {
2026-07-29 08:29:29 +00:00
if (null != applicationId) {
const intl7 = tmp7(1236).intl;
const obj4 = { username: null, applicationName: null };
obj4[0] = replaced;
obj4[1] = function applicationName() {
return renderApplication(applicationId);
};
let formatResult2 = intl7.format(tmp7(1236).t.nnC1q9, obj4);
} else {
const intl6 = tmp7(1236).intl;
const obj5 = { username: null };
obj5[0] = replaced;
formatResult2 = intl6.format(tmp18, obj5);
}
return formatResult2;
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterItems.FRIEND_REQUEST_ACCEPTED === type) {
2026-07-29 08:29:29 +00:00
if (null != applicationId) {
const intl5 = tmp7(1236).intl;
const obj6 = { username: null, applicationName: null };
obj6[0] = replaced;
obj6[1] = function applicationName() {
return renderApplication(applicationId);
};
let formatResult3 = intl5.format(tmp7(1236).t.jXlYiF, obj6);
} else {
const intl4 = tmp7(1236).intl;
const obj7 = { username: null };
obj7[0] = replaced;
formatResult3 = intl4.format(tmp16, obj7);
}
return formatResult3;
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS_ACCEPTED === type) {
2026-07-20 16:05:17 +00:00
const _HermesInternal2 = HermesInternal;
2026-07-29 08:29:29 +00:00
tmp2(38)(null != applicationId, "Expected application id for " + item.type);
const intl3 = tmp7(1236).intl;
const obj8 = { username: null, applicationName: null };
obj8[0] = replaced;
obj8[1] = function applicationName() {
return applicationId(renderApplication);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
return intl3.format(tmp7(1236).t["BB/0vn"], obj8);
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS === type) {
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-07-29 08:29:29 +00:00
tmp2(38)(null != applicationId, "Expected application id for " + item.type);
const intl2 = tmp7(1236).intl;
const obj9 = { username: null, applicationName: null };
obj9[0] = replaced;
obj9[1] = function applicationName() {
return applicationId(renderApplication);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
return intl2.format(tmp7(1236).t["7cqOLI"], obj9);
2026-08-25 06:04:03 +00:00
} else if (tmp7(7246).NotificationCenterItems.GAME_FRIEND_REQUEST_ACCEPTED === type) {
2026-07-20 16:05:17 +00:00
if (null == applicationId) {
2026-07-29 08:29:29 +00:00
let body = item.body;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const intl = tmp7(1236).intl;
const obj10 = { username: null, applicationName: null };
obj10[0] = replaced;
obj10[1] = function applicationName() {
return applicationId(renderApplication);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
body = intl.format(tmp7(1236).t.Wi64vN, obj10);
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-07-29 08:29:29 +00:00
let str3 = item.body;
if (str3 == null) {
str3 = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return str3;
2026-07-20 16:05:17 +00:00
}
};