47 lines
2.0 KiB
TypeScript
47 lines
2.0 KiB
TypeScript
// Metro module 16271 (f16272).
|
|
import { ContactSyncModes, initialize } from "../../contact_sync/native/ContactSyncModalStore";
|
|
import NewUserStore from "../NewUserStore";
|
|
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
|
|
import { hasDeferredInvite } from "../../instant_invite/native/InstantInviteUtils";
|
|
import { getNextOnboardingStep, getKeyForOnboardingStep } from "./NewUserUtils";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
import { NEW_USER_MODAL_KEY } from "./components/NewUserModalTypes";
|
|
import { isAndroid } from "../../../utils/PlatformUtils";
|
|
import { isModalOpen } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
|
|
class RedesignNewUserManager extends AutomaticLifecycleManager {
|
|
_onboardingStepIndex = -1;
|
|
_lastShownStepIndex = -1;
|
|
actions = {
|
|
POST_CONNECTION_OPEN: () => this.handleConnectionOpen(),
|
|
ONBOARDING_START: () => this.handleOnboardingStart()
|
|
};
|
|
startOnboarding = () => {
|
|
initialize(hasDeferredInvite() ? ContactSyncModes.ONBOARDING_INVITE : ContactSyncModes.ONBOARDING);
|
|
getNextOnboardingStep(false, -1, -1).then((result) => {
|
|
result.lastShownStepIndex;
|
|
const onboardingStepIndex = result.onboardingStepIndex;
|
|
const keyForOnboardingStep = getKeyForOnboardingStep(onboardingStepIndex);
|
|
if (keyForOnboardingStep != null) {
|
|
ModalActionCreators.pushLazy(import("./components/NewUserModal"), {
|
|
initialRouteName: keyForOnboardingStep,
|
|
initialOnboardingStepIndex: onboardingStepIndex
|
|
}, NEW_USER_MODAL_KEY, {
|
|
fullScreenGestureEnabled: false,
|
|
presentation: isAndroid() ? "transparentModal" : "card",
|
|
animation: "slide_from_bottom"
|
|
});
|
|
}
|
|
});
|
|
};
|
|
handleOnboardingStart = () => {
|
|
this.startOnboarding();
|
|
};
|
|
handleConnectionOpen = () => {
|
|
if (NewUserStore.getType() != null && !isModalOpen()) {
|
|
this.startOnboarding();
|
|
}
|
|
};
|
|
}
|
|
const redesignNewUserManager = new RedesignNewUserManager();
|
|
export default redesignNewUserManager;
|