This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,47 @@
// 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;