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

82 lines
3.7 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 4388
// Function ID: 4389
2026-07-20 16:05:17 +00:00
// Name: Presets
2026-07-29 08:29:29 +00:00
// Dependencies: [676, 4386, 4389, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: arePresetSettingsUnset, presetFromSettings, presetName
2026-07-29 08:29:29 +00:00
// Module 4388 (Presets)
2026-07-23 10:11:24 +00:00
import { UserNotificationSettings } from "ME";
import { UnreadSetting } from "ReadStateTypes";
2026-07-20 16:05:17 +00:00
const obj = { ALL_MESSAGES: "all_messages", MENTIONS: "mentions", NOTHING: "nothing", CUSTOM: "custom" };
2026-07-29 08:29:29 +00:00
const result = require("t").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-07-29 08:29:29 +00:00
const match = require(4389) /* t */.match(items);
2026-07-20 16:05:17 +00:00
const items1 = [UserNotificationSettings.ALL_MESSAGES, UnreadSetting.ALL_MESSAGES];
2026-07-29 08:29:29 +00:00
const str = require(4389) /* 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) {
const match = require(4389) /* t */.match(tmp4Result);
const str = require(4389) /* 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;
};