decord/source/modules/notifications/settings/utils/notificationSettingsPresetUtils.tsx

86 lines
3.8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 5051
// Function ID: 5052
2026-07-20 16:05:17 +00:00
// Name: Presets
2026-08-24 06:08:38 +00:00
// Dependencies: [676, 5049, 4490, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: arePresetSettingsUnset, presetFromSettings, presetName
2026-08-24 06:08:38 +00:00
// Module 5051 (Presets)
import set from "set" /* 2 */;
import ME from "ME" /* 676 */;
import t from "t" /* 4490 */;
import ReadStateTypes from "ReadStateTypes" /* 5049 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
const UserNotificationSettings = ME.UserNotificationSettings;
const UnreadSetting = ReadStateTypes.UnreadSetting;
2026-07-20 16:05:17 +00:00
const obj = { ALL_MESSAGES: "all_messages", MENTIONS: "mentions", NOTHING: "nothing", CUSTOM: "custom" };
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/notifications/settings/utils/notificationSettingsPresetUtils.tsx");
2026-07-20 16:05:17 +00:00
export const Presets = obj;
export const presetFromSettings = function presetFromSettings(unreadSetting, messageNotifications) {
const items = [messageNotifications, unreadSetting];
2026-08-24 06:08:38 +00:00
const match = t.match(items);
2026-07-20 16:05:17 +00:00
const items1 = [UserNotificationSettings.ALL_MESSAGES, UnreadSetting.ALL_MESSAGES];
2026-08-24 06:08:38 +00:00
const str = t;
2026-07-20 16:05:17 +00:00
const items2 = [UserNotificationSettings.ONLY_MENTIONS, UnreadSetting.UNSET];
2026-07-29 08:29:29 +00:00
const withResult = match.with(items1, () => constants.ALL_MESSAGES);
2026-07-20 16:05:17 +00:00
const items3 = [UserNotificationSettings.ONLY_MENTIONS, UnreadSetting.ONLY_MENTIONS];
2026-07-29 08:29:29 +00:00
const withResult1 = match.with(items1, () => constants.ALL_MESSAGES).with(items2, () => constants.MENTIONS);
2026-07-20 16:05:17 +00:00
const items4 = [UserNotificationSettings.NO_MESSAGES, UnreadSetting.UNSET];
2026-07-29 08:29:29 +00:00
const withResult2 = match.with(items1, () => constants.ALL_MESSAGES).with(items2, () => constants.MENTIONS).with(items3, () => constants.MENTIONS);
2026-07-20 16:05:17 +00:00
const items5 = [UserNotificationSettings.NO_MESSAGES, UnreadSetting.ONLY_MENTIONS];
2026-07-29 08:29:29 +00:00
const withResult3 = match.with(items1, () => constants.ALL_MESSAGES).with(items2, () => constants.MENTIONS).with(items3, () => constants.MENTIONS).with(items4, () => constants.NOTHING);
return match.with(items1, () => constants.ALL_MESSAGES).with(items2, () => constants.MENTIONS).with(items3, () => constants.MENTIONS).with(items4, () => constants.NOTHING).with(items5, () => constants.NOTHING).otherwise(() => constants.CUSTOM);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
export const presetName = function presetName(tmp4Result) {
2026-08-24 06:08:38 +00:00
const match = t.match(tmp4Result);
const str = t;
2026-07-20 16:05:17 +00:00
const withResult = match.with(obj.ALL_MESSAGES, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t.hZrr6k);
2026-07-20 16:05:17 +00:00
});
const withResult1 = match.with(obj.ALL_MESSAGES, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t.hZrr6k);
2026-07-20 16:05:17 +00:00
}).with(obj.MENTIONS, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t.y59NJm);
2026-07-20 16:05:17 +00:00
});
const withResult2 = match.with(obj.ALL_MESSAGES, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t.hZrr6k);
2026-07-20 16:05:17 +00:00
}).with(obj.MENTIONS, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t.y59NJm);
2026-07-20 16:05:17 +00:00
}).with(obj.NOTHING, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t["pGn/bJ"]);
2026-07-20 16:05:17 +00:00
});
return match.with(obj.ALL_MESSAGES, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t.hZrr6k);
2026-07-20 16:05:17 +00:00
}).with(obj.MENTIONS, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t.y59NJm);
2026-07-20 16:05:17 +00:00
}).with(obj.NOTHING, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t["pGn/bJ"]);
2026-07-20 16:05:17 +00:00
}).with(obj.CUSTOM, () => {
2026-07-29 08:29:29 +00:00
const intl = callback(1236).intl;
return intl.string(callback(1236).t["32yow9"]);
2026-07-20 16:05:17 +00:00
}).exhaustive();
};
export const arePresetSettingsUnset = function arePresetSettingsUnset(arg0, arg1) {
let tmp = null != arg0;
if (tmp) {
tmp = arg0 !== UnreadSetting.UNSET;
}
if (!tmp) {
2026-07-29 08:29:29 +00:00
let tmp4 = null != arg1;
if (tmp4) {
tmp4 = arg1 !== UserNotificationSettings.NULL;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = tmp4;
2026-07-20 16:05:17 +00:00
}
return !tmp;
};