decord/source/modules/notifications/NotificationUtils.tsx

107 lines
4 KiB
TypeScript
Raw Normal View History

2026-09-03 10:05:34 +00:00
// Module ID: 10256
// Function ID: 10257
2026-07-20 16:05:17 +00:00
// Name: getMuteTimeOptions
2026-09-03 10:05:34 +00:00
// Dependencies: [4702, 673, 682, 1233, 11, 1398, 4123, 586, 2]
2026-07-20 16:05:17 +00:00
// Exports: filterOverrides, getMuteTimeOptions, shouldShowUseNewNotificationSystem, useShouldUseNewNotificationSystem
2026-09-03 10:05:34 +00:00
// Module 10256 (getMuteTimeOptions)
2026-08-24 06:08:38 +00:00
import DISCORD_EPOCHDefault from "DISCORD_EPOCH" /* 11 */;
2026-09-02 09:53:35 +00:00
import initialize from "initialize" /* 586 */;
import getSystemLocale from "getSystemLocale" /* 1233 */;
2026-09-03 10:05:34 +00:00
import closure_4 from "updateUserGuildSettingsInternal" /* 4702 */;
2026-09-02 09:53:35 +00:00
import { UserNotificationSettings } from "ME" /* 673 */;
import MAX_FAVORITES from "MAX_FAVORITES" /* 682 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
({ MuteUntilSeconds: closure_6, ChannelNotificationSettingsFlags: error } = MAX_FAVORITES);
2026-07-23 10:11:24 +00:00
let closure_8 = { ignoreMute: false, ignoreUnreadSetting: true, ignoreNotificationSetting: false };
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/notifications/NotificationUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getMuteTimeOptions = function getMuteTimeOptions() {
2026-07-29 08:29:29 +00:00
let obj = { id: "15-minutes", label: null, value: null };
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
obj[1] = intl.string(getSystemLocale.t["8ot6gv"]);
2026-07-29 08:29:29 +00:00
obj[2] = closure_6.MINUTES_15;
2026-07-20 16:05:17 +00:00
const items = [obj, , , , , ];
2026-07-29 08:29:29 +00:00
obj = { id: "1-hour", label: null, value: null };
2026-08-24 06:08:38 +00:00
const intl2 = getSystemLocale.intl;
obj[1] = intl2.string(getSystemLocale.t.UMWBZr);
2026-07-29 08:29:29 +00:00
obj[2] = closure_6.HOURS_1;
2026-07-20 16:05:17 +00:00
items[1] = obj;
2026-07-29 08:29:29 +00:00
obj = { id: "3-hours", label: null, value: null };
2026-08-24 06:08:38 +00:00
const intl3 = getSystemLocale.intl;
obj[1] = intl3.string(getSystemLocale.t.QmYWtu);
2026-07-29 08:29:29 +00:00
obj[2] = closure_6.HOURS_3;
2026-07-20 16:05:17 +00:00
items[2] = obj;
2026-08-24 06:08:38 +00:00
obj1 = { id: "8-hours", label: null, value: null };
const intl4 = getSystemLocale.intl;
obj1[1] = intl4.string(getSystemLocale.t.EpAXPC);
2026-07-29 08:29:29 +00:00
obj1[2] = closure_6.HOURS_8;
2026-07-20 16:05:17 +00:00
items[3] = obj1;
2026-07-29 08:29:29 +00:00
const obj2 = { id: "24-hours", label: null, value: null };
2026-08-24 06:08:38 +00:00
const intl5 = getSystemLocale.intl;
obj2[1] = intl5.string(getSystemLocale.t["755t4q"]);
2026-07-29 08:29:29 +00:00
obj2[2] = closure_6.HOURS_24;
2026-07-20 16:05:17 +00:00
items[4] = obj2;
2026-07-29 08:29:29 +00:00
const obj3 = { id: "forever", label: null, value: null };
2026-08-24 06:08:38 +00:00
const intl6 = getSystemLocale.intl;
obj3[1] = intl6.string(getSystemLocale.t.r3LawO);
2026-07-29 08:29:29 +00:00
obj3[2] = closure_6.ALWAYS;
2026-07-20 16:05:17 +00:00
items[5] = obj3;
return items;
};
export const filterOverrides = function filterOverrides(channelOverrides, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = channelOverrides;
2026-07-29 08:29:29 +00:00
let tmp = arg1;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
tmp = closure_8;
}
2026-08-24 06:08:38 +00:00
importDefault = tmp;
const keys = DISCORD_EPOCHDefault.keys(channelOverrides);
2026-07-20 16:05:17 +00:00
return keys.filter((arg0) => {
2026-07-29 08:29:29 +00:00
let num = dependencyMap[arg0].flags;
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
let hasFlagResult = closure_1_2(closure_1_3[5]).hasFlag(num, closure_1_7.UNREADS_ALL_MESSAGES);
2026-07-20 16:05:17 +00:00
if (!hasFlagResult) {
2026-07-29 08:29:29 +00:00
let num2 = tmp[arg0].flags;
if (num2 == null) {
num2 = 0;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
hasFlagResult = closure_1_2(tmp3[5]).hasFlag(num2, closure_1_7.UNREADS_ONLY_MENTIONS);
const tmp2Result = closure_1_2(tmp3[5]);
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
ignoreUnreadSetting = ignoreUnreadSetting.ignoreUnreadSetting;
2026-07-29 08:29:29 +00:00
let tmp7 = !ignoreUnreadSetting;
if (!ignoreUnreadSetting) {
tmp7 = hasFlagResult;
2026-07-20 16:05:17 +00:00
}
if (!tmp7) {
2026-07-29 08:29:29 +00:00
const ignoreNotificationSetting = tmp6.ignoreNotificationSetting;
let tmp8 = !ignoreNotificationSetting;
if (!ignoreNotificationSetting) {
2026-08-24 06:08:38 +00:00
tmp8 = dependencyMap[arg0].message_notifications !== closure_1_5.NULL;
2026-07-29 08:29:29 +00:00
}
tmp7 = tmp8;
2026-07-20 16:05:17 +00:00
}
if (!tmp7) {
2026-07-29 08:29:29 +00:00
const ignoreMute = tmp6.ignoreMute;
let isMuted = !ignoreMute;
if (!ignoreMute) {
isMuted = dependencyMap(tmp3[6]).computeIsMuted(tmp[arg0]);
const obj3 = dependencyMap(tmp3[6]);
2026-07-20 16:05:17 +00:00
}
tmp7 = isMuted;
}
return tmp7;
});
};
export const useShouldUseNewNotificationSystem = function useShouldUseNewNotificationSystem(GuildUnreadAction) {
2026-08-24 06:08:38 +00:00
const items = [closure_4];
return initialize.useStateFromStores(items, () => useNewNotifications.useNewNotifications);
2026-07-20 16:05:17 +00:00
};
export const shouldShowUseNewNotificationSystem = function shouldShowUseNewNotificationSystem(GuildPopoutMenu) {
return useNewNotifications.useNewNotifications;
};