decord/source/utils/native/WelcomeScreenUtils.tsx

85 lines
3.2 KiB
TypeScript
Raw Normal View History

// Module ID: 12657
// Function ID: 12658
2026-07-20 16:05:17 +00:00
// Name: useShowWelcomeModal
// Dependencies: [19, 12658, 2012, 1979, 4392, 12659, 504, 12660, 4527, 12661, 1896, 2]
2026-07-20 16:05:17 +00:00
// Exports: openWelcomeActionSheet, useShowWelcomeModal
// Module 12657 (useShowWelcomeModal)
import asyncRequireImpl from "asyncRequireImpl" /* 1896 */;
import ACTION_SHEET_HEIGHT_HALFDefault from "ACTION_SHEET_HEIGHT_HALF" /* 4527 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "noop" /* 19 */;
import closure_4 from "handleInviteData" /* 12658 */;
import { NO_WELCOME_SCREEN } from "handleInviteData" /* 12658 */;
import closure_6 from "comparator" /* 2012 */;
import closure_7 from "createGuildRecordFromRust" /* 1979 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
let closure_8 = { welcomeScreenModalVisible: false, shouldFetchGuildId: "Array" };
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("utils/native/WelcomeScreenUtils.tsx");
2026-07-20 16:05:17 +00:00
export const useShowWelcomeModal = function useShowWelcomeModal(guildId, channelId) {
2026-07-23 10:11:24 +00:00
const _require = guildId;
2026-08-24 06:08:38 +00:00
importDefault = channelId;
2026-07-23 10:11:24 +00:00
welcomeModalChannelId = _require(welcomeModalChannelId[4]).useLocation().welcomeModalChannelId;
const React = importDefault(welcomeModalChannelId[5])(channelId, guildId);
let obj = _require(welcomeModalChannelId[4]);
2026-08-24 06:08:38 +00:00
const items = [closure_7, shouldFetchGuildId, closure_6];
2026-07-23 10:11:24 +00:00
const stateFromStoresObject = _require(welcomeModalChannelId[6]).useStateFromStoresObject(items, () => {
2026-08-24 06:08:38 +00:00
if (closure_3) {
const guild = closure_1_7.getGuild(closure_0);
const selectableChannelIds = closure_1_6.getSelectableChannelIds(closure_0);
2026-07-23 10:11:24 +00:00
const value = shouldFetchGuildId.get(closure_0);
const hasSeenResult = shouldFetchGuildId.hasSeen(closure_0);
2026-07-20 16:05:17 +00:00
let tmp11 = !hasSeenResult;
const hasErrorResult = shouldFetchGuildId.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) {
2026-08-24 06:08:38 +00:00
tmp14 = value !== closure_1_5;
2026-07-20 16:05:17 +00:00
}
if (tmp14) {
tmp14 = !isFetchingResult;
}
if (tmp14) {
tmp14 = !hasErrorResult;
}
if (tmp14) {
tmp14 = selectableChannelIds.length > 0;
}
2026-07-29 08:29:29 +00:00
const obj = { welcomeScreenModalVisible: null, shouldFetchGuildId: null };
obj[0] = tmp14;
2026-07-20 16:05:17 +00:00
let id;
if (tmp11) {
if (null == value) {
if (null != guild) {
id = guild.id;
}
}
}
2026-07-29 08:29:29 +00:00
obj[1] = id;
2026-07-20 16:05:17 +00:00
return obj;
} else {
2026-08-24 06:08:38 +00:00
return closure_1_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 = React.useEffect(() => {
if (null != shouldFetchGuildId) {
2026-07-29 08:29:29 +00:00
const welcomeScreen = guildId(welcomeModalChannelId[7]).fetchWelcomeScreen(tmp);
2026-07-23 10:11:24 +00:00
const obj = guildId(welcomeModalChannelId[7]);
2026-07-20 16:05:17 +00:00
}
}, items1);
return stateFromStoresObject.welcomeScreenModalVisible;
};
export const openWelcomeActionSheet = function openWelcomeActionSheet(onHide) {
const guildId = onHide.guildId;
2026-08-24 06:08:38 +00:00
const obj = ACTION_SHEET_HEIGHT_HALFDefault;
obj.openLazy(asyncRequireImpl(12661, dependencyMap.paths), "GuildWelcomeActionSheet" + guildId, { guildId, onHide: onHide.onHide });
2026-07-20 16:05:17 +00:00
};