/* Metro module 15770; source: modules/multi_account/native/MultiAccountManagerNative.tsx; dependencies: [7, 6, 11876, 11877, 661, 3, 672, 5080, 15771, 1962, 4008, 1239, 15772, 683, 1230, 4013, 4007, 3857, 1244, 15773, 25, 2] */ import Logger from '../../debug/Logger.tsx'; /* Metro dependency 3 */ import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import Durations from '../../../utils/Durations.tsx'; /* Metro dependency 672 */ import AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */ import ToastActionCreators from '../../toast/native/ToastActionCreators.tsx'; /* Metro dependency 3857 */ import ModalActionCreators from '../../../actions/ModalActionCreators.tsx'; /* Metro dependency 5080 */ import MultiAccountStore from '../MultiAccountStore.tsx'; /* Metro dependency 11876 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as ComponentDispatchUtilsModule from '../../../utils/ComponentDispatchUtils.tsx'; /* Metro dependency 1239 */ import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as RootNavigationRefNativeModule from '../../main_tabs_v2/RootNavigationRef.native.tsx'; /* Metro dependency 4008 */ import * as ConstantsModule2 from '../Constants.tsx'; /* Metro dependency 11877 */ import * as MultiAccountManagerModule from '../MultiAccountManager.tsx'; /* Metro dependency 15772 */ function _fun121171(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121171, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:6, offset: 0x0253ffad, size: 423 bytes, params: 8, frame: 20 let env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = CreateClass; const value5 = new (Logger)('MultiAccountManagerNative'); const Millis = (Durations).Millis; const SECOND = Millis.SECOND; const env0_10 = 15 * SECOND; value = value(MultiAccountModalManagerImpl); value = new value(); value = importDefault(15772) /* metro dependency 15772: MultiAccountManager */; value = new value({onSwitchStart: onSwitchStart, onSwitchSuccess: function(a0, a1) { var env0_0 = a0; var env0_1 = a1; global.setTimeout(_fun121181, 100); }, onSwitchError: function() { var defaultImport = importDefault(dependencyMap[17]); var object = {key: 'SWITCH_ACCOUNTS_TOAST_LOGIN_ERROR'}; object.content = require(dependencyMap[18]).intl.string(require(dependencyMap[18]).t.pqvKWA); object.icon = importDefault(dependencyMap[19]); defaultImport.open(object); }, onTokenSet: onTokenSet, onLogout: onLogout}); (FileImportTrackerModule).fileFinishedImporting('modules/multi_account/native/MultiAccountManagerNative.tsx'); exports.default = value; function MultiAccountModalManagerImpl() { // fn#121172, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:344, offset: 0x02540154, size: 77 bytes, params: 1, frame: 14 ClassCallCheck(this, MultiAccountModalManagerImpl); this.cancelled = false; this.push = push_121173; this.enqueue = enqueue; this.pop = pop_121176; function MultiAccountModalManagerImplPush() { // fn#121173, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:449, owner: MultiAccountModalManagerImpl.push, offset: 0x025401a1, size: 126 bytes, params: 1, frame: 18 const value = environment.__proto__; const defaultImport = importDefault(dependencyMap[7]); defaultImport.pushLazy(require(dependencyMap[9])(dependencyMap[8], dependencyMap.paths), {}, 'switch-accounts-spinner-modal'); if (env0_0.cancelled) { importDefault(dependencyMap[7]).popWithKey('switch-accounts-spinner-modal'); } } function enqueue() { // fn#121174, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:551, owner: MultiAccountModalManagerImpl.enqueue, offset: 0x0254021f, size: 143 bytes, params: 1, frame: 15 const ComponentDispatch = (ComponentDispatchUtilsModule).ComponentDispatch; env0_0.cancelled = false; const rootNavigationRef = (RootNavigationRefNativeModule).getRootNavigationRef(); if (rootNavigationRef == null) { ComponentDispatch.subscribeOnce(ComponentActions.NAVIGATOR_READY, _fun121175); } else if (rootNavigationRef.isReady()) { env0_0.push(); } else { ComponentDispatch.subscribeOnce(ComponentActions.NAVIGATOR_READY, _fun121175); } function _fun121175() { // fn#121175, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:705, offset: 0x025402ae, size: 33 bytes, params: 1, frame: 9 if (!env1_0.cancelled) { env1_0.push(); } } } function MultiAccountModalManagerImplPop() { // fn#121176, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:751, owner: MultiAccountModalManagerImpl.pop, offset: 0x025402cf, size: 59 bytes, params: 1, frame: 12 env0_0.cancelled = true; const value = environment.__proto__; (ModalActionCreators).popWithKey('switch-accounts-spinner-modal'); } } function onSwitchStart() { // fn#121177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:818, offset: 0x0254030a, size: 114 bytes, params: 1, frame: 14 (ModalActionCreators).popWithKey(SWITCH_ACCOUNTS_MODAL_KEY); env0_12.enqueue(); if (env0_11 !== null) { global.clearTimeout(env0_11); } env0_11 = global.setTimeout(_fun121178, env0_10); function _fun121178() { // fn#121178, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:908, offset: 0x0254037c, size: 172 bytes, params: 1, frame: 19 var environment; const value = environment.__proto__; env1_12.pop(); const {previousUserId, expectedUserId, switchLocation, hasEverConnected} = (MultiAccountManagerModule).getMultiAccountManagerState(); const defaultImport = AnalyticsUtils; const track = defaultImport.track; const MULTI_ACCOUNT_SWITCH_TIMEOUT = AnalyticEvents.MULTI_ACCOUNT_SWITCH_TIMEOUT; const object = {from_user_id: previousUserId, to_user_id: expectedUserId}; object.linked_user_ids = MultiAccountStore.getUsers().map(function(a0) { return a0.id; }); object.has_ever_connected = hasEverConnected; object.switch_origin = switchLocation; Reflect.apply(track, defaultImport, [MULTI_ACCOUNT_SWITCH_TIMEOUT, object]); } } function onSwitchSuccess(a0, a1) { // fn#121180, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:1212, offset: 0x02540428, size: 44 bytes, params: 3, frame: 13 const env0_0 = a0; const env0_1 = a1; global.setTimeout(_fun121181, 100); function _fun121181() { // fn#121181, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:1245, offset: 0x02540454, size: 283 bytes, params: 1, frame: 20 var value2; var moduleValue; var MobileHomeDrawerExperiment; if (require) { value2 = environment.__proto__; moduleValue = require(1230) /* metro dependency 1230: router_utils */; moduleValue.transitionTo(Routes.ME); MobileHomeDrawerExperiment = (require(4013) /* metro dependency 4013: HomeDrawerExperiment */).MobileHomeDrawerExperiment; if (MobileHomeDrawerExperiment.getConfig({location: 'multi-account'}).enableHome) { (require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */).setHomeDrawerState(false); } } const defaultImport = ToastActionCreators; const open = defaultImport.open; const object = {key: 'SWITCH_ACCOUNTS_TOAST_LOGIN_SUCCESS'}; const intl = (IndexNativeModule).intl; const formatToPlainString = intl.formatToPlainString; const wx7O3L = (IndexNativeModule).t.wx7O3L; const username = env0_0.username; object.content = Reflect.apply(formatToPlainString, intl, [wx7O3L, {username: username}]); object.icon = importDefault(15773) /* metro dependency 15773 */; Reflect.apply(open, defaultImport, [object]); } } function onTokenSet() { // fn#121183, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:1701, offset: 0x025405ea, size: 44 bytes, params: 1, frame: 12 env0_12.pop(); global.clearTimeout(env0_11); } function onLogout(a0) { // fn#121184, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15978:1746, offset: 0x02540616, size: 72 bytes, params: 2, frame: 12 if (a0.isSwitchingAccount) { env0_9.info('Closing fast-connect socket because of account switch logout'); (require(25) /* metro dependency 25: fast_connect */).closeFastConnectSocket(); } } } global.__d(_fun121171, 15770, [7, 6, 11876, 11877, 661, 3, 672, 5080, 15771, 1962, 4008, 1239, 15772, 683, 1230, 4013, 4007, 3857, 1244, 15773, 25, 2]) /* metro module 15770, dependencies: [7, 6, 11876, 11877, 661, 3, 672, 5080, 15771, 1962, 4008, 1239, 15772, 683, 1230, 4013, 4007, 3857, 1244, 15773, 25, 2] */;