decord/beta/source/stores/NotificationSettingsStore.tsx

122 lines
4.5 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 12566
// Function ID: 12567
// Name: NotificationSettingsStore
2026-10-12 16:32:48 +00:00
// Dependencies: [1085, 1382, 504, 584, 2]
2026-10-12 16:32:48 +00:00
// Module 12566 (NotificationSettingsStore)
2026-10-01 14:13:23 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
2026-10-07 22:43:51 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-12 16:32:48 +00:00
import PlatformUtils from "PlatformUtils" /* 1382 */;
2026-10-07 22:43:51 +00:00
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
let TTSNotificationTypes;
let c3;
const DesktopNotificationTypes = Constants.DesktopNotificationTypes;
({ NotificationPermissionTypes: c3, TTSNotificationTypes } = Constants);
let obj = { desktopType: PlatformUtils.isPlatformEmbedded ? DesktopNotificationTypes.ALL : DesktopNotificationTypes.NEVER, disableAllSounds: false, disabledSounds: [], ttsType: TTSNotificationTypes.NEVER, disableUnreadBadge: false, taskbarFlash: true, notifyMessagesInSelectedChannel: false, screenDowntimeReminder: true };
function handleSetDesktopType(desktopType) {
obj.desktopType = desktopType.desktopType;
}
2026-10-01 14:13:23 +00:00
const DeviceSettingsStore = get_initializedDefault.DeviceSettingsStore;
class NotificationSettingsStore extends DeviceSettingsStore {
2026-10-01 14:13:23 +00:00
initialize(arg0) {
obj = {};
const merged = Object.assign(obj);
const merged1 = Object.assign(arg0);
}
getUserAgnosticState() {
return obj;
}
getDesktopType() {
return obj.desktopType;
}
getTTSType() {
return obj.ttsType;
}
getDisabledSounds() {
return obj.disabledSounds;
}
getDisableAllSounds() {
return obj.disableAllSounds;
}
getDisableUnreadBadge() {
return obj.disableUnreadBadge;
}
getNotifyMessagesInSelectedChannel() {
return obj.notifyMessagesInSelectedChannel;
}
isSoundDisabled(message1) {
let disableAllSounds = obj.disableAllSounds;
if (!disableAllSounds) {
const disabledSounds = obj.disabledSounds;
disableAllSounds = -1 !== disabledSounds.indexOf(message1);
}
return disableAllSounds;
}
}
const prototype = NotificationSettingsStore.prototype;
Object.defineProperty(prototype, "taskbarFlash", {
get: function taskbarFlash() {
return obj.taskbarFlash;
},
set: undefined
});
Object.defineProperty(prototype, "screenDowntimeReminder", {
get: function screenDowntimeReminder() {
return obj.screenDowntimeReminder;
},
set: undefined
});
NotificationSettingsStore.displayName = "NotificationSettingsStore";
NotificationSettingsStore.persistKey = "notifications";
const items = [
(arg0) => {
2026-10-01 14:13:23 +00:00
let NEVER;
obj = { disabledSounds: obj.disabledSounds || [], disableUnreadBadge: obj.disableUnreadBadge || false, taskbarFlash: null == obj.taskbarFlash || obj.taskbarFlash, ttsType: NEVER };
const merged = Object.assign(arg0);
2026-10-01 14:13:23 +00:00
NEVER = obj.ttsType || TTSNotificationTypes.NEVER;
if (null == obj.desktopType) {
obj.desktopType = PlatformUtils.isPlatformEmbedded ? DesktopNotificationTypes.ALL : DesktopNotificationTypes.NEVER;
}
2026-10-01 14:13:23 +00:00
return obj;
}
];
NotificationSettingsStore.migrations = items;
2026-10-01 14:13:23 +00:00
const obj2 = {
NOTIFICATIONS_SET_DESKTOP_TYPE: handleSetDesktopType,
NOTIFICATIONS_SET_TTS_TYPE: function handleSetTTSType(ttsType) {
obj.ttsType = ttsType.ttsType;
},
NOTIFICATIONS_SET_DISABLED_SOUNDS: function handleSetDisabledSounds(sounds) {
obj.disabledSounds = sounds.sounds;
},
NOTIFICATIONS_TOGGLE_ALL_DISABLED: function handleToggleAllDisabled() {
obj.disableAllSounds = !obj.disableAllSounds;
},
NOTIFICATIONS_SET_PERMISSION_STATE: function handleSetHavePermission(enabled) {
enabled = enabled.enabled;
if (enabled === constants.BLOCKED) {
obj.desktopType = DesktopNotificationTypes.NEVER;
} else if (enabled === tmp.ENABLED) {
obj.desktopType = DesktopNotificationTypes.ALL;
}
},
NOTIFICATIONS_SET_DISABLE_UNREAD_BADGE: function handleSetDisableUnreadBadge(disableUnreadBadge) {
obj.disableUnreadBadge = disableUnreadBadge.disableUnreadBadge;
},
NOTIFICATIONS_SET_TASKBAR_FLASH: function handleSetTaskbarFlash(taskbarFlash) {
obj.taskbarFlash = taskbarFlash.taskbarFlash;
},
NOTIFICATIONS_SET_NOTIFY_MESSAGES_IN_SELECTED_CHANNEL: function handleSetNotifyMessagesInSelectedChannel(notify) {
obj.notifyMessagesInSelectedChannel = notify.notify;
},
NOTIFICATIONS_SET_SCREEN_DOWNTIME_REMINDER: function handleSetScreenDowntimeReminder(screenDowntimeReminder) {
obj.screenDowntimeReminder = screenDowntimeReminder.screenDowntimeReminder;
}
2026-10-01 14:13:23 +00:00
};
const notificationSettingsStore = new NotificationSettingsStore(DispatcherDefault, obj2);
const result = size.fileFinishedImporting("stores/NotificationSettingsStore.tsx");
export default notificationSettingsStore;