150 lines
5.8 KiB
TypeScript
150 lines
5.8 KiB
TypeScript
// Metro module 16124 (f16125).
|
|
import { useRef, useCallback, useMemo } from "react";
|
|
import SelectedGuildStore from "../../../../stores/SelectedGuildStore";
|
|
import { AgeGateAnalyticAction, AgeGateSource } from "../../AgeGateConstants";
|
|
import { ExistingUserAgeGateScreens } from "../ExistingUserAgeGateConstants";
|
|
import { AnalyticEvents } from "../../../../Constants";
|
|
import { isIOS } from "../../../../utils/PlatformUtils";
|
|
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
|
|
import Module16126 from "../../../../_bundle/Module16126";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { closeAgeGateModal } from "../../AgeGateModalActionCreators";
|
|
import GuildActionCreators from "../../../../actions/GuildActionCreators";
|
|
import ModalActionCreators from "../../../../actions/ModalActionCreators";
|
|
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
|
|
import { ImpressionNames } from "../../../../_bundle/Module503";
|
|
import { getHeaderBackButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
|
|
import ExistingUserAgeGate from "./ExistingUserAgeGate";
|
|
import ExistingUserAgeGateConfirm from "./ExistingUserAgeGateConfirm";
|
|
import AgeGateVerify from "./AgeGateVerify";
|
|
import AgeGateUnderage from "./AgeGateUnderage";
|
|
import NsfwGateGuild from "./NsfwGateGuild";
|
|
import { useShouldAgeVerifyForAgeGate } from "../../AgeGateUtils";
|
|
import { useWatchAgeVerificationStatusChange } from "../../../age_assurance/AgeVerificationUtils";
|
|
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
|
|
let renderHeaderTitle;
|
|
const onClose = function onClose() {
|
|
closeAgeGateModal();
|
|
};
|
|
renderHeaderTitle = function renderHeaderTitle() {
|
|
return null;
|
|
};
|
|
export default function ExistingUserAgeGateModal(props) {
|
|
const source = props.source;
|
|
const shouldAgeVerifyForAgeGate = useShouldAgeVerifyForAgeGate();
|
|
const ref = useRef(shouldAgeVerifyForAgeGate);
|
|
useWatchAgeVerificationStatusChange(useCallback(() => {
|
|
if (ref.current) {
|
|
closeAgeGateModal(source);
|
|
}
|
|
}, [source]));
|
|
return <Navigator screens={useMemo(() => {
|
|
let r7;
|
|
let source2;
|
|
let source3;
|
|
L14: {
|
|
source2 = source;
|
|
source3 = source;
|
|
if (AgeGateSource.NSFW_SERVER_INVITE !== source && AgeGateSource.NSFW_SERVER_INVITE_EMBED !== source) {
|
|
if (AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE !== source && AgeGateSource.ACCESS_LARGE_GUILD_UNDERAGE !== source && AgeGateSource.LARGE_GUILD !== source && AgeGateSource.NSFW_SERVER !== source) {
|
|
if (AgeGateSource.NSFW_CHANNEL === source) {
|
|
r7 = () => {
|
|
const guildId = SelectedGuildStore.getGuildId();
|
|
if (guildId != null) {
|
|
GuildActionCreators.nsfwReturnToSafety(guildId);
|
|
}
|
|
closeAgeGateModal(source3);
|
|
};
|
|
break L14;
|
|
}
|
|
if (AgeGateSource.NSFW_VOICE_CHANNEL === source) {
|
|
r7 = () => {
|
|
ModalActionCreators.popAll();
|
|
AnalyticsUtils.track(AnalyticEvents.AGE_GATE_ACTION, {
|
|
source: source3,
|
|
action: AgeGateAnalyticAction.AGE_GATE_CLOSE
|
|
});
|
|
};
|
|
break L14;
|
|
}
|
|
const FAMILY_CENTER = AgeGateSource.FAMILY_CENTER;
|
|
r7 = void 0;
|
|
if (FAMILY_CENTER !== source) {
|
|
break L14;
|
|
}
|
|
r7 = () => {
|
|
closeAgeGateModal(source3);
|
|
};
|
|
break L14;
|
|
}
|
|
r7 = () => {
|
|
const guildId = SelectedGuildStore.getGuildId();
|
|
if (guildId != null) {
|
|
GuildActionCreators.nsfwReturnToSafety(guildId);
|
|
}
|
|
closeAgeGateModal(source3);
|
|
ModalActionCreators.popAll();
|
|
};
|
|
} else {
|
|
r7 = () => {
|
|
closeAgeGateModal(source3);
|
|
};
|
|
}
|
|
}
|
|
if (r7 == null) {
|
|
r7 = () => {};
|
|
}
|
|
const r23 = {};
|
|
r23[ExistingUserAgeGateScreens.AgeGate] = {
|
|
fullscreen: true,
|
|
impressionName: ImpressionNames.USER_AGE_GATE,
|
|
impressionProperties: {
|
|
existing_user: true
|
|
},
|
|
headerLeft: getHeaderBackButton(r7),
|
|
headerTitle: renderHeaderTitle,
|
|
render: (a0, c28230_0) => <ExistingUserAgeGate onSuccess={source2 === AgeGateSource.NSFW_SERVER_INVITE && isIOS() ? () => {
|
|
c28230_0.push(ExistingUserAgeGateScreens.NSFWGateGuild);
|
|
ToastActionCreators.open({
|
|
key: "AGE_GATE_AGE_VERIFIED",
|
|
icon: Module16126,
|
|
content: intl.string(t.gUiIGZ)
|
|
});
|
|
} : () => {
|
|
closeAgeGateModal();
|
|
ToastActionCreators.open({
|
|
key: "AGE_GATE_AGE_VERIFIED",
|
|
icon: Module16126,
|
|
content: intl.string(t.gUiIGZ)
|
|
});
|
|
}} onClose={onClose} source={source2} />
|
|
};
|
|
r23[ExistingUserAgeGateScreens.AgeGateConfirm] = {
|
|
fullscreen: true,
|
|
headerTitle: renderHeaderTitle,
|
|
render: (a0) => <ExistingUserAgeGateConfirm {...a0} source={source2} />
|
|
};
|
|
r23[ExistingUserAgeGateScreens.Pawtect] = {
|
|
fullscreen: true,
|
|
headerLeft: getHeaderBackButton(r7),
|
|
impressionName: ImpressionNames.USER_AGE_GATE_VERIFY,
|
|
headerTitle: renderHeaderTitle,
|
|
render: () => <AgeGateVerify source={source2} />
|
|
};
|
|
r23[ExistingUserAgeGateScreens.Blocked] = {
|
|
fullscreen: true,
|
|
headerTitle: renderHeaderTitle,
|
|
impressionProperties: {
|
|
existing_user: true
|
|
},
|
|
render: (a0) => <AgeGateUnderage {...a0} />
|
|
};
|
|
r23[ExistingUserAgeGateScreens.NSFWGateGuild] = {
|
|
headerTitle: renderHeaderTitle,
|
|
headerLeft: getHeaderBackButton(r7),
|
|
render: () => <NsfwGateGuild onClose={onClose} />
|
|
};
|
|
return r23;
|
|
}, [source])} initialRouteName={shouldAgeVerifyForAgeGate ? ExistingUserAgeGateScreens.Pawtect : ExistingUserAgeGateScreens.AgeGate} headerBackTitle={intl.string(t["13/7kX"])} />;
|
|
};
|