decord/alpha/source/utils/native/WelcomeScreenUtils.tsx

87 lines
3.2 KiB
TypeScript
Raw Normal View History

// Module ID: 13001
// Function ID: 13002
// Name: WelcomeScreenUtils
// Dependencies: [19, 13002, 4462, 2066, 4661, 13003, 504, 13004, 4796, 13005, 1980, 2]
2026-07-20 16:05:17 +00:00
// Exports: openWelcomeActionSheet, useShowWelcomeModal
// Module 13001 (WelcomeScreenUtils)
import asyncRequireImpl from "asyncRequireImpl" /* 1980 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4796 */;
import WelcomeScreenActionCreators from "WelcomeScreenActionCreators" /* 13004 */;
import noop from "module_19" /* 19 */;
import WelcomeScreenStore from "WelcomeScreenStore" /* 13002 */;
import GuildChannelStore from "GuildChannelStore" /* 4462 */;
import GuildStore from "GuildStore" /* 2066 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
require = fn;
const NO_WELCOME_SCREEN = fn(13002).NO_WELCOME_SCREEN;
let closure_8 = { welcomeScreenModalVisible: false, shouldFetchGuildId: "r" };
const size = fn(2);
const result = size.fileFinishedImporting("utils/native/WelcomeScreenUtils.tsx");
2026-07-20 16:05:17 +00:00
export const useShowWelcomeModal = function useShowWelcomeModal(guildId, channelId) {
_require = guildId;
2026-08-24 06:08:38 +00:00
importDefault = channelId;
welcomeModalChannelId = require("module_4661").useLocation().welcomeModalChannelId;
noop = require("useWelcomeScreenEnabled")(channelId, guildId);
let obj = require("module_4661");
const items = [GuildStore, shouldFetchGuildId, GuildChannelStore];
const stateFromStoresObject = require("initialize").useStateFromStoresObject(items, () => {
2026-08-24 06:08:38 +00:00
if (closure_3) {
const guild = GuildStore.getGuild(closure_0);
const selectableChannelIds = GuildChannelStore.getSelectableChannelIds(closure_0);
value = WelcomeScreenStore.get(closure_0);
const hasSeenResult = WelcomeScreenStore.hasSeen(closure_0);
2026-07-20 16:05:17 +00:00
let tmp11 = !hasSeenResult;
const hasErrorResult = WelcomeScreenStore.hasError();
2026-07-29 08:29:29 +00:00
if (!hasSeenResult) {
2026-07-23 10:11:24 +00:00
tmp11 = welcomeModalChannelId === closure_1;
2026-07-20 16:05:17 +00:00
}
let tmp14 = tmp11;
if (tmp11) {
tmp14 = null != value;
}
if (tmp14) {
tmp14 = value !== NO_WELCOME_SCREEN;
2026-07-20 16:05:17 +00:00
}
if (tmp14) {
tmp14 = !isFetchingResult;
}
if (tmp14) {
tmp14 = !hasErrorResult;
}
if (tmp14) {
tmp14 = selectableChannelIds.length > 0;
}
const obj = { welcomeScreenModalVisible: tmp14, shouldFetchGuildId: null };
2026-07-20 16:05:17 +00:00
let id;
if (tmp11) {
if (null == value) {
if (null != guild) {
id = guild.id;
}
}
}
obj.shouldFetchGuildId = id;
2026-07-20 16:05:17 +00:00
return obj;
} else {
return closure_8;
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
shouldFetchGuildId = stateFromStoresObject.shouldFetchGuildId;
2026-07-20 16:05:17 +00:00
const items1 = [shouldFetchGuildId];
const effect = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (null != shouldFetchGuildId) {
const welcomeScreen = WelcomeScreenActionCreators.fetchWelcomeScreen(tmp);
2026-07-20 16:05:17 +00:00
}
}, items1);
return stateFromStoresObject.welcomeScreenModalVisible;
};
export const openWelcomeActionSheet = function openWelcomeActionSheet(onHide) {
const guildId = onHide.guildId;
const obj = ActionSheetActionCreatorsDefault;
obj.openLazy(asyncRequireImpl(13005, dependencyMap.paths), "GuildWelcomeActionSheet" + guildId, { guildId, onHide: onHide.onHide });
2026-07-20 16:05:17 +00:00
};