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,44 @@
// Metro module 15127 (f15128).
import { useState, useCallback } from "react";
import { MAX_FAVORITE_CATEGORY_NAME_LENGTH } from "../FavoritesConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import * as _FavoritesUtils from "../FavoritesUtils";
import { addFavoriteCategory } from "../FavoritesActionCreators";
import ActionSheetActionCreators, { showActionSheet } from "../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../intl/index.native";
import { TextInput } from "../../../design/components/TextInput/native/TextInput.native";
import { Button } from "../../../design/components/Button/native/Button.native";
let key, useStyles;
const AddFavoriteCategoryActionSheet = function AddFavoriteCategoryActionSheet() {
const styles = useStyles();
const [state, onChange] = useState("");
const isFavoritesGuildCategoryNameValid = _FavoritesUtils.isFavoritesGuildCategoryNameValid(state);
const callback = useCallback(() => {
if (isFavoritesGuildCategoryNameValid) {
addFavoriteCategory(state, "modal");
ActionSheetActionCreators.hideActionSheet(key);
}
}, [isFavoritesGuildCategoryNameValid, state]);
return <BottomSheet contentStyles={styles.content} bodyStyles={styles.body} keyboardShouldPersistTaps="always" header={<BottomSheetTitleHeader title={intl.string(t["ISN+NM"])} />}>
<TextInput label={intl.string(t.OCAkGP)} placeholder={intl.string(t.eTVbtx)} value={state} onChange={onChange} maxLength={MAX_FAVORITE_CATEGORY_NAME_LENGTH} autoFocus isClearable returnKeyType="done" onSubmitEditing={callback} />
<Button text={intl.string(t.CumH4u)} onPress={callback} disabled={!isFavoritesGuildCategoryNameValid} />
</BottomSheet>;
};
key = "AddFavoriteCategoryActionSheet";
useStyles = createStyles({
content: {
paddingHorizontal: Module712.space.PX_16
},
body: {
gap: Module712.space.PX_16
}
});
export function openAddFavoriteCategoryActionSheet() {
showActionSheet({
content: <AddFavoriteCategoryActionSheet />,
key
});
}
@@ -0,0 +1,91 @@
// Metro module 11881 (f11882).
import { useEffect, useState, useCallback, useMemo } from "react";
import { View } from "react-native";
import { MAX_FAVORITES_ADD_CHANNEL_COUNT } from "../FavoritesConstants";
import { UserRowModes } from "../../main_tabs_v2/native/shared_components/user_list/UserRowConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useFavoriteAdded } from "../FavoritesHooks";
import useFavoritesGuildChannelFilter from "../hooks/useFavoritesGuildChannelFilter";
import { trackFavoritesGuildAddModalOpened } from "../FavoritesAnalytics";
import { getOrResolveChannelIdFromDestinationId } from "../../share/formatResults";
import { isNotNullish } from "../../../utils/GlobalUtils";
import { addFavoriteChannels } from "../FavoritesActionCreators";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import { isAndroid } from "../../../utils/PlatformUtils";
import SearchableDestinationListHeader from "../../share/native/SearchableDestinationListHeader";
import { intl } from "../../../intl/index.native";
import FavoritesGuild_messages from "../intl/FavoritesGuild.messages";
import ThemedGradient from "../../client_themes/native/ThemedGradient";
import SearchableDestinationList from "../../share/native/SearchableDestinationList";
import { ModalFloatingAction } from "../../../design/components/Modal/native/ModalFloatingAction.native";
import { getFavoritesAddButtonLabel } from "../utils/getFavoritesAddButtonLabel";
import showSearchableDestinationListModal from "../../share/native/showSearchableDestinationListModal";
import ModalActionCreators from "../../../actions/ModalActionCreators";
let useStyles, c8147_12, closeAddFavoriteChannelModal;
const AddFavoriteChannelModal = function AddFavoriteChannelModal(props) {
let state, setState, height;
const { parentId, source } = props;
state = void 0;
setState = void 0;
height = void 0;
const styles = useStyles();
const notifyFavoriteAdded = useFavoriteAdded().notifyFavoriteAdded;
const favoritesGuildChannelFilter = useFavoritesGuildChannelFilter();
useEffect(() => {
trackFavoritesGuildAddModalOpened(source);
}, [source]);
[state, setState] = useState([]);
const length = state.length;
const callback2 = useCallback((a0) => {
setState(a0);
}, []);
const callback = useCallback(async () => {
let c27203_0, c27203_2;
c27203_2 = void 0;
let c30472_0 = (await Promise.all(state.map(getOrResolveChannelIdFromDestinationId))).filter(isNotNullish);
if (c30472_0.length > 0) {
(0, notifyFavoriteAdded)();
c27203_0 = parentId;
if (parentId == null) {
c27203_0 = null;
}
addFavoriteChannels(c30472_0, c27203_0, "modal");
}
(0, closeAddFavoriteChannelModal)();
}, [notifyFavoriteAdded, parentId, state]);
height = useWindowDimensions_native({
ignoreKeyboard: true
}).height;
return <View style={useMemo(() => ({
height: isAndroid() ? height : "100%"
}), [height])}>
<SearchableDestinationListHeader title={intl.string(FavoritesGuild_messages.Rp35U1)} onClose={closeAddFavoriteChannelModal} />
<View style={styles.container}>
<ThemedGradient absolute />
<SearchableDestinationList rowMode={UserRowModes.TOGGLE} initialSelectedDestinations={[]} onSelectedDestinationChange={callback2} channelFilter={favoritesGuildChannelFilter} insetEnd={0} disableGradient disableStickySections disableSelection={length >= MAX_FAVORITES_ADD_CHANNEL_COUNT} />
<ModalFloatingAction isVisible={length > 0} floatingBackgroundColor={styles.container.backgroundColor} text={getFavoritesAddButtonLabel(length)} onPress={callback} />
</View>
</View>;
};
closeAddFavoriteChannelModal = function closeAddFavoriteChannelModal() {
ModalActionCreators.popWithKey(c8147_12);
};
useStyles = createStyles({
container: {
flex: 1,
display: "flex",
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
}
});
c8147_12 = "add-favorite-channel-modal";
export const ADD_FAVORITE_CHANNEL_MODAL_KEY = "add-favorite-channel-modal";
export function openAddFavoriteChannelModal({ parentId: parentId2, source: source2 }) {
showSearchableDestinationListModal(Promise.resolve({
default: AddFavoriteChannelModal
}), {
parentId: parentId2,
source: source2
}, c8147_12);
}
export { closeAddFavoriteChannelModal };
@@ -0,0 +1,37 @@
// Metro module 15121 (f15122).
import useFavoritesGuildHideAction from "../hooks/useFavoritesGuildHideAction";
import useFavoritesGuildResetAction from "../hooks/useFavoritesGuildResetAction";
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../intl/index.native";
import { ActionSheetRow } from "../../../design/components/Sheet/native/ActionSheetRow.native";
import { XSmallIcon } from "../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import { EyeSlashIcon } from "../../../design/components/Icon/native/redesign/generated/EyeSlashIcon";
import ActionSheetActionCreators, { showActionSheet } from "../../action_sheet/native/ActionSheetActionCreators";
import { TrashIcon } from "../../../design/components/Icon/native/redesign/generated/TrashIcon";
let key;
const FavoritesGuildActionSheet = function FavoritesGuildActionSheet() {
const favoritesGuildHideAction = useFavoritesGuildHideAction();
let c21694_0 = favoritesGuildHideAction;
const favoritesGuildResetAction = useFavoritesGuildResetAction();
let c21694_1 = favoritesGuildResetAction;
return <ActionSheet header={<BottomSheetTitleHeader title={intl.string(t.wMWyci)} />}>
<ActionSheetRow.Group hasIcons>
<ActionSheetRow label={favoritesGuildHideAction.label} subLabel={favoritesGuildHideAction.subLabel} icon={<ActionSheetRow.Icon IconComponent={favoritesGuildHideAction.isPreview ? XSmallIcon : EyeSlashIcon} />} variant={favoritesGuildHideAction.isPreview ? "default" : "danger"} onPress={() => {
ActionSheetActionCreators.hideActionSheet(key);
c21694_0.perform();
}} />
{favoritesGuildResetAction.isAvailable ? <ActionSheetRow label={favoritesGuildResetAction.label} subLabel={favoritesGuildResetAction.subLabel} icon={<ActionSheetRow.Icon IconComponent={TrashIcon} />} variant="danger" onPress={() => {
ActionSheetActionCreators.hideActionSheet(key);
c21694_1.perform();
}} /> : null}
</ActionSheetRow.Group>
</ActionSheet>;
};
key = "FavoritesGuildActionSheet";
export function openFavoritesGuildActionSheet() {
showActionSheet({
content: <FavoritesGuildActionSheet />,
key
});
}
@@ -0,0 +1,39 @@
// Metro module 15126 (f15127).
import ActionSheetActionCreators, { showActionSheet } from "../../action_sheet/native/ActionSheetActionCreators";
import { openAddFavoriteChannelModal } from "./AddFavoriteChannelModal";
import { openAddFavoriteCategoryActionSheet } from "./AddFavoriteCategoryActionSheet";
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../intl/index.native";
import { ActionSheetRow } from "../../../design/components/Sheet/native/ActionSheetRow.native";
import FavoritesGuild_messages from "../intl/FavoritesGuild.messages";
import { StarOutlineIcon } from "../../../design/components/Icon/native/redesign/generated/StarOutlineIcon";
import { FolderPlusIcon } from "../../../design/components/Icon/native/redesign/generated/FolderPlusIcon";
let key, handleCreateCategory, FavoritesGuildAddActionSheet;
const handleAddToFavorites = function handleAddToFavorites() {
ActionSheetActionCreators.hideActionSheet(key);
openAddFavoriteChannelModal({
source: "favorites_header_add_button_context_menu"
});
};
handleCreateCategory = function handleCreateCategory() {
ActionSheetActionCreators.hideActionSheet(key);
openAddFavoriteCategoryActionSheet();
};
FavoritesGuildAddActionSheet = function FavoritesGuildAddActionSheet() {
return <ActionSheet header={<BottomSheetTitleHeader title={intl.string(t.wMWyci)} />}>
<ActionSheetRow.Group hasIcons>
<ActionSheetRow label={intl.string(FavoritesGuild_messages.G9fGlP)} icon={<ActionSheetRow.Icon IconComponent={StarOutlineIcon} />} onPress={handleAddToFavorites} />
</ActionSheetRow.Group>
<ActionSheetRow.Group hasIcons>
<ActionSheetRow label={intl.string(t["ISN+NM"])} icon={<ActionSheetRow.Icon IconComponent={FolderPlusIcon} />} onPress={handleCreateCategory} />
</ActionSheetRow.Group>
</ActionSheet>;
};
key = "FavoritesGuildAddActionSheet";
export function openFavoritesGuildAddActionSheet() {
showActionSheet({
content: <FavoritesGuildAddActionSheet />,
key
});
}
@@ -0,0 +1,15 @@
// Metro module 15124 (f15125).
import useFavoritesGuildHeaderAction from "../hooks/useFavoritesGuildHeaderAction";
import { IconButton } from "../../../design/components/Button/native/IconButton.native";
import Module5176 from "../../../_bundle/Module5176";
import Module11373 from "../../../_bundle/Module11373";
import { openFavoritesGuildAddActionSheet } from "./FavoritesGuildAddActionSheet";
export function FavoritesGuildHeaderActionButton() {
const favoritesGuildHeaderAction = useFavoritesGuildHeaderAction();
const { isPreview, label } = favoritesGuildHeaderAction;
let exitPreview = favoritesGuildHeaderAction.exitPreview;
if (!isPreview) {
exitPreview = openFavoritesGuildAddActionSheet;
}
return <IconButton variant="secondary" size="sm" icon={isPreview ? Module5176 : Module11373} onPress={exitPreview} accessibilityLabel={label} maxFontSizeMultiplier={1} />;
}
@@ -0,0 +1,20 @@
// Metro module 11880 (f11881).
import { useCallback } from "react";
import { ChannelTypes } from "../../../../Constants";
import { isFavoritesGuildId } from "../../FavoritesUtils";
import { intl } from "../../../../intl/index.native";
import FavoritesGuild_messages from "../../intl/FavoritesGuild.messages";
export default function useFavoritesGuildCategoryAddAction(a0) {
const callback = useCallback(async () => {
let c27202_0;
c27202_0 = void 0;
(0, (await import("../AddFavoriteChannelModal")).openAddFavoriteChannelModal)({
parentId: a0.id,
source: "favorites_add_to_category"
});
}, [a0.id]);
return isFavoritesGuildId(a0.getGuildId()) ? a0.type === ChannelTypes.GUILD_CATEGORY ? {
label: intl.string(FavoritesGuild_messages["1QJmIL"]),
perform: callback
} : null : null;
};
@@ -0,0 +1,25 @@
// Metro module 10372 (f10373).
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import FavoriteStore from "../../FavoriteStore";
import { useFavoritesAccess, useIsFavoritesGuildSelected } from "../../FavoritesHooks";
import { canFavoriteChannelType } from "../../FavoritesUtils";
import { useStateFromStores } from "../../../../_bundle/Module589";
export default function useFavoritesGuildChannelActions(a0, a1) {
const favoritesAccess = useFavoritesAccess(a1);
const hasAccess = favoritesAccess.hasAccess;
let canFavoriteChannel = canFavoriteChannelType(a0, favoritesAccess.hasHigherPrivileges);
const stateFromStores = useStateFromStores([FavoriteStore], () => FavoriteStore.isFavorite(a0.id));
const isFavoritesGuildSelected = useIsFavoritesGuildSelected();
const stateFromStores2 = useStateFromStores([GuildMemberStore, AuthenticationStore], () => a0.guild_id == null || GuildMemberStore.isMember(a0.guild_id, AuthenticationStore.getId()));
if (canFavoriteChannel) {
canFavoriteChannel = stateFromStores2;
}
return {
hasFavoritesAccess: hasAccess,
canFavoriteChannel,
isChannelInFavorites: stateFromStores,
isFavoritesGuild: isFavoritesGuildSelected,
channelId: a0.id
};
};
@@ -0,0 +1,53 @@
// Metro module 10213 (f10214).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { intl, t } from "../../../intl/index.native";
import { StarIcon } from "../../../design/components/Icon/native/redesign/generated/StarIcon";
import FavoritesGuild_messages from "../intl/FavoritesGuild.messages";
import { StarOutlineIcon } from "../../../design/components/Icon/native/redesign/generated/StarOutlineIcon";
let _removeChannelFromFavorites;
let _addChannelToFavorites = function _addChannelToFavorites() {
const r8 = async (c26635_0) => {
let c26635_2;
c26635_2 = void 0;
let c30205_0 = c26635_0;
ToastActionCreators.open({
key: "FAVORITE_ADDED",
content: intl.string(t["4tSWQg"]),
IconComponent: StarIcon
});
let c30205_1 = await Promise.all([import("../FavoritesActionCreators"), import("../hooks/useIsFavoritesGuildEnabled")]);
let c30205_2 = (0, _slicedToArray)(c30205_1, 2);
let c30205_3 = c30205_2[0];
if (!(0, c30205_2[1].getIsFavoritesGuildEnabled)()) {
c30205_3.setFavoritesGuildVisibility(true, "channel_context_menu");
}
c30205_3.addFavoriteChannel(c30205_0, null, "channel_context_menu");
};
_addChannelToFavorites = r8;
return r8.apply(this, arguments);
};
_removeChannelFromFavorites = function _removeChannelFromFavorites() {
const r8 = async (c26636_0) => {
let c30206_0 = c26636_0;
(await import("../FavoritesActionCreators")).removeFavoriteChannel(c30206_0);
};
_removeChannelFromFavorites = r8;
return r8.apply(this, arguments);
};
export default function buildFavoritesSectionButtons({ hasFavoritesAccess, canFavoriteChannel, isChannelInFavorites, isFavoritesGuild, channelId }) {
return hasFavoritesAccess ? canFavoriteChannel ? isChannelInFavorites ? {
label: intl.string(FavoritesGuild_messages.TN4nAX),
IconComponent: StarIcon,
isDestructive: true,
onPress: () => (function removeChannelFromFavorites() {
return _removeChannelFromFavorites.apply(this, arguments);
})(channelId)
} : isFavoritesGuild ? null : {
label: intl.string(FavoritesGuild_messages.G9fGlP),
IconComponent: StarOutlineIcon,
onPress: () => (function addChannelToFavorites() {
return _addChannelToFavorites.apply(this, arguments);
})(channelId)
} : null : null;
};