// Metro module 16253 (f16254). import UserStore from "../../stores/UserStore"; import MultiAccountSwitchStore from "./MultiAccountSwitchStore"; import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager"; import Dispatcher from "../../Dispatcher"; import { setAccountSwitchUserId } from "../gateway/GatewaySocket"; class MultiAccountManager extends AutomaticLifecycleManager { actions = { LOGOUT: (a0) => this.handleLogout(a0), MULTI_ACCOUNT_SWITCH_START: (a0) => this.handleMultiAccountSwitchStart(a0) }; handleConnectionOpen = () => { let r15; const switchResult = MultiAccountSwitchStore.getSwitchResult(); if (switchResult != null) { const currentUser = UserStore.getCurrentUser(); if (currentUser != null) { const success = switchResult.success; if (success) { this.onSwitchSuccess(currentUser, switchResult.navigateHome); r15 = this; } else { this.onSwitchError(currentUser); r15 = this; } setAccountSwitchUserId(null); r15.onSwitchComplete(); } } }; _initialize() { Dispatcher.subscribe("CONNECTION_OPEN", this.handleConnectionOpen); this.handleConnectionOpen(); } _terminate() { Dispatcher.unsubscribe("CONNECTION_OPEN", this.handleConnectionOpen); } handleLogout(a0) { if (a0.isSwitchingAccount) { this.onSwitchStart(); } } handleMultiAccountSwitchStart(a0) { setAccountSwitchUserId(a0.targetUserId); } } export default MultiAccountManager;