// 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 ({ height: isAndroid() ? height : "100%" }), [height])}> = MAX_FAVORITES_ADD_CHANNEL_COUNT} /> 0} floatingBackgroundColor={styles.container.backgroundColor} text={getFavoritesAddButtonLabel(length)} onPress={callback} /> ; }; 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 };