This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,50 @@
// Metro module 6692 (f6693).
import LurkingStore from "./LurkingStore";
import { AnalyticEvents } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export function trackLurkStarted(a0, a1, a2) {
let join_source = a1;
const MOBILE_LURKER_PREVIEW_LURK_STARTED = AnalyticEvents.MOBILE_LURKER_PREVIEW_LURK_STARTED;
const r16 = {
guild_id: a0,
num_lurked_guilds: LurkingStore.lurkingGuildIds().length,
join_source: null,
location: null
};
if (a1 == null) {
join_source = null;
}
let location2 = a2;
r16.join_source = join_source;
if (a2 == null) {
location2 = null;
}
r16.location = location2;
AnalyticsUtils.track(MOBILE_LURKER_PREVIEW_LURK_STARTED, r16);
}
export function trackJoinClicked(a0, a1, a2) {
AnalyticsUtils.track(AnalyticEvents.MOBILE_LURKER_PREVIEW_JOIN_CLICKED, {
guild_id: a0,
num_lurked_guilds: LurkingStore.lurkingGuildIds().length,
join_source: a1,
has_navigated_away: a2
});
}
export function trackLeavePromptLeaveClicked(a0) {
AnalyticsUtils.track(AnalyticEvents.MOBILE_LURKER_PREVIEW_LEAVE_PROMPT_LEAVE_CLICKED, {
guild_id: a0,
num_lurked_guilds: LurkingStore.lurkingGuildIds().length
});
}
export function trackGuildIconClicked(a0) {
AnalyticsUtils.track(AnalyticEvents.MOBILE_LURKER_PREVIEW_GUILD_ICON_CLICKED, {
guild_id: a0,
num_lurked_guilds: LurkingStore.lurkingGuildIds().length
});
}
export function trackLongPressLeaveClicked(a0) {
AnalyticsUtils.track(AnalyticEvents.MOBILE_LURKER_PREVIEW_LONG_PRESS_LEAVE_CLICKED, {
guild_id: a0,
num_lurked_guilds: LurkingStore.lurkingGuildIds().length
});
}
@@ -0,0 +1,161 @@
// Metro module 11528 (f11529).
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import LurkingStore from "./LurkingStore";
import LifecycleManager from "../../lib/LifecycleManager";
import { getMobileLurkerServerPreview } from "./experiments/MobileLurkerServerPreviewExperiment";
import Dispatcher from "../../Dispatcher";
import { stopLurkingForGuild } from "./LurkerActionCreators";
class LurkerPreviewManager extends LifecycleManager {
constructor() {
let c18937_0;
super(...arguments);
const _this = this;
this.timers = new Map();
this.viewedLurkingGuildIds = new Set();
this.navigatedAwayFromLurkingGuildIds = new Set();
this.handleStoreChange = () => {
_this.trackViewedLurkingGuilds();
_this.evictOverflowingLurkers();
_this.ensureMissingExpiries();
_this.expireElapsed();
_this.syncTimers();
};
this.trackViewedLurkingGuilds = () => {
let r23;
const set = new Set(LurkingStore.lurkingGuildIds());
let r34 = Array.from(_this.viewedLurkingGuildIds)[Symbol.iterator]();
const next = r34.next;
while (true) {
const r11 = r34 === void 0 ? void 0 : (r23 = next.call(r34)).done ? r34 = void 0 : r23.value;
if (r34 === void 0) {
for (const item of Array.from(_this.navigatedAwayFromLurkingGuildIds)) {
if (!set.has(item)) {
_this.navigatedAwayFromLurkingGuildIds.delete(item);
}
}
const guildId2 = SelectedGuildStore.getGuildId();
for (const viewedLurkingGuildId of _this.viewedLurkingGuildIds) {
const r77 = viewedLurkingGuildId;
if (viewedLurkingGuildId !== guildId2) {
_this.navigatedAwayFromLurkingGuildIds.add(r77);
}
}
if (guildId2 != null && set.has(guildId2)) {
_this.viewedLurkingGuildIds.add(guildId2);
}
return void 0;
} else {
try {
if (!set.has(r11)) {
_this.viewedLurkingGuildIds.delete(r11);
}
} catch (r45) {
if (r34 !== void 0 && typeof r34.return === "function") {
try {
r34.return();
} catch {}
}
throw r45;
}
}
}
};
this.evictOverflowingLurkers = () => {
const r7 = LurkingStore.lurkingGuildIds();
if (!(r7.length <= 3) && getMobileLurkerServerPreview("LurkerPreviewManager.evictOverflowingLurkers").stickyLurk) {
_this.expireLurkerPreviews(r7.slice(0, r7.length - 3));
}
};
this.ensureMissingExpiries = () => {
const r5 = LurkingStore.lurkingGuildIds();
if (r5.length !== 0) {
const lurkingPreviewExpirations = LurkingStore.getLurkingPreviewExpirations();
const guildId = SelectedGuildStore.getGuildId();
const guildIds = r5.filter((item) => lurkingPreviewExpirations[item] == null && item !== guildId && _this.viewedLurkingGuildIds.has(item));
if (guildIds.length !== 0 && getMobileLurkerServerPreview("LurkerPreviewManager.ensureMissingExpiries").stickyLurk) {
Dispatcher.dispatch({
type: "LURKER_PREVIEW_SET_EXPIRY",
guildIds,
expiresAt: Date.now() + 60000
});
}
}
};
this.expireElapsed = () => {
const lurkingPreviewExpirations3 = LurkingStore.getLurkingPreviewExpirations();
const guildId3 = SelectedGuildStore.getGuildId();
const guildId2 = RTCConnectionStore.getGuildId();
const r4 = Date.now();
const r29 = [];
for (const item of Object.keys(lurkingPreviewExpirations3)) {
if (item !== guildId3 && item !== guildId2 && lurkingPreviewExpirations3[item] <= r4) {
r29.push(item);
}
}
if (r29.length > 0) {
_this.expireLurkerPreviews(r29);
}
};
this.syncTimers = () => {
let c27103_0 = _this;
const lurkingPreviewExpirations2 = LurkingStore.getLurkingPreviewExpirations();
for (const item of Array.from(_this.timers.keys())) {
if (lurkingPreviewExpirations2[item] == null) {
const r44 = _this.timers.get(item);
if (r44 != null) {
clearTimeout(r44);
}
_this.timers.delete(item);
}
}
const _loop = function _loop(a0) {
if (c27103_0.timers.has(a0)) {
return 0;
}
const r11 = lurkingPreviewExpirations2[a0];
if (r11 <= Date.now()) {
return 0;
}
c27103_0.timers.set(a0, setTimeout(() => {
c27103_0.timers.delete(a0);
c27103_0.handleStoreChange();
}, r11 - Date.now()));
};
for (const item2 of Object.keys(lurkingPreviewExpirations2)) {
_loop(item2);
}
};
c18937_0 = void 0;
c18937_0 = async (c30418_0) => {
await Promise.all(c30418_0.map((item) => stopLurkingForGuild(item)));
};
this.expireLurkerPreviews = function(a0) {
return c18937_0.apply(this, arguments);
};
}
hasNavigatedAway(a0) {
return this.navigatedAwayFromLurkingGuildIds.has(a0);
}
_initialize() {
LurkingStore.addChangeListener(this.handleStoreChange);
SelectedGuildStore.addChangeListener(this.handleStoreChange);
RTCConnectionStore.addChangeListener(this.handleStoreChange);
this.handleStoreChange();
}
_terminate() {
LurkingStore.removeChangeListener(this.handleStoreChange);
SelectedGuildStore.removeChangeListener(this.handleStoreChange);
RTCConnectionStore.removeChangeListener(this.handleStoreChange);
for (const item of this.timers.values()) {
clearTimeout(item);
}
this.timers.clear();
this.viewedLurkingGuildIds.clear();
this.navigatedAwayFromLurkingGuildIds.clear();
}
}
const lurkerPreviewManager = new LurkerPreviewManager();
export default lurkerPreviewManager;
export const LURKER_PREVIEW_PERSIST_MS = 60000;
export const LURKER_PREVIEW_MAX_CONCURRENT = 3;
+226
View File
@@ -0,0 +1,226 @@
// Metro module 3818 (f3819).
import { isGuildLurker } from "../../records/GuildRecord";
import GuildMemberStore from "../../stores/GuildMemberStore";
import GuildStore from "../../stores/GuildStore";
import UserStore from "../../stores/UserStore";
import { JoinGuildSources, ME } from "../../Constants";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c2157_6 = [];
let c2157_7 = {};
let c2157_8 = {};
let c2157_9 = {};
class LurkingStore extends Module589.Store {
static displayName = "LurkingStore";
initialize() {
this.waitFor(GuildMemberStore, GuildStore, UserStore);
}
lurkingGuildIds() {
return c2157_6;
}
mostRecentLurkedGuildId() {
const length = c2157_6.length;
let r4 = null;
if (length !== 0) {
r4 = c2157_6[c2157_6.length - 1];
}
return r4;
}
isLurking(a0) {
const guild = GuildStore.getGuild(a0);
if (guild == null) {
return false;
}
const isCurrentUserGuest = GuildMemberStore.isCurrentUserGuest(a0);
const isGuildLurker2 = isGuildLurker(guild);
return Boolean(isCurrentUserGuest ? !isCurrentUserGuest : isGuildLurker2);
}
getLurkingSourceForGuild(a0) {
const r1 = a0 == null;
let r2 = null;
if (!r1) {
let r6 = c2157_8[a0];
if (r6 == null) {
r6 = null;
}
r2 = r6;
}
return r2;
}
getLoadId(a0) {
return a0 != null ? c2157_7[a0] : null;
}
getLurkingPreviewExpirations() {
return c2157_9;
}
getLurkingPreviewExpiry(a0) {
const r1 = a0 == null;
let r2 = null;
if (!r1) {
let r6 = c2157_9[a0];
if (r6 == null) {
r6 = null;
}
r2 = r6;
}
return r2;
}
}
const lurkingStore = new LurkingStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen() {
c2157_6 = GuildStore.getGuildsArray().filter((item) => isGuildLurker(item)).map((item) => item.id);
c2157_8 = {};
c2157_9 = {};
},
GUILD_JOIN: function handleGuildJoin({ guildId, lurker, source, directoryChannelId, loadId }) {
if (lurker) {
if (guildId !== ME && !c2157_6.includes(guildId)) {
c2157_6 = [...c2157_6, guildId];
}
if (loadId != null) {
c2157_7[guildId] = loadId;
}
delete c2157_9[guildId];
if (JoinGuildSources.MOBILE_GUILD_DISCOVERY === source) {
c2157_8[guildId] = {
type: JoinGuildSources.MOBILE_GUILD_DISCOVERY
};
} else if (JoinGuildSources.DIRECTORY_ENTRY === source) {
c2157_8[guildId] = {
type: JoinGuildSources.DIRECTORY_ENTRY,
directoryChannelId
};
} else {
delete c2157_8[guildId];
}
return true;
}
return false;
},
GUILD_STOP_LURKING: function handleGuildStopLurking({ ignoredGuildIds }) {
const r7 = Set;
if (ignoredGuildIds == null) {
ignoredGuildIds = [];
}
let c13623_0 = new r7([...ignoredGuildIds]);
return [...c2157_6].reduce((acc, item) => {
const r14 = c13623_0.has(item);
let r15 = acc;
if (!r14) {
const r9 = c2157_6.indexOf(item);
const r1 = r9 > -1;
let r17 = false;
if (r1) {
const r18 = [...c2157_6];
r18.splice(r9, 1);
c2157_6 = r18;
delete c2157_7[item];
delete c2157_8[item];
delete c2157_9[item];
r17 = true;
}
if (!r17) {
r17 = acc;
}
r15 = r17;
}
return r15;
}, false);
},
GUILD_STOP_LURKING_FOR_GUILD: function handleGuildStopLurkingForGuild({ lurkingGuildId }) {
const r7 = c2157_6.indexOf(lurkingGuildId);
const r2 = r7 > -1;
let r1 = false;
if (r2) {
const r12 = [...c2157_6];
r12.splice(r7, 1);
c2157_6 = r12;
delete c2157_7[lurkingGuildId];
delete c2157_8[lurkingGuildId];
delete c2157_9[lurkingGuildId];
r1 = true;
}
return r1;
},
GUILD_STOP_LURKING_FAILURE: function handleGuildStopLurkingFailure({ lurkingGuildId, lurkingSource }) {
if (lurkingGuildId !== ME && !c2157_6.includes(lurkingGuildId)) {
c2157_6 = [...c2157_6, lurkingGuildId];
}
if (lurkingSource == null) {
delete c2157_8[lurkingGuildId];
} else {
c2157_8[lurkingGuildId] = lurkingSource;
}
return true;
},
GUILD_CREATE: function handleGuildCreate({ guild }) {
const r1 = guild.joined_at == null || !c2157_6.includes(guild.id);
let r15 = !r1;
if (!r1) {
const id = guild.id;
const r19 = c2157_6.indexOf(id);
const r3 = r19 > -1;
r15 = true;
if (r3) {
const r20 = [...c2157_6];
r20.splice(r19, 1);
c2157_6 = r20;
delete c2157_7[id];
delete c2157_8[id];
delete c2157_9[id];
r15 = true;
}
}
return r15;
},
GUILD_DELETE: function handleGuildDelete({ guild }) {
let r14 = !!c2157_6.includes(guild.id);
if (r14) {
const id = guild.id;
const r18 = c2157_6.indexOf(id);
const r2 = r18 > -1;
r14 = true;
if (r2) {
const r19 = [...c2157_6];
r19.splice(r18, 1);
c2157_6 = r19;
delete c2157_7[id];
delete c2157_8[id];
delete c2157_9[id];
r14 = true;
}
}
return r14;
},
GUILD_MEMBER_ADD: function handleGuildMemberAdd(a0) {
const { guildId, joinedAt } = a0;
const r17 = a0.user.id !== UserStore.getCurrentUser()?.id || joinedAt == null || !c2157_6.includes(guildId);
let r21 = !r17;
if (!r17) {
const r24 = c2157_6.indexOf(guildId);
const r3 = r24 > -1;
r21 = true;
if (r3) {
const r25 = [...c2157_6];
r25.splice(r24, 1);
c2157_6 = r25;
delete c2157_7[guildId];
delete c2157_8[guildId];
delete c2157_9[guildId];
r21 = true;
}
}
return r21;
},
LURKER_PREVIEW_SET_EXPIRY: function handleLurkerPreviewSetExpiry({ guildIds, expiresAt }) {
let r0 = false;
for (const item of guildIds) {
if (c2157_6.includes(item) && c2157_9[item] !== expiresAt) {
c2157_9[item] = expiresAt;
r0 = true;
}
}
return r0;
}
});
export default lurkingStore;
@@ -0,0 +1,32 @@
// Metro module 6691 (f6692).
import ApexExperiment from "../../experiments/apex/ApexExperiment";
let c4290_0 = ApexExperiment({
name: "2026-05-mobile-lurker-server-preview",
kind: "user",
defaultConfig: {
enabled: false,
stickyLurk: false
},
variations: {
1: {
enabled: true,
stickyLurk: false
},
2: {
enabled: true,
stickyLurk: true
}
}
});
export default c4290_0;
export { c4290_0 as MobileLurkerServerPreviewExperiment };
export function useMobileLurkerServerPreview(a0) {
return c4290_0.useConfig({
location: a0
});
}
export function getMobileLurkerServerPreview(a0) {
return c4290_0.getConfig({
location: a0
});
}
@@ -0,0 +1,100 @@
// Metro module 14955 (f14956).
import { memo, useCallback, useEffect, useState } from "react";
import { View } from "react-native";
import ReanimatedRexport, { Easing, useSharedValue, useAnimatedProps } from "../../reanimated/ReanimatedRexport";
import Module8531, { Circle } from "../../../_bundle/Module8531";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { BADGE_PADDING } from "../../../design/void/native";
import * as _LurkerPreviewManager from "../LurkerPreviewManager";
import { useToken } from "../../../design/tokens/native/useToken";
import { withTiming } from "../../../design/animation/reanimated/timing/timing";
const PROGRESS_CIRCUMFERENCE = 2 * Math.PI * 6;
let c10581_8 = {
duration: 1000,
easing: Easing.linear
};
const AnimatedComponent = ReanimatedRexport.createAnimatedComponent(Circle);
const useStyles = createStyles({
outerRing: {
borderRadius: 20,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
position: "absolute",
bottom: -BADGE_PADDING,
right: -BADGE_PADDING,
padding: BADGE_PADDING,
height: 22,
width: 22,
alignItems: "center",
justifyContent: "center"
},
innerFill: {
borderRadius: 20,
backgroundColor: Module712.colors.BACKGROUND_MOD_STRONG,
height: 16,
width: 16,
alignItems: "center",
justifyContent: "center"
},
progressRing: {
position: "absolute",
transform: [{
rotate: "90deg"
}, {
scaleX: -1
}]
}
});
const __initData = {
code: "function LurkerPreviewCooldownBadgeTsx1(){const{PROGRESS_CIRCUMFERENCE,animatedProgress}=this.__closure;return{strokeDashoffset:PROGRESS_CIRCUMFERENCE*(1-animatedProgress.get())};}"
};
const r74 = memo(function LurkerPreviewCooldownBadge(props) {
let sharedValue;
const { expiresAt, totalDurationMs = _LurkerPreviewManager.LURKER_PREVIEW_PERSIST_MS } = props;
const LURKER_PREVIEW_PERSIST_MS = totalDurationMs;
const style = props.style;
sharedValue = void 0;
const styles = useStyles();
const token = useToken(Module712.colors.BACKGROUND_BRAND);
const callback = useCallback(() => {
const r9 = (expiresAt - Date.now()) / LURKER_PREVIEW_PERSIST_MS;
return 0.9 * (r9 < 0 ? 0 : r9 > 1 ? 1 : r9);
}, [expiresAt, LURKER_PREVIEW_PERSIST_MS]);
sharedValue = useSharedValue(callback());
useEffect(() => {
sharedValue.set(withTiming(callback(), c10581_8, "animate-always"));
let c27874_0 = setInterval(() => {
sharedValue.set(withTiming(callback(), c10581_8, "animate-always"));
}, 1000);
return () => {
clearInterval(c27874_0);
};
}, [sharedValue, callback]);
const r43 = () => ({
strokeDashoffset: PROGRESS_CIRCUMFERENCE * (1 - sharedValue.get())
});
r43.__closure = {
PROGRESS_CIRCUMFERENCE,
animatedProgress: sharedValue
};
r43.__workletHash = 7162520447613;
r43.__initData = __initData;
return <View style={[styles.outerRing, style]} pointerEvents="none" accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
<View style={styles.innerFill}>
<Module8531 width={16} height={16} style={styles.progressRing}>
<AnimatedComponent cx={8} cy={8} r={6} fill="none" stroke={token} strokeWidth={4} strokeDasharray={PROGRESS_CIRCUMFERENCE} strokeLinecap="butt" animatedProps={useAnimatedProps(r43)} />
</Module8531>
</View>
</View>;
});
export default r74;
export function useHasExpired(a0) {
const [state, setState] = useState(null);
useEffect(() => {
if (a0 != null) {
let c27875_0 = setTimeout(() => setState(a0), Math.max(0, a0 - Date.now()));
return () => clearTimeout(c27875_0);
}
}, [a0]);
return a0 != null && state === a0;
}
@@ -0,0 +1,44 @@
// Metro module 11527 (f11528).
import { memo, useCallback } from "react";
import ChannelStore from "../../../stores/ChannelStore";
import UserStore from "../../../stores/UserStore";
import LurkingStore from "../LurkingStore";
import { JoinGuildSources } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/Module589";
import { setHubProgressActionComplete } from "../../hub/HubProgressActionCreators";
import { HubProgressStep } from "../../../_bundle/Module1306";
import { trackJoinClicked } from "../LurkerPreviewAnalytics";
import LurkerPreviewManager from "../LurkerPreviewManager";
import GuildActionCreators from "../../../actions/GuildActionCreators";
import { Button } from "../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../intl/index.native";
import AvatarUtils from "../../../utils/AvatarUtils";
import UserUtils from "../../../utils/UserUtils";
const r29 = memo(function LurkerServerPreviewJoinButton(props) {
const { guildId, joinSource, onBeforeJoin } = props;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const callback = useCallback(() => {
const lurkingSourceForGuild = LurkingStore.getLurkingSourceForGuild(guildId);
if (lurkingSourceForGuild?.type === JoinGuildSources.DIRECTORY_ENTRY) {
const channel = ChannelStore.getChannel(lurkingSourceForGuild.directoryChannelId);
if (channel != null) {
setHubProgressActionComplete(channel.getGuildId(), HubProgressStep.JOIN_GUILD);
}
}
trackJoinClicked(guildId, joinSource, LurkerPreviewManager.hasNavigatedAway(guildId));
if (onBeforeJoin != null) {
onBeforeJoin();
}
GuildActionCreators.joinGuild(guildId, {
source: joinSource
});
}, [guildId, joinSource, onBeforeJoin]);
if (stateFromStores == null) {
return <Button grow variant="primary" size="md" text={intl.string(t.VJlc0S)} onPress={callback} />;
}
const userAvatarSource = AvatarUtils.getUserAvatarSource(stateFromStores, false);
return <Button grow variant="primary" size="md" text={intl.formatToPlainString(t["5qtVhX"], {
usernameHook: () => UserUtils.getFormattedName(stateFromStores)
})} icon={<Button.Icon source={userAvatarSource} variant="entity" />} onPress={callback} />;
});
export default r29;
@@ -0,0 +1,30 @@
// Metro module 8459 (f8460).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
const useStyles = createStyles({
pill: {
position: "absolute",
top: 16,
left: 16,
paddingHorizontal: 10,
paddingVertical: 4,
borderRadius: Module712.radii.lg,
backgroundColor: Module712.colors.WHITE
},
text: {
color: Module712.colors.BLACK,
textTransform: "uppercase",
letterSpacing: 0.5
}
});
export default function ServerPreviewPill() {
const styles = useStyles();
return <View style={styles.pill} accessibilityRole="text">
<Text variant="text-xs/bold" style={styles.text}>
{intl.string(t.KNhFgD)}
</Text>
</View>;
};
@@ -0,0 +1,87 @@
// Metro module 11530 (f11531).
import { useCallback } from "react";
import { StyleSheet, View } from "react-native";
import ChannelStore from "../../stores/ChannelStore";
import GuildStore from "../../stores/GuildStore";
import LurkingStore from "./LurkingStore";
import { JoinGuildSources } from "../../Constants";
import { openAlert } from "../../design/components/AlertModal/native/useAlertStore.native";
import GuildIcon, { GuildIconSizes, ImageSizes } from "../guild/native/GuildIcon";
import { createStyles } from "../../design/components/Styles/native/createStyles";
import { trackLeavePromptLeaveClicked, trackJoinClicked } from "./LurkerPreviewAnalytics";
import { AlertModal, AlertActionButton } from "../../design/components/AlertModal/native/AlertModal.native";
import { intl, t } from "../../intl/index.native";
import GuildBadgeV2 from "../guild/native/GuildBadgeV2";
import { Icon } from "../../design/void/native";
import { setHubProgressActionComplete } from "../hub/HubProgressActionCreators";
import { HubProgressStep } from "../../_bundle/Module1306";
import LurkerPreviewManager from "./LurkerPreviewManager";
import GuildActionCreators from "../../actions/GuildActionCreators";
let c7863_13, useStyles;
const LurkerLeavePromptModal = function LurkerLeavePromptModal(props) {
const { guild, onJoin: onJoin2 } = props;
const styles = useStyles();
const callback = useCallback(() => {
trackLeavePromptLeaveClicked(guild.id);
}, [guild.id]);
return <AlertModal title={guild.name} content={intl.string(t.I1yHxc)} header={<View style={styles.headerRoot}>
<View style={styles.iconWrapper}>
<GuildIcon guild={guild} size={GuildIconSizes.XLARGE} value={guild.name} />
<GuildBadgeV2 guild={guild} size={Icon.Sizes.LARGE} style={StyleSheet.flatten(styles.badgeOverlay)} />
</View>
</View>} actions={<>
<AlertActionButton variant="primary" text={intl.string(t.VJlc0S)} onPress={onJoin2} />
<AlertActionButton variant="secondary" text={intl.string(t["2vl7qn"])} onPress={callback} />
</>} />;
};
c7863_13 = new Set();
const width = ImageSizes[GuildIconSizes.XLARGE];
useStyles = createStyles({
headerRoot: {
alignItems: "center"
},
iconWrapper: {
width,
height: width,
position: "relative"
},
badgeOverlay: {
position: "absolute",
right: -4,
bottom: -4,
marginRight: 0
}
});
export function openLurkerLeavePrompt(a0, a1) {
let c18939_2;
const onLeave = a1.onLeave;
c18939_2 = void 0;
if (!c7863_13.has(a0)) {
const guild2 = GuildStore.getGuild(a0);
if (guild2 != null) {
c7863_13.add(a0);
c18939_2 = false;
openAlert(`lurker-leave-prompt:${a0}`, <LurkerLeavePromptModal guild={guild2} onJoin={() => {
c18939_2 = true;
const lurkingSourceForGuild = LurkingStore.getLurkingSourceForGuild(a0);
if (lurkingSourceForGuild?.type === JoinGuildSources.DIRECTORY_ENTRY) {
const channel = ChannelStore.getChannel(lurkingSourceForGuild.directoryChannelId);
if (channel != null) {
setHubProgressActionComplete(channel.getGuildId(), HubProgressStep.JOIN_GUILD);
}
}
trackJoinClicked(a0, JoinGuildSources.LEAVE_PROMPT_LURKER, LurkerPreviewManager.hasNavigatedAway(a0));
GuildActionCreators.joinGuild(a0, {
source: JoinGuildSources.LEAVE_PROMPT_LURKER
});
}} />, () => {
c7863_13.delete(a0);
if (!c18939_2) {
onLeave();
}
});
} else {
onLeave();
}
}
}