130 lines
4.6 KiB
TypeScript
130 lines
4.6 KiB
TypeScript
// Module ID: 9849
|
|
// Function ID: 9850
|
|
// Name: notifications/NotificationUtils
|
|
// Dependencies: [5071, 1085, 1095, 1126, 11, 1390, 4512, 558, 576, 504, 2]
|
|
// Exports: filterOverrides, getMuteTimeOptions, shouldShowUseNewNotificationSystem
|
|
|
|
// Module 9849 (notifications/NotificationUtils)
|
|
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
|
|
import react from "react" /* 576 */;
|
|
import Constants from "Constants" /* 1085 */;
|
|
import intl7 from "intl" /* 1126 */;
|
|
import FlagUtilsAll from "FlagUtils" /* 1390 */;
|
|
import MuteTimers from "MuteTimers" /* 4512 */;
|
|
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 5071 */;
|
|
import UserSettingsConstants from "UserSettingsConstants" /* 1095 */;
|
|
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
let importDefault;
|
|
|
|
let metroImportDefault;
|
|
let metroRequire;
|
|
let tmp;
|
|
const get_initialized = tmp(504);
|
|
const UserNotificationSettings = Constants.UserNotificationSettings;
|
|
({ MuteUntilSeconds: metroRequire, ChannelNotificationSettingsFlags: metroImportDefault } = UserSettingsConstants);
|
|
let closure_8 = { ignoreMute: false, ignoreUnreadSetting: true, ignoreNotificationSetting: false };
|
|
const tmp3 = ReactCompilerGating.isReactCompilerEnabled() ? (() => {
|
|
let tmp4;
|
|
let tmp5;
|
|
let useNewNotifications;
|
|
const obj = react;
|
|
const cResult = obj.c(2);
|
|
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
const items = [UserGuildSettingsStore];
|
|
const fn = function o() {
|
|
return useNewNotifications.useNewNotifications;
|
|
};
|
|
cResult[0] = items;
|
|
cResult[1] = fn;
|
|
tmp4 = items;
|
|
tmp5 = fn;
|
|
} else {
|
|
[tmp4, tmp5] = cResult;
|
|
}
|
|
const tmpResult = get_initialized;
|
|
return tmpResult.useStateFromStores(tmp4, tmp5);
|
|
}) : (() => {
|
|
let useNewNotifications;
|
|
const items = [UserGuildSettingsStore];
|
|
const obj = get_initialized;
|
|
return obj.useStateFromStores(items, () => useNewNotifications.useNewNotifications);
|
|
});
|
|
const result = size.fileFinishedImporting("modules/notifications/NotificationUtils.tsx");
|
|
|
|
export const getMuteTimeOptions = function getMuteTimeOptions() {
|
|
let intl;
|
|
let intl2;
|
|
let intl3;
|
|
let intl4;
|
|
let intl5;
|
|
let intl6;
|
|
const obj = { id: "15-minutes", label: intl.string(intl7.t["8ot6gv"]), value: metroRequire.MINUTES_15 };
|
|
intl = intl7.intl;
|
|
const items = [obj, , , , , ];
|
|
const obj2 = { id: "1-hour", label: intl2.string(intl7.t.UMWBZr), value: metroRequire.HOURS_1 };
|
|
intl2 = intl7.intl;
|
|
items[1] = obj2;
|
|
const obj3 = { id: "3-hours", label: intl3.string(intl7.t.QmYWtu), value: metroRequire.HOURS_3 };
|
|
intl3 = intl7.intl;
|
|
items[2] = obj3;
|
|
const obj4 = { id: "8-hours", label: intl4.string(intl7.t.EpAXPC), value: metroRequire.HOURS_8 };
|
|
intl4 = intl7.intl;
|
|
items[3] = obj4;
|
|
const obj5 = { id: "24-hours", label: intl5.string(intl7.t["755t4q"]), value: metroRequire.HOURS_24 };
|
|
intl5 = intl7.intl;
|
|
items[4] = obj5;
|
|
const obj6 = { id: "forever", label: intl6.string(intl7.t.r3LawO), value: metroRequire.ALWAYS };
|
|
intl6 = intl7.intl;
|
|
items[5] = obj6;
|
|
return items;
|
|
};
|
|
export const filterOverrides = function filterOverrides(channelOverrides, arg1) {
|
|
let ignoreUnreadSetting;
|
|
let tmp = arg1;
|
|
if (arg1 === undefined) {
|
|
tmp = closure_8;
|
|
}
|
|
importDefault = tmp;
|
|
let obj = SnowflakeUtilsDefault;
|
|
const keys = obj.keys(channelOverrides);
|
|
return keys.filter((item) => {
|
|
const message_notifications = channelOverrides[item].message_notifications;
|
|
const NULL = UserNotificationSettings.NULL;
|
|
let num = channelOverrides[item].flags;
|
|
const hasFlag = FlagUtilsAll.hasFlag;
|
|
FlagUtilsAll;
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
let hasFlagResult = hasFlag(num, metroImportDefault.UNREADS_ALL_MESSAGES);
|
|
const tmp5 = metroImportDefault;
|
|
if (!hasFlagResult) {
|
|
let num2 = tmp[item].flags;
|
|
const hasFlag2 = tmp2(1390).hasFlag;
|
|
FlagUtilsAll;
|
|
if (num2 == null) {
|
|
num2 = 0;
|
|
}
|
|
hasFlagResult = hasFlag2(num2, tmp5.UNREADS_ONLY_MENTIONS);
|
|
}
|
|
let tmp9 = !ignoreUnreadSetting.ignoreUnreadSetting && hasFlagResult;
|
|
if (!tmp9) {
|
|
tmp9 = !ignoreUnreadSetting.ignoreNotificationSetting && message_notifications !== NULL;
|
|
}
|
|
if (!tmp9) {
|
|
let isMuted = !tmp8.ignoreMute;
|
|
if (isMuted) {
|
|
const obj = MuteTimers;
|
|
isMuted = obj.computeIsMuted(tmp[item]);
|
|
}
|
|
tmp9 = isMuted;
|
|
}
|
|
return tmp9;
|
|
});
|
|
};
|
|
export const useShouldUseNewNotificationSystem = tmp3;
|
|
export const shouldShowUseNewNotificationSystem = function shouldShowUseNewNotificationSystem() {
|
|
return UserGuildSettingsStore.useNewNotifications;
|
|
};
|