54 lines
2.3 KiB
TypeScript
54 lines
2.3 KiB
TypeScript
// 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;
|
|
};
|