// Metro module 16251 (f16252). import { SWITCH_ACCOUNTS_MODAL_KEY } from "../Constants"; import { Routes } from "../../../Constants"; import Logger from "../../debug/Logger"; import Durations from "../../../utils/Durations"; import ModalActionCreators from "../../../actions/ModalActionCreators"; import MultiAccountManager from "../MultiAccountManager"; import { closeFastConnectSocket } from "../../gateway/native/fast_connect"; import { reportAccountSwitchTimeout } from "../MultiAccountActionCreators"; import { transitionTo } from "../../routing/router_utils"; import { MobileHomeDrawerExperiment } from "../../home_drawer/native/HomeDrawerExperiment"; import { setHomeDrawerState } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native"; import ToastActionCreators from "../../toast/native/ToastActionCreators"; import { intl, t } from "../../../intl/index.native"; import Module16254 from "../../../_bundle/Module16254"; function $mk99088($env) { return () => { const r3 = $env.$parent; const r2 = r3[1]; const r1 = r3[2]; const r7 = r2(r1[4]); const r12 = (0, r3[0])(r1[6])(r1[5], r1.paths); const r13 = r3[7]; r7.pushLazy(r12, {}, r13); if ($env[0].cancelled) { r2(r1[4]).popWithKey(r13); } }; } function $mk99089($env) { return () => { const r2 = $env; const r3 = r2[0]; r3.cancelled = false; const r4 = $env.$parent; const r6 = r4[0]; const r5 = r4[2]; const rootNavigationRef = r6(r5[7]).getRootNavigationRef(); if (rootNavigationRef != null && rootNavigationRef.isReady()) { r3.push(); } else { r6(r5[8]).ComponentDispatch.subscribeOnce(r4[4].NAVIGATOR_READY, $mk112706(r2)); } }; } function $mk99090($env) { return () => { $env[0].cancelled = true; const r5 = $env.$parent; (0, r5[1])(r5[2][4]).popWithKey(r5[7]); }; } function $mk112706($env) { return () => { const r2 = $env[0]; if (!r2.cancelled) { r2.push(); } }; } let c11681_0, c11680_10, c11680_11; let env11680; let env11681; const r7 = env11680 = {}; const c11680_6 = new Logger("MultiAccountManagerNative"); const c11680_7 = "switch-accounts-spinner-modal"; const c11680_8 = 15 * Durations.Millis.SECOND; env11680[9] = null; const r38 = { __proto__: (function MultiAccountModalManagerImpl() { let env22921; const r5 = { __proto__: new.target.prototype }; const r2 = env22921 = { $parent: env11680 }; env22921[0] = r5; r5.cancelled = false; r5.push = $mk99088(r2); r5.enqueue = $mk99089(r2); r5.pop = $mk99090(r2); return r5; }).prototype }; const r39 = env11681 = { $parent: r7 }; c11681_0 = r38; r38.cancelled = false; r38.push = $mk99088(r39); r38.enqueue = $mk99089(r39); r38.pop = $mk99090(r39); c11680_10 = r38; class MultiAccountManagerNative extends MultiAccountManager { constructor() { super(...arguments); } onSwitchStart() { ModalActionCreators.popWithKey(SWITCH_ACCOUNTS_MODAL_KEY); c11680_6.info("Closing fast-connect socket because of account switch logout"); closeFastConnectSocket(); c11680_10.enqueue(); if (env11680[9] !== null) { clearTimeout(env11680[9]); } env11680[9] = setTimeout(() => { c11680_10.pop(); reportAccountSwitchTimeout(); }, c11680_8); } onSwitchSuccess(c22922_0, a1) { if (a1) { transitionTo(Routes.ME, { navigationReplace: true }); if (MobileHomeDrawerExperiment.getConfig({ location: "multi-account" }).enableHome) { setHomeDrawerState(false); } } setTimeout(() => { ToastActionCreators.open({ key: "SWITCH_ACCOUNTS_TOAST_LOGIN_SUCCESS", content: intl.formatToPlainString(t.wx7O3L, { username: c22922_0.username }), icon: Module16254 }); }, 100); } onSwitchError() { ToastActionCreators.open({ key: "SWITCH_ACCOUNTS_TOAST_LOGIN_ERROR", content: intl.string(t.pqvKWA), icon: Module16254 }); } onSwitchComplete() { ModalActionCreators.popWithKey(SWITCH_ACCOUNTS_MODAL_KEY); c11680_10.pop(); if (env11680[9] !== null) { clearTimeout(env11680[9]); env11680[9] = null; } } } c11680_11 = MultiAccountManagerNative; const r58 = new MultiAccountManagerNative(); export default r58;