decord/alpha/source/components_native/InAppNotificationSettingsModal.tsx

165 lines
6.4 KiB
TypeScript
Raw Normal View History

// Module ID: 10395
// Function ID: 10396
// Name: InAppNotificationSettingsModal
// Dependencies: [19, 2045, 2041, 4405, 4937, 1372, 1074, 21, 7364, 7359, 4909, 8871, 1115, 10396, 7624, 504, 5841, 7245, 2]
2026-07-20 16:05:17 +00:00
// Module 10395 (InAppNotificationSettingsModal)
import util from "util" /* 1115 */;
import useChannelName from "useChannelName" /* 4909 */;
import NavigatorHeader from "NavigatorHeader" /* 5841 */;
import NotificationSettingsUtils from "NotificationSettingsUtils" /* 7359 */;
import NotificationSettingsModalActionCreatorsDefault from "NotificationSettingsModalActionCreators" /* 7364 */;
import Form from "Form" /* 8871 */;
import ChannelSettingsNotificationsDefault from "ChannelSettingsNotifications" /* 10396 */;
import noop from "module_19" /* 19 */;
import ChannelStore from "ChannelStore" /* 2041 */;
import RelationshipStore from "RelationshipStore" /* 4405 */;
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 4937 */;
import UserStore from "UserStore" /* 1372 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function ConnectedInAppNotificationSettingsScreen(channel) {
channel = channel.channel;
const items = [UserGuildSettingsStore];
const obj = channel(504);
return closure_11(InAppNotificationSettingsScreen, {
2026-07-20 16:05:17 +00:00
channel,
isMuted: channel(504).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
let isChannelMutedResult;
if (null != channel) {
if (isMultiUserDM(obj.type)) {
isChannelMutedResult = UserGuildSettingsStore.isChannelMuted(obj.getGuildId(), obj.id);
2026-07-20 16:05:17 +00:00
}
}
return isChannelMutedResult;
})
});
2026-07-20 16:05:17 +00:00
}
const isMultiUserDM = fn(2045).isMultiUserDM;
const Constants = fn(1074);
({ ChannelTypes: closure_9, UserSettingsSections: c10 } = Constants);
const jsxProd = fn(21);
({ jsx: closure_11, jsxs: closure_12 } = jsxProd);
const PureComponent = noop.PureComponent;
2026-07-29 08:29:29 +00:00
class InAppNotificationSettingsScreen extends PureComponent {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
closure_0 = applyArgumentsResult;
applyArgumentsResult.handleGroupDMMute = function handleGroupDMMute() {
({ channel, isMuted } = applyArgumentsResult.props);
if (null != channel) {
const obj = NotificationSettingsModalActionCreatorsDefault;
2026-07-29 08:29:29 +00:00
const guildId = channel.getGuildId();
const obj2 = { muted: !isMuted };
const NotificationLabel = NotificationSettingsUtils.NotificationLabel;
const result = obj.updateChannelOverrideSettings(guildId, channel.id, obj2, NotificationLabel.muted(!isMuted));
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
applyArgumentsResult.handleOpenUserSettings = function handleOpenUserSettings() {
applyArgumentsResult(dependencyMap[14]).openUserSettings({ screen: constants.NOTIFICATIONS });
2026-07-29 08:29:29 +00:00
};
return applyArgumentsResult;
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = InAppNotificationSettingsScreen.prototype;
prototype["renderGroupDMNotificationSettings"] = function renderGroupDMNotificationSettings() {
const channel = this.props.channel;
if (null == channel) {
return null;
} else {
const channelName = useChannelName.computeChannelName(channel, UserStore, RelationshipStore);
const obj2 = { children: null };
const obj3 = { label: null, value: null, onValueChange: null };
const intl = util.intl;
const obj4 = { name: channelName };
obj3.label = intl.format(util.t["u/rEuc"], obj4);
obj3.value = tmp2;
obj3.onValueChange = tmp.handleGroupDMMute;
obj2.children = closure_1_11(Form.FormSwitchRow, obj3);
return closure_1_11(Form.FormSection, obj2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
prototype["renderTextChannelNotificationSettings"] = function renderTextChannelNotificationSettings() {
const channel = this.props.channel;
let tmp = null;
if (null != channel) {
const obj = { channelId: channel.id };
tmp = closure_1_11(ChannelSettingsNotificationsDefault, obj);
2026-07-29 08:29:29 +00:00
}
return tmp;
};
prototype["renderChannelNotificationSettings"] = function 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 (tmp.GUILD_TEXT !== type) {
if (tmp.GUILD_ANNOUNCEMENT !== type) {
2026-09-02 09:53:35 +00:00
if (tmp.GUILD_APP !== type) {
return null;
}
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return self.renderTextChannelNotificationSettings();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
};
prototype["render"] = function render() {
const obj = { children: null };
2026-07-29 08:29:29 +00:00
const items = [this.renderChannelNotificationSettings(), , ];
const obj2 = { title: null, children: null };
const intl = util.intl;
obj2.title = intl.string(util.t.clE4PU);
const obj3 = { label: null, onPress: null, trailing: null };
const intl2 = util.intl;
obj3.label = intl2.string(util.t.cHMaba);
obj3.onPress = this.handleOpenUserSettings;
obj3.trailing = closure_1_11(Form.FormRow.Arrow, {});
obj2.children = closure_1_11(Form.FormRow, obj3);
items[1] = closure_1_11(Form.FormSection, obj2);
const obj4 = { children: null };
const intl3 = util.intl;
obj4.children = intl3.string(util.t.avgbp1);
items[2] = closure_1_11(Form.FormHint, obj4);
obj.children = items;
return closure_1_12(Form.Form, obj);
2026-07-29 08:29:29 +00:00
};
const size = fn(2);
let result = size.fileFinishedImporting("components_native/InAppNotificationSettingsModal.tsx");
export default noop.memo((channelId) => {
2026-07-20 16:05:17 +00:00
channelId = channelId.channelId;
const onClose = channelId.onClose;
const items = [channelId, onClose];
const screens = noop.useMemo(() => {
const channel = ChannelStore.getChannel(channelId);
2026-07-29 08:29:29 +00:00
let obj = { IN_APP_NOTIFICATION_SETTINGS: null };
const obj2 = {
2026-07-29 08:29:29 +00:00
headerTitle() {
const obj = { title: null, subtitle: null };
const intl = channelId(1115).intl;
obj.title = intl.string(channelId(1115).t.h850Ss);
2026-07-29 08:29:29 +00:00
let channelName = null;
if (null != closure_0) {
const tmp3Result = channelId(4909);
channelName = tmp3Result.computeChannelName(tmp, UserStore, RelationshipStore, true);
2026-07-29 08:29:29 +00:00
}
obj.subtitle = channelName;
return closure_2_11(channelId(5841).NavigatorHeader, obj);
2026-07-29 08:29:29 +00:00
},
headerLeft: NavigatorHeader.getHeaderCloseButton(onClose),
2026-08-24 06:08:38 +00:00
render() {
return closure_2_11(ConnectedInAppNotificationSettingsScreen, { channel });
2026-08-24 06:08:38 +00:00
}
2026-07-29 08:29:29 +00:00
};
obj.IN_APP_NOTIFICATION_SETTINGS = obj2;
2026-07-29 08:29:29 +00:00
return obj;
}, items);
return closure_11(channelId(7245).Navigator, { screens, initialRouteName: "IN_APP_NOTIFICATION_SETTINGS" });
2026-07-20 16:05:17 +00:00
});