decord/beta/source/modules/multi_account/MultiAccountManager.tsx

71 lines
2.4 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 18176
// Function ID: 18177
// Name: MultiAccountManager
2026-10-12 16:32:48 +00:00
// Dependencies: [1390, 13929, 6808, 584, 13930, 2]
2026-10-12 16:32:48 +00:00
// Module 18176 (MultiAccountManager)
2026-10-07 22:43:51 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-12 16:32:48 +00:00
import GatewaySocket from "GatewaySocket" /* 13930 */;
import UserStore from "UserStore" /* 1390 */;
import MultiAccountSwitchStore from "MultiAccountSwitchStore" /* 13929 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6808 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
class MultiAccountManager extends AutomaticLifecycleManager {
constructor() {
2026-10-01 14:13:23 +00:00
const applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
require = applyArgumentsResult;
applyArgumentsResult.actions = {
LOGOUT(arg0) {
2026-10-01 14:13:23 +00:00
return require.handleLogout(arg0);
},
MULTI_ACCOUNT_SWITCH_START(targetUserId) {
2026-10-01 14:13:23 +00:00
return require.handleMultiAccountSwitchStart(targetUserId);
}
};
applyArgumentsResult.handleConnectionOpen = function handleConnectionOpen() {
2026-10-01 14:13:23 +00:00
const switchResult = MultiAccountSwitchStore.getSwitchResult();
if (null != switchResult) {
const currentUser = UserStore.getCurrentUser();
if (null != currentUser) {
2026-10-01 14:13:23 +00:00
let obj2;
if (switchResult.success) {
2026-10-01 14:13:23 +00:00
require.onSwitchSuccess(currentUser, switchResult.navigateHome);
obj2 = obj;
} else {
2026-10-01 14:13:23 +00:00
require.onSwitchError(currentUser);
obj2 = obj;
}
2026-10-01 14:13:23 +00:00
const obj3 = GatewaySocket;
const result = obj3.setAccountSwitchUserId(null);
obj2.onSwitchComplete();
}
}
};
return applyArgumentsResult;
}
2026-10-01 14:13:23 +00:00
_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;