57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
// Metro module 5927 (f5928).
|
|
import getTimestampString, { getAbbreviatedFormatter, getFullFormatter } from "./getTimestampString";
|
|
import { NOTIFICATION_CENTER_ACKED_BEFORE_ID_UNSET } from "../user_settings/UserSettings";
|
|
import SnowflakeUtils from "../../utils/SnowflakeUtils";
|
|
import { NotificationCenterLocalItems, NotificationCenterItems } from "./NotificationCenterItemsTypes";
|
|
export function getRelativeTimestamp(a0, r4 = true) {
|
|
return getTimestampString({
|
|
since: a0,
|
|
getFormatter: r4 ? getAbbreviatedFormatter : getFullFormatter
|
|
});
|
|
}
|
|
export function isRemoteAcked(a0, a1) {
|
|
return a0.acked || a1 !== NOTIFICATION_CENTER_ACKED_BEFORE_ID_UNSET && SnowflakeUtils.compare(a1, a0.id) >= 0;
|
|
}
|
|
export function incomingFriendRequestLocalItem(a0, a1, a2) {
|
|
const id = SnowflakeUtils.fromTimestamp(new Date(a1).getTime());
|
|
return {
|
|
acked: false,
|
|
forceUnacked: true,
|
|
other_user: a0,
|
|
kind: "notification-center-item",
|
|
local_id: `incoming_friend_requests_${a0.id}_${id}`,
|
|
deeplink: `https://discord.com/users/${a0.id}`,
|
|
type: NotificationCenterLocalItems.INCOMING_FRIEND_REQUESTS,
|
|
id,
|
|
applicationId: a2
|
|
};
|
|
}
|
|
export function incomingGameFriendRequestLocalItem(a0, a1, a2) {
|
|
const id = SnowflakeUtils.fromTimestamp(new Date(a1).getTime());
|
|
return {
|
|
acked: false,
|
|
forceUnacked: true,
|
|
other_user: a0,
|
|
kind: "notification-center-item",
|
|
local_id: `incoming_game_friend_requests_${a0.id}_${id}`,
|
|
deeplink: `https://discord.com/users/${a0.id}`,
|
|
type: NotificationCenterLocalItems.INCOMING_GAME_FRIEND_REQUESTS,
|
|
id,
|
|
applicationId: a2
|
|
};
|
|
}
|
|
export function mobileNativeUpdateAvailableLocalItem(a0) {
|
|
return {
|
|
acked: false,
|
|
enableBadge: true,
|
|
id: SnowflakeUtils.fromTimestamp(new Date().getTime()),
|
|
kind: "notification-center-item",
|
|
local_id: `mobile_update_available_${a0.build}`,
|
|
type: NotificationCenterLocalItems.MOBILE_NATIVE_UPDATE_AVAILABLE,
|
|
deeplink: a0.urls.install.toString()
|
|
};
|
|
}
|
|
export function isMentionItem(a0) {
|
|
return a0.type === NotificationCenterItems.RECENT_MENTION || a0.type === NotificationCenterItems.REPLY_MENTION;
|
|
}
|