49 lines
2.2 KiB
TypeScript
49 lines
2.2 KiB
TypeScript
// Metro module 9622 (f9623).
|
|
import { useMemo } from "react";
|
|
import { NativeModules } from "react-native";
|
|
import GuildStore from "../../../stores/GuildStore";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { useStickerPickerStore } from "./StickerPickerStore";
|
|
import { GuildNSFWContentLevel } from "../../../Constants";
|
|
import { ExpressionPickerViewType } from "../../expression_picker/ExpressionPickerConstants";
|
|
import { useStickerPackCategories } from "../StickersHooks";
|
|
import { StickerCategoryTypes } from "../StickersTypes";
|
|
import Module9624 from "../../../_bundle/Module9624";
|
|
import Module9625 from "../../../_bundle/Module9625";
|
|
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
|
|
export function useStickerCategories(a0) {
|
|
const stickerPackCategories = useStickerPackCategories(a0);
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const guilds = GuildStore.getGuilds();
|
|
return useMemo(() => stickerPackCategories.filter((stickerPackCategory) => stickerPackCategory.stickers.length > 0).filter((item) => {
|
|
const r8 = guilds[item.id];
|
|
return !!(item.type !== StickerCategoryTypes.GUILD || currentUser?.nsfwAllowed || r8 == null || r8.nsfwLevel !== GuildNSFWContentLevel.AGE_RESTRICTED && r8.nsfwLevel !== GuildNSFWContentLevel.EXPLICIT);
|
|
}).map((item) => {
|
|
if (item.type !== StickerCategoryTypes.FAVORITE && item.type !== StickerCategoryTypes.RECENT) {
|
|
return item;
|
|
}
|
|
return {
|
|
...item,
|
|
icon: item.type === StickerCategoryTypes.FAVORITE ? Module9624 : Module9625
|
|
};
|
|
}), [guilds, stickerPackCategories, currentUser]);
|
|
}
|
|
export function preloadSticker(a0) {
|
|
NativeModules.NativeLottieUtils.preload(a0.hash, a0.url, a0.width, a0.height, a0.frames, a0.callback);
|
|
}
|
|
export function dropPreloadedSticker(a0) {
|
|
NativeModules.NativeLottieUtils.dropPreload(a0);
|
|
}
|
|
export function openStickerPickerToPackId(c17360_0, a1) {
|
|
useStickerPickerStore.getState().setPackToScrollTo(a1);
|
|
setTimeout(() => {
|
|
const current = c17360_0.current;
|
|
if (current != null) {
|
|
current.openCustomKeyboard({
|
|
type: KeyboardTypes.EXPRESSION,
|
|
context: ExpressionPickerViewType.STICKER
|
|
});
|
|
}
|
|
}, 1);
|
|
}
|