decord/alpha/source/components_native/InAppNotificationSettingsModal.tsx

298 lines
10 KiB
TypeScript
Raw Permalink Normal View History

2026-10-13 12:43:34 +00:00
// Module ID: 13105
// Function ID: 13106
// Name: InAppNotificationSettingsModal
2026-10-13 12:43:34 +00:00
// Dependencies: [19, 2069, 2065, 4760, 5966, 1390, 1085, 21, 6809, 6804, 5421, 8580, 1126, 13106, 7094, 558, 576, 504, 6201, 6688, 2]
2026-07-20 16:05:17 +00:00
2026-10-13 12:43:34 +00:00
// Module 13105 (InAppNotificationSettingsModal)
2026-10-03 08:58:59 +00:00
import intl4 from "intl" /* 1126 */;
2026-10-10 08:08:14 +00:00
import ChannelRecord from "ChannelRecord" /* 2069 */;
import useChannelName from "useChannelName" /* 5421 */;
2026-10-12 06:59:38 +00:00
import NavigatorHeader2 from "NavigatorHeader" /* 6201 */;
import NotificationSettingsUtils from "NotificationSettingsUtils" /* 6804 */;
import NotificationSettingsModalActionCreatorsDefault from "NotificationSettingsModalActionCreators" /* 6809 */;
import openUserSettings from "openUserSettings" /* 7094 */;
import Form2 from "Form" /* 8580 */;
2026-10-13 12:43:34 +00:00
import ChannelSettingsNotificationsDefault from "ChannelSettingsNotifications" /* 13106 */;
2026-10-03 08:58:59 +00:00
import react from "react" /* 19 */;
2026-10-10 08:08:14 +00:00
import ChannelStore from "ChannelStore" /* 2065 */;
import RelationshipStore from "RelationshipStore" /* 4760 */;
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 5966 */;
2026-10-09 10:00:15 +00:00
import UserStore from "UserStore" /* 1390 */;
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
import Fragment from "Fragment" /* 21 */;
import ReactCompilerGating_mod from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let _require;
let c10;
let c9;
let closure_12;
let unpackModuleId;
const isMultiUserDM = ChannelRecord.isMultiUserDM;
({ ChannelTypes: c9, UserSettingsSections: c10 } = Constants);
({ jsx: unpackModuleId, jsxs: closure_12 } = Fragment);
const PureComponent = react.PureComponent;
2026-07-29 08:29:29 +00:00
class InAppNotificationSettingsScreen extends PureComponent {
constructor() {
2026-10-03 08:58:59 +00:00
const applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
const require = applyArgumentsResult;
2026-07-29 08:29:29 +00:00
applyArgumentsResult.handleGroupDMMute = function handleGroupDMMute() {
2026-10-03 08:58:59 +00:00
let NotificationLabel;
let channel;
let isMuted;
let obj2;
({ channel, isMuted } = require.props);
2026-07-29 08:29:29 +00:00
if (null != channel) {
2026-10-03 08:58:59 +00:00
const obj = { guildId: channel.getGuildId(), channelId: channel.id, settings: obj2, label: NotificationLabel.muted(!isMuted) };
const updateChannelOverrideSettings = NotificationSettingsModalActionCreatorsDefault.updateChannelOverrideSettings;
NotificationSettingsModalActionCreatorsDefault;
obj2 = { muted: !isMuted };
NotificationLabel = NotificationSettingsUtils.NotificationLabel;
const result = updateChannelOverrideSettings(obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
applyArgumentsResult.handleOpenUserSettings = function handleOpenUserSettings() {
2026-10-03 08:58:59 +00:00
const obj = openUserSettings;
const obj2 = { screen: constants.NOTIFICATIONS };
obj.openUserSettings(obj2);
2026-07-29 08:29:29 +00:00
};
return applyArgumentsResult;
}
2026-10-03 08:58:59 +00:00
renderGroupDMNotificationSettings() {
let FormSwitchRow;
let intl;
let obj3;
let obj4;
const channel = this.props.channel;
if (null == channel) {
return null;
} else {
const obj = useChannelName;
const channelName = obj.computeChannelName(channel, UserStore, RelationshipStore);
const obj2 = { children: unpackModuleId(FormSwitchRow, obj3) };
const FormSection = Form2.FormSection;
obj3 = { label: intl.format(intl4.t["u/rEuc"], obj4), value: tmp2, onValueChange: tmp.handleGroupDMMute };
FormSwitchRow = Form2.FormSwitchRow;
intl = intl4.intl;
obj4 = { name: channelName };
return unpackModuleId(FormSection, obj2);
}
}
renderTextChannelNotificationSettings() {
const channel = this.props.channel;
let tmp = null;
if (null != channel) {
const obj = { channelId: channel.id };
tmp = unpackModuleId(ChannelSettingsNotificationsDefault, obj);
}
return tmp;
}
renderChannelNotificationSettings() {
const self = this;
const channel = this.props.channel;
if (null == channel) {
return null;
} else {
const type = channel.type;
if (constants.GROUP_DM === type) {
return self.renderGroupDMNotificationSettings();
} else {
if (constants.GUILD_TEXT !== type) {
if (constants.GUILD_ANNOUNCEMENT !== type) {
if (constants.GUILD_APP !== type) {
return null;
}
}
}
return self.renderTextChannelNotificationSettings();
}
}
}
render() {
let FormRow;
let intl;
let intl2;
let intl3;
let items;
let obj3;
const obj = { children: items };
const Form = Form2.Form;
items = [this.renderChannelNotificationSettings(), , ];
const obj2 = { title: intl.string(intl4.t.clE4PU), children: unpackModuleId(FormRow, obj3) };
const FormSection = Form2.FormSection;
intl = intl4.intl;
obj3 = { label: intl2.string(intl4.t.cHMaba), onPress: this.handleOpenUserSettings, trailing: unpackModuleId(Form2.FormRow.Arrow, {}) };
FormRow = Form2.FormRow;
intl2 = intl4.intl;
items[1] = unpackModuleId(FormSection, obj2);
const obj4 = { children: intl3.string(intl4.t.avgbp1) };
const FormHint = Form2.FormHint;
intl3 = intl4.intl;
items[2] = unpackModuleId(FormHint, obj4);
2026-10-09 10:00:15 +00:00
return authStore2(Form, obj);
2026-10-03 08:58:59 +00:00
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = InAppNotificationSettingsScreen.prototype;
2026-10-03 08:58:59 +00:00
let ReactCompilerGating = ReactCompilerGating_mod;
2026-10-08 09:57:35 +00:00
let closure_14 = ReactCompilerGating.isReactCompilerEnabled() ? (function ConnectedInAppNotificationSettingsScreen(channel) {
2026-10-03 08:58:59 +00:00
let first;
let tmp6;
const obj = channel(576);
const cResult = obj.c(6);
const tmp = channel;
channel = channel.channel;
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
const items = [UserGuildSettingsStore];
cResult[0] = items;
first = items;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
first = cResult[0];
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
if (cResult[1] !== channel) {
const fn = function o() {
let isChannelMutedResult;
if (null != channel) {
if (isMultiUserDM(channel.type)) {
isChannelMutedResult = UserGuildSettingsStore.isChannelMuted(obj.getGuildId(), obj.id);
}
}
return isChannelMutedResult;
};
cResult[1] = channel;
cResult[2] = fn;
tmp6 = fn;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
tmp6 = cResult[2];
}
const tmpResult = tmp(504);
const stateFromStores = tmpResult.useStateFromStores(first, tmp6);
if (cResult[3] === channel) {
let tmp8;
if (cResult[4] === stateFromStores) {
tmp8 = cResult[5];
}
return tmp8;
}
const tmp9 = closure_11(InAppNotificationSettingsScreen, { channel, isMuted: stateFromStores });
cResult[3] = channel;
cResult[4] = stateFromStores;
cResult[5] = tmp9;
tmp8 = tmp9;
2026-10-08 09:57:35 +00:00
}) : (function ConnectedInAppNotificationSettingsScreen(channel) {
2026-10-03 08:58:59 +00:00
channel = channel.channel;
const obj = channel(504);
const items = [UserGuildSettingsStore];
const obj2 = {
channel,
isMuted: obj.useStateFromStores(items, () => {
let isChannelMutedResult;
if (null != channel) {
if (isMultiUserDM(channel.type)) {
isChannelMutedResult = UserGuildSettingsStore.isChannelMuted(obj.getGuildId(), obj.id);
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
return isChannelMutedResult;
})
};
return closure_11(InAppNotificationSettingsScreen, obj2);
});
const memo = react.memo;
ReactCompilerGating = ReactCompilerGating_mod;
2026-10-08 09:57:35 +00:00
const memoResult = memo(ReactCompilerGating.isReactCompilerEnabled() ? (function InAppNotificationSettingsModal(arg0) {
2026-10-03 08:58:59 +00:00
let channelId;
let closure_0;
let obj4;
let onClose;
let tmpResult;
const obj = require("react");
const cResult = obj.c(5);
({ channelId, onClose } = arg0);
if (cResult[0] === channelId) {
let tmp4;
let tmp5;
if (cResult[1] === onClose) {
tmp4 = cResult[2];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
if (cResult[3] !== tmp4) {
const obj2 = { screens: tmp4, initialRouteName: "IN_APP_NOTIFICATION_SETTINGS" };
const tmp7 = closure_11(require("Navigator").Navigator, obj2);
cResult[3] = tmp4;
cResult[4] = tmp7;
tmp5 = tmp7;
} else {
tmp5 = cResult[4];
}
return tmp5;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
_require = ChannelStore.getChannel(channelId);
const obj3 = { IN_APP_NOTIFICATION_SETTINGS: obj4 };
obj4 = {
headerTitle() {
let channelName;
let intl;
const obj = { title: intl.string(channelId(closure_2_2[12]).t.h850Ss), subtitle: channelName };
const NavigatorHeader = channelId(closure_2_2[18]).NavigatorHeader;
intl = channelId(closure_2_2[12]).intl;
channelName = null;
const tmp2 = closure_2_11;
const tmp3 = channelId;
const tmp4 = closure_2_2;
if (null != channel) {
const tmp3Result = tmp3(tmp4[10]);
channelName = tmp3Result.computeChannelName(tmp, closure_2_8, closure_2_6, true);
}
return tmp2(NavigatorHeader, obj);
},
headerLeft: tmpResult.getHeaderCloseButton(onClose),
render() {
const obj = { channel };
return closure_2_11(closure_2_14, obj);
}
};
cResult[0] = channelId;
cResult[1] = onClose;
cResult[2] = obj3;
tmp4 = obj3;
tmpResult = require("NavigatorHeader");
2026-10-08 09:57:35 +00:00
}) : (function InAppNotificationSettingsModal(channelId) {
2026-07-20 16:05:17 +00:00
channelId = channelId.channelId;
const onClose = channelId.onClose;
const items = [channelId, onClose];
2026-10-03 08:58:59 +00:00
const screens = react.useMemo(() => {
let obj2;
let obj3;
const channel = ChannelStore.getChannel(channelId);
2026-10-03 08:58:59 +00:00
let obj = { IN_APP_NOTIFICATION_SETTINGS: obj2 };
obj2 = {
2026-07-29 08:29:29 +00:00
headerTitle() {
2026-10-03 08:58:59 +00:00
let channelName;
let intl;
const obj = { title: intl.string(channelId(closure_2_2[12]).t.h850Ss), subtitle: channelName };
const NavigatorHeader = channelId(closure_2_2[18]).NavigatorHeader;
intl = channelId(closure_2_2[12]).intl;
channelName = null;
const tmp2 = closure_2_11;
const tmp3 = channelId;
const tmp4 = closure_2_2;
if (null != channel) {
const tmp3Result = tmp3(tmp4[10]);
channelName = tmp3Result.computeChannelName(tmp, closure_2_8, closure_2_6, true);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp2(NavigatorHeader, obj);
2026-07-29 08:29:29 +00:00
},
2026-10-03 08:58:59 +00:00
headerLeft: obj3.getHeaderCloseButton(onClose),
2026-08-24 06:08:38 +00:00
render() {
2026-10-03 08:58:59 +00:00
const obj = { channel };
return closure_2_11(closure_2_14, obj);
2026-08-24 06:08:38 +00:00
}
2026-07-29 08:29:29 +00:00
};
2026-10-03 08:58:59 +00:00
obj3 = NavigatorHeader2;
2026-07-29 08:29:29 +00:00
return obj;
}, items);
2026-10-12 06:59:38 +00:00
return closure_11(channelId(6688).Navigator, { screens, initialRouteName: "IN_APP_NOTIFICATION_SETTINGS" });
2026-10-03 08:58:59 +00:00
}));
let result = size.fileFinishedImporting("components_native/InAppNotificationSettingsModal.tsx");
export default memoResult;