This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,92 @@
// Metro module 16632 (f16633).
import * as Module19 from "react";
import { useState, useMemo, useEffect, useCallback } from "react";
import { View } from "react-native";
import { isGuildReadableType } from "../../../records/ChannelRecord";
import GuildCategoryStore from "../../../stores/GuildCategoryStore";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserStore from "../../../stores/UserStore";
import { ChannelTypes, NotificationSettingsSections } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores } from "../../../_bundle/Module589";
import useSafeAreaInsetsKeyboardAware_native from "../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import getFlattedChannelList from "../../channel/getFlattedChannelList";
import { computeChannelName } from "../../channel/useChannelName";
import fuzzysearch from "../../../_bundle/fuzzysearch";
import { intl, t } from "../../../intl/index.native";
import { AccessibilityAnnouncer } from "../../../_bundle/Module3902";
import useScaledRowHeight from "../../main_tabs_v2/native/shared_components/user_list/useScaledRowHeight";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import { TableRowIcon } from "../../../design/components/TableRow/native/TableRowIcon.native";
import { getChannelIconComponent } from "../../../utils/native/ChannelUtils";
import useFastestListTableRowPlaceholderConfig_native from "../../fastest_list/placeholders/useFastestListTableRowPlaceholderConfig.native";
import { SearchField } from "../../../design/components/TextField/native/SearchField.native";
import { EmptyState } from "../../../design/void/native";
import { NoResults } from "../../../design/components/Illustration/native/redesign/generated/NoResults";
import FastestList_android from "../../fastest_list/FastestList.android";
const useStyles = createStyles({
container: {
marginHorizontal: Module712.space.PX_8,
flex: 1
},
searchContainer: {
paddingVertical: Module712.space.PX_16
}
});
const r54 = Module19.memo(function NotificationSettingChannelOverrides(props) {
let state, channels;
const { guildId, navigation } = props;
state = void 0;
channels = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([GuildCategoryStore], () => GuildCategoryStore.getCategories(guildId));
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
let onChange;
[state, onChange] = useState("");
const memo = useMemo(() => {
const channels2 = getFlattedChannelList(stateFromStores._categories, stateFromStores, ({ channel }) => {
const r14 = isGuildReadableType(channel.type) || channel.type === ChannelTypes.GUILD_CATEGORY && stateFromStores[channel.id] != null && stateFromStores[channel.id].length > 0;
if (r14) {
if (state !== "" && state != null) {
const r34 = computeChannelName(channel, UserStore, RelationshipStore).toLowerCase();
return fuzzysearch(state.toLowerCase(), r34);
}
return r14;
}
return false;
}).map((item) => item.channel);
return {
channels: channels2,
sections: [channels2.length]
};
}, [stateFromStores, state]);
channels = memo.channels;
const sections = memo.sections;
useEffect(() => {
if (state != null && state !== "") {
const length = channels.length;
AccessibilityAnnouncer.announce(length > 0 ? intl.formatToPlainString(t.ZGVL3g, {
count: length
}) : intl.string(t.f5cMAg));
}
}, [channels, state]);
const scaledRowHeight = useScaledRowHeight();
const callback = useCallback((a0, a1) => {
const r11 = channels[a1];
let c28470_0 = r11;
return <TableRow icon={<TableRowIcon IconComponent={getChannelIconComponent(r11)} />} start={a1 === 0} end={a1 === channels.length - 1} label={computeChannelName(r11, UserStore, RelationshipStore)} labelLineClamp={1} arrow onPress={() => {
navigation.push(NotificationSettingsSections.CHANNEL_OVERRIDE, {
channelId: c28470_0.id
});
}} />;
}, [channels, navigation]);
const fastestListTableRowPlaceholderConfig_native = useFastestListTableRowPlaceholderConfig_native();
return <View style={styles.container}>
<View style={styles.searchContainer}>
<SearchField placeholder={intl.string(t["5h0QOP"])} onChange={onChange} />
</View>
{channels.length === 0 ? <EmptyState Illustration={NoResults} title={intl.string(t.wM7uRI)} body={intl.string(t.f5cMAg)} /> : <FastestList_android sections={sections} renderItem={callback} itemSize={scaledRowHeight} insetEnd={insets.bottom} estimatedListSize="windowSize" placeholderConfig={fastestListTableRowPlaceholderConfig_native} wrapChildren />}
</View>;
});
export default r54;
@@ -0,0 +1,359 @@
// Metro module 16631 (f16632).
import _objectWithoutProperties from "../../../_bundle/_objectWithoutProperties";
import { useMemo, PureComponent } from "react";
import { View } from "react-native";
import { isGuildReadableType } from "../../../records/ChannelRecord";
import ChannelStore from "../../../stores/ChannelStore";
import GuildCategoryStore from "../../../stores/GuildCategoryStore";
import GuildMemberCountStore from "../../../stores/GuildMemberCountStore";
import GuildStore from "../../../stores/GuildStore";
import NotificationSettingsModalStore from "../../../stores/NotificationSettingsModalStore";
import RelationshipStore from "../../../stores/RelationshipStore";
import UserGuildSettingsStore from "../../../stores/UserGuildSettingsStore";
import UserStore from "../../../stores/UserStore";
import { AnalyticEvents, ChannelTypes, EMPTY_STRING_SNOWFLAKE_ID, GuildFeatures, HelpdeskArticles, HighlightSettings, MAX_MEMBERS_NOTIFY_ALL_MESSAGES, NotificationSettingsSections, SettingsPaneTypes, UserNotificationSettings } from "../../../Constants";
import { createLegacyClassComponentStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { ThemeContext } from "../../../_bundle/Module3901";
import AppAnalyticsUtils from "../../app_analytics/AppAnalyticsUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import NotificationSettingsModalActionCreators from "../../../actions/NotificationSettingsModalActionCreators";
import { NotificationLabel } from "../../../utils/NotificationSettingsUtils";
import { NotificationSettingsGuildPresets } from "../../notifications/settings/native/NotificationSettingsPresets";
import { NotificationSettingsGuildMessageNotification } from "../../notifications/settings/native/NotificationSettingsMessageNotification";
import { NotificationSettingsGuildMessageUnread } from "../../notifications/settings/native/NotificationSettingsMessageUnread";
import { TableRadioGroup } from "../../../design/components/TableRow/native/TableRadioGroup.native";
import { intl, t } from "../../../intl/index.native";
import { TableRadioRow } from "../../../design/components/TableRow/native/TableRadioRow.native";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableSwitchRow } from "../../../design/components/TableRow/native/TableSwitchRow.native";
import { Text } from "../../../design/components/Text/native/Text";
import { LegacyText } from "../../../design/void/native";
import Linking from "../../../lib/native/Linking";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import { NotificationSettingsMuteBanner, getMuteBannerSubtitleFromConfig } from "../../notifications/settings/native/NotificationSettingsMuteBanner";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import MutedUntilText, { MuteSettingType } from "../../main_tabs_v2/native/sidebar/details/screens/MutedUntilText";
import { TableRowIcon } from "../../../design/components/TableRow/native/TableRowIcon.native";
import { PlusMediumIcon } from "../../../design/components/Icon/native/redesign/generated/PlusMediumIcon";
import { computeIsMuted } from "../../../lib/MuteTimers";
import { presetName, presetFromSettings } from "../../notifications/settings/utils/notificationSettingsPresetUtils";
import { getChannelIconComponent } from "../../../utils/native/ChannelUtils";
import { computeChannelName } from "../../channel/useChannelName";
import { Form } from "../../../design/void/Form/native/index";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import { useShouldUseNewNotificationSystem, filterOverrides } from "../../notifications/NotificationUtils";
import { useNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
import { useStateFromStoresObject, useStateFromStores } from "../../../_bundle/Module589";
import getFlattedChannelList from "../../channel/getFlattedChannelList";
import { NavScrim } from "../../../design/components/Navigator/native/NavScrim.android";
import { getHeaderCloseButton, getHeaderBackButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import NotificationSettingChannelOverrides_native from "./NotificationSettingChannelOverrides.native";
import ChannelSettingsNotifications from "../../../components_native/channel_settings/ChannelSettingsNotifications";
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
let _excluded, styles;
const ConnectedNotificationSettings = function ConnectedNotificationSettings(props) {
let categories;
const guildId = props.guildId;
categories = void 0;
const navigation = useNavigation();
const stateFromStoresObject = useStateFromStoresObject([UserGuildSettingsStore, GuildStore, GuildCategoryStore, GuildMemberCountStore], () => ({
guild: GuildStore.getGuild(guildId),
suppressEveryone: UserGuildSettingsStore.isSuppressEveryoneEnabled(guildId),
suppressRoles: UserGuildSettingsStore.isSuppressRolesEnabled(guildId),
mobilePush: UserGuildSettingsStore.isMobilePushEnabled(guildId),
muteEvents: UserGuildSettingsStore.isMuteScheduledEventsEnabled(guildId),
muted: UserGuildSettingsStore.isMuted(guildId),
muteConfig: UserGuildSettingsStore.getMuteConfig(guildId),
messageNotifications: UserGuildSettingsStore.getMessageNotifications(guildId),
channelOverrides: UserGuildSettingsStore.getChannelOverrides(guildId),
categories: GuildCategoryStore.getCategories(guildId),
guildMemberCount: GuildMemberCountStore.getMemberCount(guildId),
notifyHighlights: UserGuildSettingsStore.getNotifyHighlights(guildId)
}));
categories = stateFromStoresObject.categories;
const rest = _objectWithoutProperties(stateFromStoresObject, _excluded);
return <>
<NotificationSettings guildId={guildId} channels={useMemo(() => getFlattedChannelList(categories._categories, categories, (a0) => {
const type = a0.channel.type;
return isGuildReadableType(type) || type === ChannelTypes.GUILD_CATEGORY;
}), [categories])} navigation={navigation} shouldUseNewNotificationSystem={useShouldUseNewNotificationSystem("NotificationSettingsModalNative")} {...rest} />
<NavScrim />
</>;
};
_excluded = ["categories"];
styles = createLegacyClassComponentStyles({
highlightsLearnMore: {
fontSize: 12,
color: Module712.unsafe_rawColors.BLUE_345,
marginTop: 4
},
separator: {
height: 1,
backgroundColor: Module712.colors.BORDER_SUBTLE,
marginVertical: 24
},
formStack: {
paddingHorizontal: Module712.modules.mobile.TABLE_ROW_PADDING
}
});
class NotificationSettings extends PureComponent {
static contextType = ThemeContext;
handleMutePress = () => {
const props = this.props;
const { guildId: guildId3, muted } = props;
if (muted) {
NotificationSettingsModalActionCreators.updateGuildNotificationSettings(guildId3, {
muted: !muted
}, NotificationLabel.muted(!muted));
} else {
ActionSheetActionCreators.openLazy(import("../../main_tabs_v2/native/sidebar/details/screens/MuteSettingsActionSheet"), `muteSettings${guildId3}`, {
guildId: guildId3
});
}
};
handleToggleChange = (a0, a1, a2) => {
const guildId3 = this.props.guildId;
const r12 = {};
r12[a0] = a1;
NotificationSettingsModalActionCreators.updateGuildNotificationSettings(guildId3, r12, a2);
};
handleTypeChange = (a0) => {
NotificationSettingsModalActionCreators.updateGuildNotificationSettings(this.props.guildId, {
message_notifications: a0
}, NotificationLabel.notifications(a0));
};
handleAddOverride = () => {
const props = this.props;
props.navigation.push(NotificationSettingsSections.ADD_OVERRIDE, {
guildId: props.guildId
});
};
handleChannelSelect = (a0) => {
this.props.navigation.push(NotificationSettingsSections.CHANNEL_OVERRIDE, {
channelId: a0
});
};
componentDidMount() {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SETTINGS_PANE_VIEWED, {
settings_type: "guild",
destination_pane: SettingsPaneTypes.GUILD_NOTIFICATION_SETTINGS
});
}
renderServerSettings() {
const props = this.props;
const { messageNotifications, muted, guildMemberCount, shouldUseNewNotificationSystem } = props;
const r11 = styles(this.context);
return shouldUseNewNotificationSystem ? <>
<View>
<NotificationSettingsGuildPresets guildId={this.props.guildId} />
<NotificationSettingsGuildMessageNotification style={{
marginTop: 24
}} guildId={this.props.guildId} />
<NotificationSettingsGuildMessageUnread style={{
marginTop: 24
}} guildId={this.props.guildId} />
</View>
<View style={r11.separator} />
</> : <TableRadioGroup title={intl.string(t.lprV7V)} value={messageNotifications} onChange={this.handleTypeChange} hasIcons={false}>
<TableRadioRow label={intl.string(t["n/bTaY"])} disabled={muted} value={UserNotificationSettings.ALL_MESSAGES} subLabel={guildMemberCount != null ? guildMemberCount >= MAX_MEMBERS_NOTIFY_ALL_MESSAGES ? intl.string(t.Dh5p5j) : null : null} />
<TableRadioRow label={intl.format(t.L2hmYy, {})} value={UserNotificationSettings.ONLY_MENTIONS} disabled={muted} />
<TableRadioRow label={intl.string(t.CtVGyQ)} value={UserNotificationSettings.NO_MESSAGES} disabled={muted} />
</TableRadioGroup>;
}
renderNotificationOptions() {
const r18 = styles(this.context);
const props = this.props;
const muted = props.muted;
let suppressEveryone = props.suppressEveryone;
let suppressRoles = props.suppressRoles;
let mobilePush = props.mobilePush;
let muteEvents = props.muteEvents;
const { notifyHighlights, guildId: guildId2 } = props;
const props2 = {
label: intl.format(t.OWiWAp, {}),
value: null,
onValueChange: null
};
if (suppressEveryone == null) {
suppressEveryone = false;
}
props2.value = suppressEveryone;
props2.onValueChange = (a0) => {
this.handleToggleChange("suppress_everyone", a0, NotificationLabel.suppressEveryone(a0));
};
const r42 = [<TableSwitchRow {...props2} />, , ,];
const props3 = {
label: intl.string(t["O/QdoD"]),
value: null,
onValueChange: null
};
if (suppressRoles == null) {
suppressRoles = false;
}
props3.value = suppressRoles;
props3.onValueChange = (a0) => {
this.handleToggleChange("suppress_roles", a0, NotificationLabel.suppressRoles(a0));
};
r42[1] = <TableSwitchRow {...props3} />;
r42[2] = <TableSwitchRow disabled={muted} label={intl.string(t.gPuteJ)} value={muted || notifyHighlights === HighlightSettings.DISABLED} onValueChange={(value) => {
NotificationSettingsModalActionCreators.updateGuildNotificationSettings(guildId2, {
notify_highlights: value ? HighlightSettings.DISABLED : HighlightSettings.ENABLED
}, NotificationLabel.highlights(!value));
}} />;
const r112 = [<View>
<TableRowGroup hasIcons={false}>{r42}</TableRowGroup>
<Text variant="text-sm/medium" color="text-muted" style={{
marginTop: 8
}}>
{intl.string(t["Vw/Xn8"])}
</Text>
<LegacyText style={r18.highlightsLearnMore} accessibilityRole="link" onPress={() => Linking.openURL(HelpdeskUtils.getArticleURL(HelpdeskArticles.HIGHLIGHTS))}>
{intl.string(t.PRBn9K)}
</LegacyText>
</View>, ,];
const props4 = {
label: intl.string(t.ONG3Yz),
value: null,
onValueChange: null
};
if (muteEvents == null) {
muteEvents = false;
}
props4.value = muteEvents;
props4.onValueChange = (a0) => {
this.handleToggleChange("mute_scheduled_events", a0, NotificationLabel.mutedEvents(a0));
};
const r131 = [<TableSwitchRow {...props4} />, ,];
const props5 = {
disabled: muted,
label: intl.string(t.h1DL66),
value: null,
onValueChange: null
};
let value = !muted;
if (!muted) {
if (mobilePush == null) {
mobilePush = false;
}
value = mobilePush;
}
props5.value = value;
props5.onValueChange = (a0) => {
this.handleToggleChange("mobile_push", a0, NotificationLabel.mobilePush(a0));
};
r131[1] = <TableSwitchRow {...props5} />;
r112[1] = <TableRowGroup hasIcons={false}>{r131}</TableRowGroup>;
return <>{r112}</>;
}
renderMuteSection() {
const props = this.props;
const { muted, muteConfig, guild } = props;
if (props.shouldUseNewNotificationSystem) {
return muted ? <NotificationSettingsMuteBanner title={intl.string(t.ZSkXJY)} subtitle={getMuteBannerSubtitleFromConfig(muteConfig)} style={{
marginBottom: 16
}} onPressUnmute={this.handleMutePress} /> : null;
}
const label = muted ? intl.format(t.e8hzDQ, {
name: guild?.name
}) : intl.format(t["J+7D9E"], {
name: guild?.name
});
return [<TableRowGroup key="mute" helperText={intl.string(t["8wbTQ6"])} hasIcons={false}>
<TableRow label={label} onPress={this.handleMutePress} arrow={!muted} />
</TableRowGroup>, muted ? <MutedUntilText key="muted-until" muteConfig={muteConfig} type={MuteSettingType.SERVER} /> : null];
}
renderChannels() {
return [<TableRowGroup key="override-header" title={intl.string(t.O4TIvi)} hasIcons>
<TableRow icon={<TableRowIcon IconComponent={PlusMediumIcon} />} label={intl.string(t.quib7R)} onPress={this.handleAddOverride} />
</TableRowGroup>, <TableRowGroup key="override-channels" hasIcons>
{this.getOverriddenChannels().map((item) => this.renderChannel(item))}
</TableRowGroup>];
}
renderChannel(a0) {
let text;
if (a0 != null) {
const r18 = this.props.channelOverrides[a0.id];
const r15 = a0.parent_id != null ? ChannelStore.getChannel(a0.parent_id) : void 0;
if (computeIsMuted(r18)) {
text = intl.string(t.fpKdS1);
} else {
const message_notifications = r18.message_notifications;
text = UserNotificationSettings.ALL_MESSAGES === message_notifications ? intl.string(t["n/bTaY"]) : UserNotificationSettings.ONLY_MENTIONS === message_notifications ? intl.string(t["6fQPhu"]) : UserNotificationSettings.NO_MESSAGES === message_notifications ? intl.string(t.CtVGyQ) : void 0;
}
if (this.props.shouldUseNewNotificationSystem) {
text = presetName(presetFromSettings(UserGuildSettingsStore.resolveUnreadSetting(a0), UserGuildSettingsStore.resolvedMessageNotifications(a0)));
}
return <TableRow key={a0.id} icon={<TableRowIcon IconComponent={getChannelIconComponent(a0)} />} label={computeChannelName(a0, UserStore, RelationshipStore)} onPress={() => this.handleChannelSelect(a0.id)} subLabel={r15 != null ? computeChannelName(r15, UserStore, RelationshipStore) : null} trailing={text != null ? <TableRow.TrailingText text={text} /> : void 0} arrow />;
}
}
render() {
let r44;
const guild = this.props.guild;
const r8 = styles(this.context);
const r17 = guild == null ? void 0 : guild.features.has(GuildFeatures.HUB);
const props = {
contentContainerStyle: {
paddingTop: 16
},
children: null
};
if (r17) {
props.children = <Stack spacing={Module712.space.PX_24} style={r8.formStack}>
{this.renderMuteSection()}
</Stack>;
r44 = <Form {...props} />;
} else {
props.children = <Stack spacing={Module712.space.PX_24} style={r8.formStack}>
{this.renderMuteSection()}
{this.renderServerSettings()}
{this.renderNotificationOptions()}
{this.renderChannels()}
</Stack>;
r44 = <Form {...props} />;
}
return r44;
}
getOverriddenChannels() {
const props = this.props;
const channels = props.channels;
let c23346_0 = new Set(filterOverrides(props.channelOverrides, {
ignoreNotificationSetting: false,
ignoreMute: this.props.shouldUseNewNotificationSystem,
ignoreUnreadSetting: !this.props.shouldUseNewNotificationSystem
}));
return channels.map(({ channel }) => c23346_0.has(channel.id) ? channel : null).filter((item) => item != null);
}
}
export default function NotificationSettingsModal() {
let guildId3 = useStateFromStores([NotificationSettingsModalStore], () => NotificationSettingsModalStore.getProps().guildId);
const memo = useMemo(() => {
const r1 = {};
r1[NotificationSettingsSections.OVERVIEW] = {
headerLeft: getHeaderCloseButton(NotificationSettingsModalActionCreators.close),
title: intl.string(t.h850Ss),
render: (a0) => <ConnectedNotificationSettings guildId={a0.guildId} />
};
r1[NotificationSettingsSections.ADD_OVERRIDE] = {
title: intl.string(t.s7vIQT),
headerLeft: getHeaderBackButton(),
render: (a0, a1) => <NotificationSettingChannelOverrides_native guildId={a0.guildId} navigation={a1} />
};
r1[NotificationSettingsSections.CHANNEL_OVERRIDE] = {
headerLeft: getHeaderBackButton(),
title: intl.string(t.h850Ss),
render: (a0) => <ChannelSettingsNotifications channelId={a0.channelId} inGuildContext />
};
return r1;
}, []);
if (guildId3 == null) {
guildId3 = EMPTY_STRING_SNOWFLAKE_ID;
}
return <Navigator screens={memo} initialRouteStack={[{
name: NotificationSettingsSections.OVERVIEW,
params: {
guildId: guildId3
}
}]} />;
};
export { NotificationSettings };