decord/beta/source/components_native/InAppNotificationSettingsModal.tsx
github-actions 84d017ff78 chore: update source for beta 348.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-28 16:18:32 +00:00

165 lines
6.5 KiB
TypeScript

// Module ID: 9598
// Function ID: 9599
// Name: InAppNotificationSettingsModal
// Dependencies: [19, 2049, 2045, 4479, 5017, 1372, 1074, 21, 6540, 6535, 4989, 8053, 1115, 9599, 6800, 504, 5936, 6421, 2]
// Module 9598 (InAppNotificationSettingsModal)
import util from "util" /* 1115 */;
import useChannelName from "useChannelName" /* 4989 */;
import NavigatorHeader from "NavigatorHeader" /* 5936 */;
import NotificationSettingsUtils from "NotificationSettingsUtils" /* 6535 */;
import NotificationSettingsModalActionCreatorsDefault from "NotificationSettingsModalActionCreators" /* 6540 */;
import Form from "Form" /* 8053 */;
import ChannelSettingsNotificationsDefault from "ChannelSettingsNotifications" /* 9599 */;
import noop from "module_19" /* 19 */;
import ChannelStore from "ChannelStore" /* 2045 */;
import RelationshipStore from "RelationshipStore" /* 4479 */;
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 5017 */;
import UserStore from "UserStore" /* 1372 */;
require = fn;
function ConnectedInAppNotificationSettingsScreen(channel) {
channel = channel.channel;
const items = [UserGuildSettingsStore];
const obj = channel(504);
return closure_11(InAppNotificationSettingsScreen, {
channel,
isMuted: channel(504).useStateFromStores(items, () => {
let isChannelMutedResult;
if (null != channel) {
if (isMultiUserDM(obj.type)) {
isChannelMutedResult = UserGuildSettingsStore.isChannelMuted(obj.getGuildId(), obj.id);
}
}
return isChannelMutedResult;
})
});
}
const isMultiUserDM = fn(2049).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;
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 obj2 = { guildId: channel.getGuildId(), channelId: channel.id, settings: null, label: null };
const obj3 = { muted: !isMuted };
obj2.settings = obj3;
const NotificationLabel = NotificationSettingsUtils.NotificationLabel;
obj2.label = NotificationLabel.muted(!isMuted);
const result = NotificationSettingsModalActionCreatorsDefault.updateChannelOverrideSettings(obj2);
}
};
applyArgumentsResult.handleOpenUserSettings = function handleOpenUserSettings() {
applyArgumentsResult(dependencyMap[14]).openUserSettings({ screen: constants.NOTIFICATIONS });
};
return applyArgumentsResult;
}
}
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);
}
};
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);
}
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) {
if (tmp.GUILD_APP !== type) {
return null;
}
}
}
return self.renderTextChannelNotificationSettings();
}
}
};
prototype["render"] = function render() {
const obj = { children: null };
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);
};
const size = fn(2);
let result = size.fileFinishedImporting("components_native/InAppNotificationSettingsModal.tsx");
export default noop.memo((channelId) => {
channelId = channelId.channelId;
const onClose = channelId.onClose;
const items = [channelId, onClose];
const screens = noop.useMemo(() => {
const channel = ChannelStore.getChannel(channelId);
let obj = { IN_APP_NOTIFICATION_SETTINGS: null };
const obj2 = {
headerTitle() {
const obj = { title: null, subtitle: null };
const intl = channelId(1115).intl;
obj.title = intl.string(channelId(1115).t.h850Ss);
let channelName = null;
if (null != closure_0) {
const tmp3Result = channelId(4989);
channelName = tmp3Result.computeChannelName(tmp, UserStore, RelationshipStore, true);
}
obj.subtitle = channelName;
return closure_2_11(channelId(5936).NavigatorHeader, obj);
},
headerLeft: NavigatorHeader.getHeaderCloseButton(onClose),
render() {
return closure_2_11(ConnectedInAppNotificationSettingsScreen, { channel });
}
};
obj.IN_APP_NOTIFICATION_SETTINGS = obj2;
return obj;
}, items);
return closure_11(channelId(6421).Navigator, { screens, initialRouteName: "IN_APP_NOTIFICATION_SETTINGS" });
});