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,181 @@
// Metro module 15329 (f15330).
import { useState, useCallback } from "react";
import { View } from "react-native";
import UserGuildSettingsStore from "../../../../stores/UserGuildSettingsStore";
import ICYMIStore from "../../ICYMIStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { ICYMICustomScore, numberToCustomScore, customScoreToNumber } from "../../ICYMIUtils";
import { intl, t } from "../../../../intl/index.native";
import { Icon } from "../../../../design/void/native";
import Module15330 from "../../../../_bundle/Module15330";
import Module15331 from "../../../../_bundle/Module15331";
import Module15332 from "../../../../_bundle/Module15332";
import { useSegmentedControlState } from "../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
import { SegmentedControl } from "../../../../design/components/SegmentedControl/native/SegmentedControl.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import NativeICYMIActionCreators from "../NativeICYMIActionCreators";
import { Text } from "../../../../design/components/Text/native/Text";
import { TableSwitchRow } from "../../../../design/components/TableRow/native/TableSwitchRow.native";
import useChannelName from "../../../channel/useChannelName";
let useStyles;
const ContentSettingsControl = function ContentSettingsControl(props) {
const { initialValue, onValueUpdated, disabled } = props;
const styles = useStyles();
const [state, setState] = useState(initialValue);
const items = [{
label: intl.string(t.rdt65I),
id: "-1",
icon: <Icon source={Module15330} style={[styles.icon, state === ICYMICustomScore.LESS ? styles.iconSelected : null]} />,
page: null
}, , ,];
items[1] = {
label: intl.string(t.SnrG00),
id: "0",
icon: <Icon source={Module15331} style={[styles.icon, state === ICYMICustomScore.DEFAULT ? styles.iconSelected : null]} />,
page: null
};
items[2] = {
label: intl.string(t.Rxe3jF),
id: "1",
icon: <Icon source={Module15332} style={[styles.icon, state === ICYMICustomScore.MORE ? styles.iconSelected : null]} />,
page: null
};
return <View style={disabled ? {
opacity: 0.7
} : null} pointerEvents={disabled ? "none" : "auto"}>
<SegmentedControl variant="experimental_Large" state={useSegmentedControlState({
pageWidth: 0,
onSetActiveIndex: (a0) => {
let DEFAULT = ICYMICustomScore.DEFAULT;
if (a0 === 0) {
DEFAULT = ICYMICustomScore.LESS;
} else if (a0 === 2) {
DEFAULT = ICYMICustomScore.MORE;
}
setState(DEFAULT);
onValueUpdated(DEFAULT);
},
items,
defaultIndex: ICYMICustomScore.LESS !== state ? ICYMICustomScore.MORE === state ? 2 : 1 : 0
})} />
</View>;
};
useStyles = createStyles({
customScoreWrapper: {
marginVertical: Module712.space.PX_16
},
warningText: {
marginTop: Module712.space.PX_8,
marginHorizontal: Module712.space.PX_12
},
icon: {
width: 24,
height: 24,
tintColor: Module712.colors.TEXT_MUTED
},
iconSelected: {
tintColor: Module712.colors.INTERACTIVE_TEXT_ACTIVE
},
muted: {
marginTop: Module712.space.PX_16
}
});
export function GuildScoreSettings(props) {
let c21876_1;
const guild = props.guild;
c21876_1 = void 0;
const id = guild.id;
const initialValue = numberToCustomScore(useStateFromStores([ICYMIStore], () => ICYMIStore.getCustomGuildScore(id)));
c21876_1 = initialValue;
const r1 = initialValue === ICYMICustomScore.MUTED;
const callback = useCallback((a0) => {
NativeICYMIActionCreators.customScoreGuild({
guildId: id,
guildScore: a0 ? customScoreToNumber(ICYMICustomScore.DEFAULT) : customScoreToNumber(ICYMICustomScore.MUTED)
});
}, [id]);
const callback2 = useCallback((a0) => {
if (c21876_1 !== a0) {
NativeICYMIActionCreators.customScoreGuild({
guildId: id,
guildScore: customScoreToNumber(a0)
});
}
}, [initialValue, id]);
const styles = useStyles();
return <View>
<Text variant="text-sm/semibold" color="text-default">
{intl.string(t.Clq6km)}
</Text>
<Text variant="text-xs/normal" color="text-default">
{intl.format(t["0DhU2P"], {
guildName: guild.name
})}
</Text>
{r1 ? null : <View style={styles.customScoreWrapper}>
<ContentSettingsControl initialValue={initialValue} onValueUpdated={callback2} />
</View>}
<View style={r1 && styles.muted}>
<TableSwitchRow value={!r1} onValueChange={callback} label={intl.string(t.oujX73)} start end />
</View>
<Text variant="text-xs/normal" color="text-muted" style={styles.warningText}>
{intl.string(t.vRVs07)}
</Text>
</View>;
}
export function ChannelScoreSettings(props) {
const { guild, channel } = props;
const id2 = guild.id;
const id3 = channel.id;
const stateFromStores = useStateFromStores([ICYMIStore, UserGuildSettingsStore], () => {
let r8 = ICYMIStore.getCustomChannelScore(id2, id3);
if (r8 === ICYMICustomScore.UNKNOWN) {
r8 = UserGuildSettingsStore.isChannelMuted(id2, id3) ? ICYMICustomScore.MUTED : ICYMICustomScore.DEFAULT;
}
return r8;
});
const channelName = useChannelName(channel, true);
const disabled = numberToCustomScore(useStateFromStores([ICYMIStore], () => ICYMIStore.getCustomGuildScore(id2))) === ICYMICustomScore.MUTED;
const r1 = stateFromStores === ICYMICustomScore.MUTED;
const callback = useCallback((a0) => {
if (stateFromStores !== a0) {
NativeICYMIActionCreators.customScoreGuild({
guildId: id2,
channelScores: [{
channelId: id3,
score: customScoreToNumber(a0)
}]
});
}
}, [stateFromStores, id2, id3]);
const callback2 = useCallback((a0) => {
NativeICYMIActionCreators.customScoreGuild({
guildId: id2,
channelScores: [{
channelId: id3,
score: a0 ? customScoreToNumber(ICYMICustomScore.DEFAULT) : customScoreToNumber(ICYMICustomScore.MUTED)
}]
});
}, [id3, id2]);
const styles = useStyles();
return <View>
<Text variant="text-sm/semibold" color="text-default">
{intl.string(t["0jRosn"])}
</Text>
<Text variant="text-xs/normal" color="text-default">
{intl.format(t.KzkF1j, {
channelName
})}
</Text>
{r1 ? null : <View style={styles.customScoreWrapper}>
<ContentSettingsControl disabled={disabled} initialValue={stateFromStores} onValueUpdated={callback} />
</View>}
<View style={r1 && styles.muted}>
<TableSwitchRow value={!r1} onValueChange={callback2} label={intl.string(t.W2aJRS)} disabled={disabled} start end />
</View>
<Text variant="text-xs/normal" color="text-muted" style={styles.warningText}>
{intl.string(t["5lP6Ax"])}
</Text>
</View>;
}
@@ -0,0 +1,2 @@
// Metro module 15334 (f15335).
export const ICYMI_CUSTOM_SCORES_MODAL_KEY = "icymi-custom-scores-modal";
@@ -0,0 +1,207 @@
// Metro module 15327 (f15328).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useMemo, useCallback, useEffect } from "react";
import { View } from "react-native";
import ChannelListStore from "../../../guild_sidebar/ChannelListStore";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import UserGuildSettingsStore from "../../../../stores/UserGuildSettingsStore";
import ICYMIStore from "../../ICYMIStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import useChannelName from "../../../channel/useChannelName";
import { ICYMICustomScore, numberToCustomScore, isChannelCustomScoreEligible } from "../../ICYMIUtils";
import { intl, t } from "../../../../intl/index.native";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { getChannelIcon } from "../../../../utils/native/ChannelUtils";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import { Icon, IconSizes } from "../../../../design/void/native";
import Module10308 from "../../../../_bundle/Module10308";
import { Text } from "../../../../design/components/Text/native/Text";
import { SECTION_INDEX_GUILD_ACTIONS, SECTION_INDEX_FAVORITES, SECTION_INDEX_RECENTS, SECTION_INDEX_FIRST_NAMED_CATEGORY } from "../../../guild_sidebar/ChannelListState";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { GuildScoreSettings } from "./ICYMIContentSettingControl";
import { ChevronSmallDownIcon } from "../../../../design/components/Icon/native/redesign/generated/ChevronSmallDownIcon";
import { AnimatedFlashList } from "../../../../_bundle/noop_6676";
let useStyles, keyExtractor;
const ICYMICustomScoreChannelRow = function ICYMICustomScoreChannelRow(props) {
let stateFromStores2, c21872_3;
const { channelId, start, end, disabled } = props;
stateFromStores2 = void 0;
c21872_3 = void 0;
const styles2 = useStyles();
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId));
const channelName = useChannelName(stateFromStores);
stateFromStores2 = useStateFromStores([ICYMIStore, UserGuildSettingsStore], () => {
if (stateFromStores == null) {
return ICYMICustomScore.DEFAULT;
}
let r8 = ICYMIStore.getCustomChannelScore(stateFromStores.guild_id, stateFromStores.id);
if (r8 === ICYMICustomScore.UNKNOWN) {
r8 = UserGuildSettingsStore.isChannelMuted(stateFromStores.guild_id, stateFromStores.id) ? ICYMICustomScore.MUTED : ICYMICustomScore.DEFAULT;
}
return r8;
});
const r1 = stateFromStores2 === ICYMICustomScore.MUTED;
c21872_3 = r1;
const memo = useMemo(() => c21872_3 ? intl.string(t.lhPHmz) : stateFromStores2 === ICYMICustomScore.MORE ? intl.string(t.Rxe3jF) : stateFromStores2 === ICYMICustomScore.LESS ? intl.string(t.rdt65I) : intl.string(t.SnrG00), [r1, stateFromStores2]);
const callback = useCallback(() => {
if (stateFromStores != null) {
ActionSheetActionCreators.openLazy(import("../ItemDetailsActionSheet"), "ItemDetailsActionSheet", {
guildId: stateFromStores.guild_id,
channelId: stateFromStores.id
});
}
}, [stateFromStores]);
if (stateFromStores == null) {
return null;
}
return <TableRow arrow disabled={disabled} icon={<Icon size={IconSizes.SMALL} source={getChannelIcon(stateFromStores)} />} start={start} end={end} labelLineClamp={1} label={r1 ? <View style={styles2.channelNameContainer}>
<Icon source={Module10308} size={Icon.Sizes.SMALL} style={styles2.channelMutedIcon} />
<Text variant="text-md/semibold" color="mobile-text-heading-primary" lineClamp={1}>{channelName}</Text>
</View> : channelName} trailing={<TableRow.TrailingText text={memo} />} onPress={callback} />;
};
keyExtractor = function keyExtractor(a0, a1) {
const kind = a0.kind;
if (kind === "header") {
return "header";
}
if (kind === "categoryHeader") {
return `categoryHeader-${a0.index}`;
}
if (kind === "channel") {
return `channel-${a0.channelId}`;
}
return `${a1}`;
};
useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
paddingHorizontal: Module712.space.PX_12
},
guildHeader: {
marginBottom: Module712.space.PX_32
},
categoryHeader: {
paddingTop: Module712.space.PX_8,
paddingBottom: Module712.space.PX_8,
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4
},
channelNameContainer: {
flexDirection: "row",
gap: Module712.space.PX_4
},
channelMutedIcon: {
alignSelf: "center",
tintColor: Module712.colors.ICON_MUTED
}
});
export default function ICYMICustomScoresGuildScreen(props) {
let c21873_4, guildChannels;
const navigation = props.navigation;
const guildId = props.route.params.guildId;
c21873_4 = void 0;
guildChannels = void 0;
const styles = useStyles();
const stateFromStores3 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
useEffect(() => {
let title = stateFromStores3?.name;
if (title == null) {
title = "";
}
navigation.setOptions({
title
});
}, [navigation, stateFromStores3?.name]);
const r38 = numberToCustomScore(useStateFromStores([ICYMIStore], () => ICYMIStore.getCustomGuildScore(guildId)));
c21873_4 = r38;
guildChannels = useStateFromStoresObject([ChannelListStore], () => ChannelListStore.getGuild(guildId)).guildChannels;
const memo = useMemo(() => {
const r0 = [];
r0.push({
kind: "header"
});
for (const item of guildChannels.getSections(false).entries()) {
const r49 = _slicedToArray(item, 2);
const index = r49[0];
if (r49[1] !== 0 && index !== SECTION_INDEX_GUILD_ACTIONS && index !== guildChannels.voiceChannelsSectionNumber) {
const categoryFromSection = guildChannels.getCategoryFromSection(index);
const r66 = categoryFromSection == null ? void 0 : categoryFromSection.getChannelRecords().filter((item) => isChannelCustomScoreEligible(item));
if (r66 != null && r66.length !== 0) {
let title = intl.string(t.GSfOoo);
if (index === SECTION_INDEX_FAVORITES) {
title = intl.string(t.mlPMCy);
} else if (index === SECTION_INDEX_RECENTS) {
title = intl.string(t.gKcrqM);
} else if (index >= SECTION_INDEX_FIRST_NAMED_CATEGORY) {
const namedCategoryFromSection = guildChannels.getNamedCategoryFromSection(index);
let r104 = namedCategoryFromSection == null ? void 0 : namedCategoryFromSection.record.name;
if (r104 == null) {
r104 = "";
}
title = r104;
}
r0.push({
kind: "categoryHeader",
index,
title
});
for (const item2 of r66.entries()) {
const r141 = _slicedToArray(item2, 2);
const r22 = r141[0];
r0.push({
kind: "channel",
channelId: r141[1].id,
start: r22 === 0,
end: r22 === r66.length - 1,
disabled: c21873_4 === ICYMICustomScore.MUTED
});
}
}
}
}
const r165 = r0[r0.length - 1];
if (r165.kind === "channel") {
r165.end = true;
}
return r0;
}, [r38, guildChannels]);
return <View style={styles.container}>
<AnimatedFlashList contentInset={{
bottom: useSafeAreaInsets_native().bottom,
top: Module712.space.PX_12
}} showsVerticalScrollIndicator={false} renderItem={useCallback(({ item }) => {
const kind = item.kind;
if (kind === "header") {
return stateFromStores3 != null ? <>
<View style={styles.guildHeader}>
<GuildScoreSettings guild={stateFromStores3} />
</View>
<Text variant="text-sm/semibold" color="text-default">
{intl.string(t["0jRosn"])}
</Text>
<Text variant="text-xs/normal" color="text-default" style={{
marginBottom: Module712.space.PX_16
}}>
{intl.string(t.l52PX4)}
</Text>
</> : null;
}
if (kind === "categoryHeader") {
return <View style={styles.categoryHeader}>
<ChevronSmallDownIcon size="xs" color={Module712.colors.TEXT_SUBTLE} />
<Text variant="text-sm/semibold" color="text-default">{item.title}</Text>
</View>;
}
if (kind === "channel") {
return <ICYMICustomScoreChannelRow disabled={item.disabled} channelId={item.channelId} start={item.start} end={item.end} />;
}
return null;
}, [stateFromStores3, styles.categoryHeader, styles.guildHeader])} data={memo} keyExtractor={keyExtractor} />
</View>;
};
@@ -0,0 +1,38 @@
// Metro module 15325 (f15326).
import { createNativeStackNavigator } from "../../../../_bundle/Module9109";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useAccessibilityNativeStackOptions } from "../../../../design/components/Navigator/native/Navigator.native";
import { GenericHeaderTitle, getRenderModalCloseImage, getRenderModalBackImage } from "../../../main_tabs_v2/native/shared_components/HeaderShared";
import { intl, t } from "../../../../intl/index.native";
import getNavigationModalPresentation from "../../../main_tabs_v2/native/utils/getNavigationModalPresentation";
import * as _ICYMICustomScoresOverviewScreen from "./ICYMICustomScoresOverviewScreen";
import * as _ICYMICustomScoresGuildScreen from "./ICYMICustomScoresGuildScreen";
const nativeStackNavigator = createNativeStackNavigator();
const useStyles = createStyles({
header: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
export default function ICYMICustomScoresModal() {
const styles = useStyles();
const accessibilityNativeStackOptions = useAccessibilityNativeStackOptions();
return <nativeStackNavigator.Navigator screenOptions={() => ({
headerStyle: styles.header,
headerTitle: (a0) => {
const { children, ...rest } = a0;
return <GenericHeaderTitle title={a0.children} {...rest} />;
},
headerTitleAlign: "center",
...accessibilityNativeStackOptions
})} initialRouteName="default">
<nativeStackNavigator.Screen name="default" options={({ navigation }) => ({
title: intl.string(t.jVshKt),
headerLeft: getRenderModalCloseImage(navigation),
...getNavigationModalPresentation()
})} getComponent={() => _ICYMICustomScoresOverviewScreen.default} />
<nativeStackNavigator.Screen name="guild" options={(a0) => ({
headerLeft: getRenderModalBackImage(a0.navigation)
})} getComponent={() => _ICYMICustomScoresGuildScreen.default} />
</nativeStackNavigator.Navigator>;
};
@@ -0,0 +1,48 @@
// Metro module 15326 (f15327).
import { useMemo, useCallback } from "react";
import { ScrollView } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import SortedGuildStore from "../../../../stores/SortedGuildStore";
import ICYMIStore from "../../ICYMIStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { TableRowGroup } from "../../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import GuildIcon from "../../../guild/native/GuildIcon";
import { numberToCustomScore, ICYMICustomScore } from "../../ICYMIUtils";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
paddingHorizontal: Module712.space.PX_12
}
});
export default function ICYMICustomScoresOverviewScreen(props) {
let stateFromStores2, stateFromStores3, callback;
const navigation = props.navigation;
stateFromStores2 = void 0;
stateFromStores3 = void 0;
callback = void 0;
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuilds());
stateFromStores2 = useStateFromStores([SortedGuildStore], () => SortedGuildStore.getFlattenedGuildIds());
stateFromStores3 = useStateFromStores([ICYMIStore], () => ICYMIStore.getCustomGuildScores());
const memo = useMemo(() => stateFromStores2.map((item) => stateFromStores[item]), [stateFromStores2, stateFromStores]);
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
callback = useCallback((a0) => navigation.navigate("guild", {
guildId: a0
}), [navigation]);
return <ScrollView showsVerticalScrollIndicator={false} style={styles.container} contentInset={{
bottom,
top: Module712.space.PX_12
}}>
<TableRowGroup hasIcons>
{memo.map((item) => {
return <TableRow key={item.id} onPress={() => callback(item.id)} icon={<GuildIcon guild={item} />} label={item.name} trailing={stateFromStores3[item.id] != null ? numberToCustomScore(stateFromStores3[item.id]) === ICYMICustomScore.MUTED ? <TableRow.TrailingText text={intl.string(t.lhPHmz)} /> : void 0 : void 0} arrow />;
})}
</TableRowGroup>
</ScrollView>;
};