decord/stable/source/modules/multi_account/MultiAccountManager.tsx
2026-10-06 22:12:49 +00:00

70 lines
2.4 KiB
TypeScript

// Module ID: 17199
// Function ID: 17200
// Name: MultiAccountManager
// Dependencies: [1378, 13175, 6540, 585, 13176, 2]
// Module 17199 (MultiAccountManager)
import DispatcherDefault from "Dispatcher" /* 585 */;
import GatewaySocket from "GatewaySocket" /* 13176 */;
import UserStore from "UserStore" /* 1378 */;
import MultiAccountSwitchStore from "MultiAccountSwitchStore" /* 13175 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6540 */;
import size from "module_2" /* 2 */;
class MultiAccountManager extends AutomaticLifecycleManager {
constructor() {
const applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
require = applyArgumentsResult;
applyArgumentsResult.actions = {
LOGOUT(arg0) {
return require.handleLogout(arg0);
},
MULTI_ACCOUNT_SWITCH_START(targetUserId) {
return require.handleMultiAccountSwitchStart(targetUserId);
}
};
applyArgumentsResult.handleConnectionOpen = function handleConnectionOpen() {
const switchResult = MultiAccountSwitchStore.getSwitchResult();
if (null != switchResult) {
const currentUser = UserStore.getCurrentUser();
if (null != currentUser) {
let obj2;
if (switchResult.success) {
require.onSwitchSuccess(currentUser, switchResult.navigateHome);
obj2 = obj;
} else {
require.onSwitchError(currentUser);
obj2 = obj;
}
const obj3 = GatewaySocket;
const result = obj3.setAccountSwitchUserId(null);
obj2.onSwitchComplete();
}
}
};
return applyArgumentsResult;
}
_initialize() {
const obj = DispatcherDefault;
const subscription = obj.subscribe("CONNECTION_OPEN", this.handleConnectionOpen);
this.handleConnectionOpen();
}
_terminate() {
const obj = DispatcherDefault;
obj.unsubscribe("CONNECTION_OPEN", this.handleConnectionOpen);
}
handleLogout(isSwitchingAccount) {
if (isSwitchingAccount.isSwitchingAccount) {
const self = this;
this.onSwitchStart();
}
}
handleMultiAccountSwitchStart(targetUserId) {
const obj = GatewaySocket;
const result = obj.setAccountSwitchUserId(targetUserId.targetUserId);
}
}
const prototype = MultiAccountManager.prototype;
let result = size.fileFinishedImporting("modules/multi_account/MultiAccountManager.tsx");
export default MultiAccountManager;