decord/alpha/source/stores/NotificationSettingsStore.tsx
github-actions 6eea20b8e1 chore: update source for alpha 348.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
2026-09-24 10:59:02 +00:00

125 lines
4.9 KiB
TypeScript

// Module ID: 10428
// Function ID: 10429
// Name: NotificationSettingsStore
// Dependencies: [1074, 1364, 504, 573, 2]
// Module 10428 (NotificationSettingsStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import PlatformUtils from "PlatformUtils" /* 1364 */;
import Constants from "Constants" /* 1074 */;
import size from "module_2" /* 2 */;
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;
}
const DeviceSettingsStore = initializeDefault.DeviceSettingsStore;
class NotificationSettingsStore extends DeviceSettingsStore {
}
const prototype = NotificationSettingsStore.prototype;
prototype["initialize"] = function initialize(arg0) {
obj = {};
const merged = Object.assign(obj);
const merged1 = Object.assign(arg0);
};
prototype["getUserAgnosticState"] = function getUserAgnosticState() {
return obj;
};
prototype["getDesktopType"] = function getDesktopType() {
return obj.desktopType;
};
prototype["getTTSType"] = function getTTSType() {
return obj.ttsType;
};
prototype["getDisabledSounds"] = function getDisabledSounds() {
return obj.disabledSounds;
};
prototype["getDisableAllSounds"] = function getDisableAllSounds() {
return obj.disableAllSounds;
};
prototype["getDisableUnreadBadge"] = function getDisableUnreadBadge() {
return obj.disableUnreadBadge;
};
prototype["getNotifyMessagesInSelectedChannel"] = function getNotifyMessagesInSelectedChannel() {
return obj.notifyMessagesInSelectedChannel;
};
Object.defineProperty(prototype, "taskbarFlash", {
get: function taskbarFlash() {
return obj.taskbarFlash;
},
set: undefined
});
Object.defineProperty(prototype, "screenDowntimeReminder", {
get: function screenDowntimeReminder() {
return obj.screenDowntimeReminder;
},
set: undefined
});
prototype["isSoundDisabled"] = function isSoundDisabled(message1) {
let disableAllSounds = obj.disableAllSounds;
if (!disableAllSounds) {
const disabledSounds = obj.disabledSounds;
disableAllSounds = -1 !== disabledSounds.indexOf(message1);
}
return disableAllSounds;
};
NotificationSettingsStore.displayName = "NotificationSettingsStore";
NotificationSettingsStore.persistKey = "notifications";
const items = [
(arg0) => {
obj = {};
const merged = Object.assign(arg0);
obj.disabledSounds = obj.disabledSounds || [];
obj.disableUnreadBadge = obj.disableUnreadBadge || false;
obj.taskbarFlash = null == obj.taskbarFlash || obj.taskbarFlash;
let NEVER = obj.ttsType;
if (!NEVER) {
NEVER = TTSNotificationTypes.NEVER;
}
obj.ttsType = NEVER;
if (null != obj.desktopType) {
return obj;
} else {
obj.desktopType = PlatformUtils.isPlatformEmbedded ? DesktopNotificationTypes.ALL : DesktopNotificationTypes.NEVER;
}
}
];
NotificationSettingsStore.migrations = items;
const notificationSettingsStore = new NotificationSettingsStore(DispatcherDefault, {
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;
}
});
const result = size.fileFinishedImporting("stores/NotificationSettingsStore.tsx");
export default notificationSettingsStore;