Files
discord-decomp/modules/favorites/FavoriteManager.tsx
T
2026-11-01 12:12:55 +02:00

38 lines
1.4 KiB
TypeScript

// Metro module 16331 (f16332).
import { removeFavoriteChannel, setFavoriteCategoryCollapsed, setAllFavoriteCategoriesCollapsed } from "./FavoritesActionCreators";
import { isFavoritesGuildId } from "./FavoritesUtils";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
let handleCategoryCollapse, handleCategoryExpand, handleCategoryCollapseAll, handleCategoryExpandAll;
const handleChannelDelete = function handleChannelDelete(a0) {
removeFavoriteChannel(a0.channel.id, {
trackAnalytics: false
});
};
handleCategoryCollapse = function handleCategoryCollapse(a0) {
setFavoriteCategoryCollapsed(a0.id, true);
};
handleCategoryExpand = function handleCategoryExpand(a0) {
setFavoriteCategoryCollapsed(a0.id, false);
};
handleCategoryCollapseAll = function handleCategoryCollapseAll(a0) {
if (isFavoritesGuildId(a0.guildId)) {
setAllFavoriteCategoriesCollapsed(true);
}
};
handleCategoryExpandAll = function handleCategoryExpandAll(a0) {
if (isFavoritesGuildId(a0.guildId)) {
setAllFavoriteCategoriesCollapsed(false);
}
};
class FavoriteManager extends AutomaticLifecycleManager {
actions = {
CHANNEL_DELETE: handleChannelDelete,
CATEGORY_COLLAPSE: handleCategoryCollapse,
CATEGORY_EXPAND: handleCategoryExpand,
CATEGORY_COLLAPSE_ALL: handleCategoryCollapseAll,
CATEGORY_EXPAND_ALL: handleCategoryExpandAll
};
}
const favoriteManager = new FavoriteManager();
export default favoriteManager;