decord/source/modules/multi_account/native/MultiAccountManagerNative.tsx
github-actions da5b5e5efe chore: update source for alpha 346.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-12 13:45:10 +00:00

147 lines
5.1 KiB
TypeScript

// Module ID: 17540
// Function ID: 17541
// Name: MultiAccountManagerNative
// Dependencies: [12543, 1074, 3, 1090, 4839, 17541, 1896, 4495, 1109, 17542, 15, 12546, 1100, 4500, 4494, 4335, 1114, 17543, 2]
// Module 17540 (MultiAccountManagerNative)
import LoggerDefault from "Logger" /* 3 */;
import DurationsDefault from "Durations" /* 1090 */;
import ToastActionCreatorsDefault from "ToastActionCreators" /* 4335 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4839 */;
import Constants2 from "Constants" /* 12543 */;
import _modDef17543 from "module_17543" /* 17543 */;
import Constants from "Constants" /* 1074 */;
import MultiAccountManager from "MultiAccountManager" /* 17542 */;
import size from "module_2" /* 2 */;
const SWITCH_ACCOUNTS_MODAL_KEY = Constants2.SWITCH_ACCOUNTS_MODAL_KEY;
({ ComponentActions: closure_4, Routes: hasOwnProperty } = Constants);
const logger = new LoggerDefault("MultiAccountManagerNative");
let c7 = "switch-accounts-spinner-modal";
let closure_8 = 15 * DurationsDefault.Millis.SECOND;
let c9 = null;
let obj = Object.create(function MultiAccountModalManagerImpl() {
obj = Object.create(new.target.prototype);
obj.cancelled = false;
obj.push = function push() {
obj = ModalActionCreatorsDefault;
obj.pushLazy(obj(1896)(17541, dependencyMap.paths), {}, c7);
if (obj.cancelled) {
ModalActionCreatorsDefault.popWithKey(c7);
const tmpResult = ModalActionCreatorsDefault;
}
};
obj.enqueue = function enqueue() {
obj.cancelled = false;
obj = obj(4495);
const rootNavigationRef = obj.getRootNavigationRef();
if (null != rootNavigationRef) {
if (rootNavigationRef.isReady()) {
obj.push();
}
}
const ComponentDispatch = obj(1109).ComponentDispatch;
ComponentDispatch.subscribeOnce(constants.NAVIGATOR_READY, () => {
if (!cancelled.cancelled) {
cancelled.push();
}
});
};
obj.pop = function pop() {
obj.cancelled = true;
obj = ModalActionCreatorsDefault;
obj.popWithKey(c7);
};
return obj;
}.prototype.prototype);
obj.cancelled = false;
obj.push = function push() {
obj = ModalActionCreatorsDefault;
obj.pushLazy(obj(1896)(17541, dependencyMap.paths), {}, c7);
if (obj.cancelled) {
ModalActionCreatorsDefault.popWithKey(c7);
const tmpResult = ModalActionCreatorsDefault;
}
};
obj.enqueue = function enqueue() {
obj.cancelled = false;
obj = obj(4495);
const rootNavigationRef = obj.getRootNavigationRef();
if (null != rootNavigationRef) {
if (rootNavigationRef.isReady()) {
obj.push();
}
}
const ComponentDispatch = obj(1109).ComponentDispatch;
ComponentDispatch.subscribeOnce(constants.NAVIGATOR_READY, () => {
if (!cancelled.cancelled) {
cancelled.push();
}
});
};
obj.pop = function pop() {
obj.cancelled = true;
obj = ModalActionCreatorsDefault;
obj.popWithKey(c7);
};
class MultiAccountManagerNative extends tmp5 {
}
const prototype = MultiAccountManagerNative.prototype;
prototype["onSwitchStart"] = function onSwitchStart() {
obj = ModalActionCreatorsDefault;
obj.popWithKey(SWITCH_ACCOUNTS_MODAL_KEY);
logger.info("Closing fast-connect socket because of account switch logout");
let result = obj(15).closeFastConnectSocket();
obj.enqueue();
if (null !== timeout) {
const _clearTimeout = clearTimeout;
clearTimeout(timeout);
}
timeout = setTimeout(() => {
closure_1_10.pop();
const result = closure_1_0(dependencyMap[11]).reportAccountSwitchTimeout();
}, closure_8);
};
prototype["onSwitchSuccess"] = function onSwitchSuccess(currentUser, navigateHome) {
const user = currentUser;
if (navigateHome) {
user(1100).transitionTo(constants2.ME, { navigationReplace: true });
const MobileHomeDrawerExperiment = user(4500).MobileHomeDrawerExperiment;
if (MobileHomeDrawerExperiment.getConfig({ location: "multi-account" }).enableHome) {
tmp(4494).setHomeDrawerState(false);
const tmpResult = tmp(4494);
}
obj = user(1100);
tmp = user;
}
const timerId = setTimeout(() => {
obj = ToastActionCreatorsDefault;
const obj2 = { key: "SWITCH_ACCOUNTS_TOAST_LOGIN_SUCCESS", content: null, icon: null };
const intl = obj(1114).intl;
obj2.content = intl.formatToPlainString(obj(1114).t.wx7O3L, { username: user.username });
obj2.icon = _modDef17543;
obj.open(obj2);
}, 100);
};
prototype["onSwitchError"] = function onSwitchError() {
obj = ToastActionCreatorsDefault;
const obj2 = { key: "SWITCH_ACCOUNTS_TOAST_LOGIN_ERROR", content: null, icon: null };
const intl = obj(1114).intl;
obj2.content = intl.string(obj(1114).t.pqvKWA);
obj2.icon = _modDef17543;
obj.open(obj2);
};
prototype["onSwitchComplete"] = function onSwitchComplete() {
obj = ModalActionCreatorsDefault;
obj.popWithKey(SWITCH_ACCOUNTS_MODAL_KEY);
obj.pop();
if (null !== c9) {
const _clearTimeout = clearTimeout;
clearTimeout(c9);
c9 = null;
}
};
const multiAccountManagerNative = new MultiAccountManagerNative();
let result = size.fileFinishedImporting("modules/multi_account/native/MultiAccountManagerNative.tsx");
export default multiAccountManagerNative;