Files
discord-decomp/sources/modules/notifications/settings/utils/notficationSettingsChannelFlagUtils.tsx
T
2026-07-27 16:20:00 +03:00

206 lines
14 KiB
TypeScript

/* Metro module 10941; source: modules/notifications/settings/utils/notficationSettingsChannelFlagUtils.tsx; dependencies: [57, 1379, 4864, 661, 4865, 670, 632, 4867, 10939, 6613, 10942, 6610, 2] */
function _fun83886(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:6, offset: 0x01f2cee2, size: 283 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
const env0_6 = (require(661) /* metro dependency 661: Constants */).UserNotificationSettings;
const env0_7 = (require(4865) /* metro dependency 4865: ReadStateConstants */).UnreadSetting;
const env0_8 = (require(670) /* metro dependency 670: UserSettingsConstants */).ChannelNotificationSettingsFlags;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/notifications/settings/utils/notficationSettingsChannelFlagUtils.tsx');
exports.useChannelPresetSettings = useChannelPresetSettings;
exports.useChannelPresetInheritance = useChannelPresetInheritance;
exports.updateChannelPreset = updateChannelPreset;
exports.updateChannelToGuildDefault = updateChannelToGuildDefault;
exports.updateChannelUnreadSetting = updateChannelUnreadSetting;
exports.updateChannelNotificationSetting = updateChannelNotificationSetting;
}
function useChannelPresetSettings(a0) { // fn#83887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:366, offset: 0x01f2cffd, size: 142 bytes, params: 2, frame: 19
var object2;
const env0_0 = a0;
const value = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStores([UserGuildSettingsStore],
_fun83888);
const value2 = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStores([UserGuildSettingsStore],
_fun83889);
object2 = {unread: value, notification: value2};
object2.preset = (require(4867) /* metro dependency 4867: notificationSettingsPresetUtils */).presetFromSettings(value,
value2);
return object2;
}
function useChannelPresetInheritance(a0) { // fn#83890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:649, offset: 0x01f2d0c1, size: 208 bytes, params: 2, frame: 22
const env0_0 = a0;
const useStateFromStoresModule = require(632) /* metro dependency 632: useStateFromStores */;
let useStateFromStoresArray = useStateFromStoresModule.useStateFromStoresArray;
const value2 = Reflect.apply(useStateFromStoresArray, useStateFromStoresModule, [[UserGuildSettingsStore],
_fun83891]);
const moduleValue2 = useStateFromStoresModule;
useStateFromStoresArray = moduleValue2.useStateFromStoresArray;
const value = env0_3(Reflect.apply(useStateFromStoresArray, moduleValue2, [[UserGuildSettingsStore, ChannelStore],
_fun83892, [a0.guild_id, a0.parent_id, value2]]), 2);
return {inherited: !value2.includes(a0.id), inheritedFrom: value[0], inheritedPreset: value[1]};
}
function updateChannelPreset(a0, a1, a2) { // fn#83893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:1373, offset: 0x01f2d2ec, size: 528 bytes, params: 4, frame: 24
var defaultImport;
var updateChannelOverrideSettings;
var object2;
var moduleValue;
const NotificationLabels = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).NotificationLabels;
var defaultImport2;
var moduleValue2;
var defaultImport3;
var moduleValue3;
const channelIdFlags = UserGuildSettingsStore.getChannelIdFlags(a0, a1);
const Presets = (require(4867) /* metro dependency 4867: notificationSettingsPresetUtils */).Presets;
const ALL_MESSAGES = Presets.ALL_MESSAGES;
if (a2 === ALL_MESSAGES) {
defaultImport3 = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
updateChannelOverrideSettings = defaultImport3.updateChannelOverrideSettings;
object2 = {};
object2.message_notifications = UserNotificationSettings.ALL_MESSAGES;
moduleValue3 = require(10942) /* metro dependency 10942: notificationSettingsFlagUtils */;
object2.flags = moduleValue3.withChannelUnreadFlags(channelIdFlags,
ChannelNotificationSettingsFlags.UNREADS_ALL_MESSAGES);
Reflect.apply(updateChannelOverrideSettings, defaultImport3, [a0, a1, object2, NotificationLabels.PresetAll]);
} else if (a2 === Presets.MENTIONS) {
defaultImport2 = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
updateChannelOverrideSettings = defaultImport2.updateChannelOverrideSettings;
object2 = {};
object2.message_notifications = UserNotificationSettings.ONLY_MENTIONS;
moduleValue2 = require(10942) /* metro dependency 10942: notificationSettingsFlagUtils */;
object2.flags = moduleValue2.withChannelUnreadFlags(channelIdFlags,
ChannelNotificationSettingsFlags.UNREADS_ONLY_MENTIONS);
Reflect.apply(updateChannelOverrideSettings, defaultImport2, [a0, a1, object2,
NotificationLabels.PresetMentions]);
} else if (a2 === Presets.NOTHING) {
defaultImport = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
updateChannelOverrideSettings = defaultImport.updateChannelOverrideSettings;
object2 = {};
object2.message_notifications = UserNotificationSettings.NO_MESSAGES;
moduleValue = require(10942) /* metro dependency 10942: notificationSettingsFlagUtils */;
object2.flags = moduleValue.withChannelUnreadFlags(channelIdFlags,
ChannelNotificationSettingsFlags.UNREADS_ONLY_MENTIONS);
Reflect.apply(updateChannelOverrideSettings, defaultImport, [a0, a1, object2,
NotificationLabels.PresetNothing]);
}
}
function updateChannelToGuildDefault(a0, a1) { // fn#83894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:2125, offset: 0x01f2d4fc, size: 143 bytes, params: 3, frame: 23
const defaultImport = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
const updateChannelOverrideSettings = defaultImport.updateChannelOverrideSettings;
const object2 = {};
const NULL = UserNotificationSettings.NULL;
object2.message_notifications = NULL;
const notificationSettingsFlagUtilsModule = require(10942) /* metro dependency 10942: notificationSettingsFlagUtils */;
const resetChannelUnreadFlags = notificationSettingsFlagUtilsModule.resetChannelUnreadFlags;
const getChannelIdFlags = UserGuildSettingsStore.getChannelIdFlags;
object2.flags = Reflect.apply(resetChannelUnreadFlags, notificationSettingsFlagUtilsModule,
[Reflect.apply(getChannelIdFlags, UserGuildSettingsStore, [a0, a1])]);
const NotificationLabels = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).NotificationLabels;
const PresetDefault = NotificationLabels.PresetDefault;
Reflect.apply(updateChannelOverrideSettings, defaultImport, [a0, a1, object2, PresetDefault]);
}
function updateChannelUnreadSetting(a0, a1, a2) { // fn#83895, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:2378, offset: 0x01f2d58b, size: 181 bytes, params: 4, frame: 24
const channelIdFlags = UserGuildSettingsStore.getChannelIdFlags(a0, a1);
const defaultImport = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
const updateChannelOverrideSettings = defaultImport.updateChannelOverrideSettings;
const object2 = {};
const notificationSettingsFlagUtilsModule = require(10942) /* metro dependency 10942: notificationSettingsFlagUtils */;
const withChannelUnreadFlags = notificationSettingsFlagUtilsModule.withChannelUnreadFlags;
const ALL_MESSAGES = UnreadSetting.ALL_MESSAGES;
object2.flags = Reflect.apply(withChannelUnreadFlags, notificationSettingsFlagUtilsModule, [channelIdFlags,
a2 === ALL_MESSAGES ? ChannelNotificationSettingsFlags.UNREADS_ALL_MESSAGES : ChannelNotificationSettingsFlags.UNREADS_ONLY_MENTIONS]);
const NotificationLabel = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).NotificationLabel;
Reflect.apply(updateChannelOverrideSettings, defaultImport, [a0, a1, object2, NotificationLabel.unreads(a2)]);
}
function updateChannelNotificationSetting(a0, a1, a2) { // fn#83896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:2678, offset: 0x01f2d640, size: 92 bytes, params: 4, frame: 19
const defaultImport = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
const updateChannelOverrideSettings = defaultImport.updateChannelOverrideSettings;
const NotificationLabel = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).NotificationLabel;
Reflect.apply(updateChannelOverrideSettings, defaultImport, [a0, a1, {message_notifications: a2},
NotificationLabel.notifications(a2)]);
}
function _fun83888() { // fn#83888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:441, offset: 0x01f2d08b, size: 27 bytes, params: 1, frame: 11
return UserGuildSettingsStore.resolveUnreadSetting(env0_0);
}
function _fun83889() { // fn#83889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:507, offset: 0x01f2d0a6, size: 27 bytes, params: 1, frame: 11
return UserGuildSettingsStore.resolvedMessageNotifications(env0_0);
}
function _fun83891() { // fn#83891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:732, offset: 0x01f2d191, size: 80 bytes, params: 1, frame: 14
const value = environment.__proto__;
const notificationUtilsModule = require(10939) /* metro dependency 10939: NotificationUtils */;
const filterOverrides = notificationUtilsModule.filterOverrides;
const getChannelOverrides = UserGuildSettingsStore.getChannelOverrides;
return Reflect.apply(filterOverrides, notificationUtilsModule, [Reflect.apply(getChannelOverrides,
UserGuildSettingsStore, [env0_0.guild_id]), {'ignoreMute': true, 'ignoreUnreadSetting': false,
'ignoreNotificationSetting': false}]);
}
function _fun83892() { // fn#83892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11127:906, offset: 0x01f2d1e1, size: 267 bytes, params: 1, frame: 19
var items;
var binding;
var moduleValue;
var presetName;
var moduleValue2;
var presetFromSettings;
var getGuildUnreadSetting;
var guild_id;
var getMessageNotifications;
var moduleValue3;
var moduleValue4;
let value = environment.__proto__;
const channel = ChannelStore.getChannel(env0_0.parent_id);
if (channel == null) {
moduleValue = require(4867) /* metro dependency 4867: notificationSettingsPresetUtils */;
presetName = moduleValue.presetName;
moduleValue2 = require(4867) /* metro dependency 4867: notificationSettingsPresetUtils */;
presetFromSettings = moduleValue2.presetFromSettings;
getGuildUnreadSetting = UserGuildSettingsStore.getGuildUnreadSetting;
binding = env0_0;
guild_id = binding.guild_id;
value = Reflect.apply(getGuildUnreadSetting, UserGuildSettingsStore, [guild_id]);
getMessageNotifications = UserGuildSettingsStore.getMessageNotifications;
guild_id = binding.guild_id;
value = Reflect.apply(presetName, moduleValue, [Reflect.apply(presetFromSettings, moduleValue2, [value,
Reflect.apply(getMessageNotifications, UserGuildSettingsStore, [guild_id])])]);
items = ['guild', value];
} else {
binding = env0_1;
if (binding.includes(channel.id)) {
moduleValue3 = require(4867) /* metro dependency 4867: notificationSettingsPresetUtils */;
presetName = moduleValue3.presetName;
moduleValue4 = require(4867) /* metro dependency 4867: notificationSettingsPresetUtils */;
presetFromSettings = moduleValue4.presetFromSettings;
value = UserGuildSettingsStore.resolveUnreadSetting(channel);
value = Reflect.apply(presetName, moduleValue3, [Reflect.apply(presetFromSettings, moduleValue4, [value,
UserGuildSettingsStore.resolvedMessageNotifications(channel)])]);
items = ['parent', value];
} else {
moduleValue = require(4867) /* metro dependency 4867: notificationSettingsPresetUtils */;
presetName = moduleValue.presetName;
moduleValue2 = require(4867) /* metro dependency 4867: notificationSettingsPresetUtils */;
presetFromSettings = moduleValue2.presetFromSettings;
getGuildUnreadSetting = UserGuildSettingsStore.getGuildUnreadSetting;
binding = env0_0;
guild_id = binding.guild_id;
value = Reflect.apply(getGuildUnreadSetting, UserGuildSettingsStore, [guild_id]);
getMessageNotifications = UserGuildSettingsStore.getMessageNotifications;
guild_id = binding.guild_id;
value = Reflect.apply(presetName, moduleValue, [Reflect.apply(presetFromSettings, moduleValue2, [value,
Reflect.apply(getMessageNotifications, UserGuildSettingsStore, [guild_id])])]);
items = ['guild', value];
}
}
return items;
}