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

+17
View File
@@ -0,0 +1,17 @@
// Metro module 11509 (f11510).
const r9 = {
YOU_ACCOUNT_ACTION_SHEET: "you_account_action_sheet",
CHOOSE_ACCOUNT: "choose_account",
MANAGE_ACCOUNTS_MODAL: "manage_accounts_modal",
MULTI_ACCOUNTS_LIST: "multi_accounts_list",
MULTI_ACCOUNT_MENU: "multi_account_menu",
PUSH_NOTIFICATION_INITIAL: "push_notification_initial",
PUSH_NOTIFICATION: "push_notification",
SHARE_EXTENSION: "share_extension"
};
export const MAX_ACCOUNTS = 5;
export const SWITCH_ACCOUNTS_MODAL_KEY = "switch-accounts-modal";
export const MULTI_ACCOUNT_LOGIN_MODAL_KEY = "multiaccount-login-modal";
export const MULTIACCOUNT_TOOLTIP_SEEN_KEY = "multiaccount_cta_tooltip_seen";
export const MANAGE_EDIT_TRANSITION_DURATION = 200;
export { r9 as MultiAccountSwitchLocation };
@@ -0,0 +1,181 @@
// Metro module 11512 (f11513).
import AuthenticationStore from "../../stores/AuthenticationStore";
import MultiAccountStore from "./MultiAccountStore";
import { Endpoints, AnalyticEvents } from "../../Constants";
import Logger from "../debug/Logger";
import { getToken } from "../../_bundle/setSecondaryToken";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import AuthenticationActionCreators from "../../actions/AuthenticationActionCreators";
let env7846 = {};
const c7846_9 = new Logger("MultiAccountActionCreators");
export function validateMultiAccountTokens() {
let env18915 = {
$parent: env7846
};
env18915[0] = AuthenticationStore.getId();
const users = MultiAccountStore.getUsers();
let c18916_0 = async (c30413_0) => {
let id, c30413_3, c30413_4;
let c30413_5 = 0;
let c31629_0, c31629_1, c31629_2, c31629_3, c31629_4, c31629_5, c31629_6;
const r17 = void 0;
L25: {
L21: {
try {
c30413_3 = r17;
c31629_0 = void 0;
c31629_0 = c30413_0.id;
c31629_1 = void 0;
c31629_2 = void 0;
c31629_3 = void 0;
c31629_4 = void 0;
c31629_5 = void 0;
await void 0;
c31629_1 = getToken(c31629_0);
if (c31629_1 != null) {
if (c31629_1 !== "") {
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_VALIDATE_TOKEN_REQUEST",
userId: c31629_0
});
c30413_5 = 1;
c31629_2 = await HTTP.get({
url: Endpoints.ME,
headers: {
authorization: c31629_1
},
retries: 3,
rejectWithError: false
});
c30413_5 = 0;
const id2 = c31629_2.body?.id;
id = id2;
if (id2 == null) {
id = null;
}
c31629_4 = id;
if (c31629_4 != null) {
if (c31629_4 !== c31629_0) {
c31629_5 = {
expected_user_id: c31629_0,
actual_user_id: c31629_4
};
c7846_9.log("Found per-user token authentication mismatch", c31629_5);
AnalyticsUtils.track(AnalyticEvents.MULTI_ACCOUNT_VALIDATE_TOKEN_USER_MISMATCH, c31629_5);
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE",
userId: c31629_0
});
break L21;
}
}
if (c30413_3.$parent[0] !== c31629_0) {
Dispatcher.dispatch({
type: "USER_UPDATE",
user: c31629_2.body
});
}
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_VALIDATE_TOKEN_SUCCESS",
userId: c31629_0
});
break L25;
}
}
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE",
userId: c31629_0
});
break L25;
} catch ($e) {
const r34 = $e;
let r7 = r34;
c30413_4 = r34;
if (c30413_5 !== 0) {
while (true) {
try {
const r199 = c30413_4;
c30413_5 = 0;
c31629_6 = r199;
c31629_3 = c31629_6?.status === 401 || c31629_6?.status === 403;
Dispatcher.dispatch({
type: c31629_3 ? "MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE" : "MULTI_ACCOUNT_VALIDATE_TOKEN_SUCCESS",
userId: c31629_0
});
} catch (r196) {
r7 = r196;
c30413_4 = r196;
if (c30413_5 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r7;
}
}
return void 0;
}
};
users.forEach(function() {
return c18916_0.apply(this, arguments);
});
}
export function switchAccount(a0, a1, a2) {
let r30;
c7846_9.log(`Switching account to ${a0}`, {
switchSynchronously: a1
});
const token = getToken(a0);
if (token == null) {
c7846_9.log("Switching accounts failed because there was no token");
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE",
userId: a0
});
r30 = Promise.resolve();
} else {
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_SWITCH_START",
targetUserId: a0,
location: a2 == null ? null : a2
});
r30 = AuthenticationActionCreators.switchAccountToken(token, a1);
}
return r30;
}
export function moveAccount(a0, a1) {
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_MOVE_ACCOUNT",
from: a0,
to: a1
});
}
export function removeAccount(a0) {
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_REMOVE_ACCOUNT",
userId: a0
});
}
export function updatePushSyncToken(a0, a1) {
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_UPDATE_PUSH_SYNC_TOKEN",
userId: a0,
pushSyncToken: a1
});
}
export function invalidatePushSyncTokens(a0) {
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_INVALIDATE_PUSH_SYNC_TOKENS",
invalidPushSyncTokens: a0
});
}
export function reportAccountSwitchTimeout() {
Dispatcher.dispatch({
type: "MULTI_ACCOUNT_SWITCH_TIMEOUT"
});
}
@@ -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;
+193
View File
@@ -0,0 +1,193 @@
// Metro module 11508 (f11509).
import { MAX_ACCOUNTS } from "./Constants";
import isStaffFromRawUser from "../user/isStaffFromRawUser";
import { removeToken } from "../../_bundle/setSecondaryToken";
import { moveItemFromTo } from "../../utils/DragAndDropUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
function $mk87423($env) {
return (a0) => a0.id !== $env[0];
}
function $mk87424($env) {
return (a0) => a0.id === $env[0];
}
let id, canUseMultiAccountMobile;
let c7843_7 = {
INVALID: 0,
0: "INVALID",
VALIDATING: 1,
1: "VALIDATING",
VALID: 2,
2: "VALID"
};
const users = [];
class MultiAccountStore extends Module589.PersistedStore {
static displayName = "MultiAccountStore";
static persistKey = "MultiAccountStore";
static migrations = [(a0) => {
let r1;
if (a0 != null) {
let users2 = a0.users;
if (users2 == null) {
users2 = [];
}
r1 = {
users: users2,
canUseMultiAccountMobile: false
};
} else {
r1 = {
users: [],
canUseMultiAccountMobile: false
};
}
return r1;
}];
initialize(a0) {
if (a0 != null) {
let users2 = a0.users;
if (users2 == null) {
users2 = [];
}
users = users2;
canUseMultiAccountMobile = a0.canUseMultiAccountMobile;
}
}
getCanUseMultiAccountMobile() {
return canUseMultiAccountMobile;
}
getState() {
return {
users,
canUseMultiAccountMobile
};
}
getUsers() {
return users;
}
getValidUsers() {
return users.filter((user) => user.tokenStatus !== c7843_7.INVALID);
}
getHasLoggedInAccounts() {
return users.length > 0;
}
getIsValidatingUsers() {
return users.some((user) => user.tokenStatus === c7843_7.VALIDATING);
}
get canUseMultiAccountNotifications() {
return this.getCanUseMultiAccountMobile();
}
}
const multiAccountStore = new MultiAccountStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen({ user }) {
id = user.id;
const r6 = canUseMultiAccountMobile;
if (r6 ? !r6 : isStaffFromRawUser(user)) {
canUseMultiAccountMobile = true;
}
const r17 = users.slice();
const r20 = r17.findIndex((item) => item.id === user.id);
if (r20 > -1) {
users[r20].avatar = user.avatar;
users[r20].username = user.username;
users[r20].discriminator = user.discriminator;
users[r20].tokenStatus = c7843_7.VALID;
users = r17;
} else {
r17.push({
id: user.id,
avatar: user.avatar,
username: user.username,
discriminator: user.discriminator,
tokenStatus: c7843_7.VALID,
pushSyncToken: null
});
users = r17;
}
if (r17.length > MAX_ACCOUNTS) {
users.splice(MAX_ACCOUNTS).forEach(({ id: id2 }) => {
let env27091;
const r6 = env27091 = {};
env27091[0] = id2;
users = users.filter($mk87423(r6));
removeToken(id2);
});
}
},
LOGOUT: function handleLogout(a0) {
if (!a0.isSwitchingAccount) {
users = users.filter((user) => user.id !== id);
}
id = null;
},
MULTI_ACCOUNT_VALIDATE_TOKEN_REQUEST: ({ userId: userId2 }) => {
let env18908;
const VALIDATING = c7843_7.VALIDATING;
const r7 = env18908 = {};
env18908[0] = userId2;
const r9 = users.slice();
const r12 = r9.find($mk87424(r7));
if (r12 != null) {
r12.tokenStatus = VALIDATING;
users = r9;
}
},
MULTI_ACCOUNT_VALIDATE_TOKEN_SUCCESS: ({ userId: userId2 }) => {
let env18909;
const VALID = c7843_7.VALID;
const r7 = env18909 = {};
env18909[0] = userId2;
const r9 = users.slice();
const r12 = r9.find($mk87424(r7));
if (r12 != null) {
r12.tokenStatus = VALID;
users = r9;
}
},
MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE: ({ userId: userId2 }) => {
let env18910;
const INVALID = c7843_7.INVALID;
const r7 = env18910 = {};
env18910[0] = userId2;
const r9 = users.slice();
const r12 = r9.find($mk87424(r7));
if (r12 != null) {
r12.tokenStatus = INVALID;
users = r9;
}
},
MULTI_ACCOUNT_REMOVE_ACCOUNT: ({ userId: userId2 }) => {
let env18911;
const r6 = env18911 = {};
env18911[0] = userId2;
users = users.filter($mk87423(r6));
removeToken(userId2);
},
MULTI_ACCOUNT_MOVE_ACCOUNT: function handleMoveAccount(a0) {
users = moveItemFromTo(users, a0.from, a0.to);
},
CURRENT_USER_UPDATE: function handleCurrentUserUpdate({ user: user2 }) {
const r7 = users.slice();
const r10 = r7.find((item) => item.id === user2.id);
if (r10 != null) {
r10.avatar = user2.avatar;
r10.username = user2.username;
r10.discriminator = user2.discriminator;
users = r7;
}
},
MULTI_ACCOUNT_UPDATE_PUSH_SYNC_TOKEN: function handleUpdatePushSyncToken({ userId, pushSyncToken }) {
users = users.map((user) => user.id === userId ? {
...user,
pushSyncToken
} : user);
},
MULTI_ACCOUNT_INVALIDATE_PUSH_SYNC_TOKENS: function handleInvalidatePushSyncTokens({ invalidPushSyncTokens }) {
users = users.map((user) => user.pushSyncToken != null ? invalidPushSyncTokens.includes(user.pushSyncToken) ? {
...user,
pushSyncToken: null
} : user : user);
}
});
export default multiAccountStore;
export { c7843_7 as MultiAccountTokenStatus };
@@ -0,0 +1,202 @@
// Metro module 12772 (f12773).
import MultiAccountStore from "./MultiAccountStore";
import { AnalyticEvents } from "../../Constants";
import Logger from "../debug/Logger";
import { getLastFastConnectIdentifyUserId } from "../gateway/native/fast_connect";
import * as _setSecondaryToken from "../../_bundle/setSecondaryToken";
import { removeToken, getToken } from "../../_bundle/setSecondaryToken";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
function $mk90387() {
return (a0) => a0.id;
}
let c8803_6 = new Logger("MultiAccountSwitchStore");
const id = null;
const id2 = null;
const targetUserId = null;
const location2 = null;
let c8803_11 = false;
let has_ever_connected = false;
let navigateHome = false;
let c8803_14 = null;
class MultiAccountSwitchStore extends Module589.Store {
static displayName = "MultiAccountSwitchStore";
initialize() {
this.waitFor(MultiAccountStore);
}
getIsSwitchingAccount() {
return c8803_11;
}
getSwitchResult() {
return c8803_14;
}
}
const multiAccountSwitchStore = new MultiAccountSwitchStore(Dispatcher, {
MULTI_ACCOUNT_SWITCH_START: function handleSwitchStart(a0) {
targetUserId = a0.targetUserId;
location2 = a0.location;
},
MULTI_ACCOUNT_SWITCH_TIMEOUT: function handleSwitchTimeout() {
AnalyticsUtils.track(AnalyticEvents.MULTI_ACCOUNT_SWITCH_TIMEOUT, {
from_user_id: id2,
to_user_id: targetUserId,
linked_user_ids: MultiAccountStore.getUsers().map((item) => item.id),
has_ever_connected,
switch_origin: location2
});
return false;
},
LOGOUT: function handleLogout(a0) {
c8803_11 = !!a0.isSwitchingAccount;
if (a0.isSwitchingAccount) {
id2 = id;
navigateHome = !!a0.goHomeAfterSwitching;
c8803_6.log("logout from account switch", {
current_user_id: id,
expected_user_id: targetUserId,
fast_connect_user_id: getLastFastConnectIdentifyUserId(),
switch_origin: location2
});
} else {
navigateHome = false;
removeToken(id);
}
},
CONNECTION_OPEN: function handleConnectionOpen({ user }) {
if (c8803_11) {
const id5 = user.id;
const r22 = c8803_11 && true;
L14: {
if (r22) {
const token2 = getToken(id5);
const token3 = getToken();
const is_user_mismatch = targetUserId != null && id5 !== targetUserId;
const is_token_mismatch = token2 != null && token3 != null && token2 !== token3;
if (!is_token_mismatch && !is_user_mismatch) {
break L14;
}
const r32 = {
...{
from_user_id: id2,
to_user_id: targetUserId,
actual_user_id: id5,
fast_connect_user_id: getLastFastConnectIdentifyUserId(),
linked_user_ids: MultiAccountStore.getUsers().map($mk90387()),
has_ever_connected,
switch_origin: location2
},
user_token_exists: token2 != null,
main_token_exists: token3 != null,
is_token_mismatch,
is_user_mismatch
};
c8803_6.log("Token mismatch on account switch connection open", r32);
AnalyticsUtils.track(AnalyticEvents.MULTI_ACCOUNT_SWITCH_READY_MISMATCH, r32);
}
}
const success = id2 !== user.id;
const r64 = {
from_user_id: id2,
to_user_id: targetUserId,
actual_user_id: user.id,
fast_connect_user_id: getLastFastConnectIdentifyUserId(),
linked_user_ids: MultiAccountStore.getUsers().map($mk90387()),
has_ever_connected,
switch_origin: location2
};
if (success) {
AnalyticsUtils.track(AnalyticEvents.MULTI_ACCOUNT_SWITCH_SUCCESS, r64);
if (c8803_11 && true) {
c8803_6.log("Account switch success", r64);
}
} else {
AnalyticsUtils.track(AnalyticEvents.MULTI_ACCOUNT_SWITCH_FAILURE, r64);
if (c8803_11 && true) {
c8803_6.log("Account switch failure", r64);
}
}
c8803_14 = {
success,
navigateHome
};
} else {
c8803_14 = null;
}
const token4 = getToken();
if (token4 != null && token4 !== "") {
const id3 = user.id;
const token = token4;
if (c8803_11 && true) {
const colliding_user_ids = MultiAccountStore.getUsers().map((item) => item.id).filter((item) => item !== id3 && getToken(item) === token);
if (colliding_user_ids.length !== 0) {
let is_already_corrupted = getToken(id3) === token;
const r131 = colliding_user_ids.length >= 2;
const r132 = {
...{
from_user_id: id2,
to_user_id: targetUserId,
actual_user_id: id3,
fast_connect_user_id: getLastFastConnectIdentifyUserId(),
linked_user_ids: MultiAccountStore.getUsers().map($mk90387()),
has_ever_connected,
switch_origin: location2
},
colliding_user_ids
};
if (!is_already_corrupted) {
is_already_corrupted = r131;
}
r132.is_already_corrupted = is_already_corrupted;
c8803_6.log("setToken about to introduce per-user token collision", r132);
AnalyticsUtils.track(AnalyticEvents.MULTI_ACCOUNT_SWITCH_TOKEN_COLLISION_WRITE, r132);
}
}
_setSecondaryToken.setToken(token, user.id);
}
let c20209_1;
const id4 = user.id;
c20209_1 = void 0;
if (c8803_11 && true) {
const map = new Map();
c20209_1 = map;
MultiAccountStore.getUsers().forEach(({ id: id5 }) => {
const token2 = getToken(id5);
if (token2 != null && token2 !== "") {
let r15 = c20209_1.get(token2);
if (r15 == null) {
r15 = [];
}
r15.push(id5);
c20209_1.set(token2, r15);
}
});
map.forEach((item) => {
if (!(item.length < 2)) {
const r6 = {
...{
from_user_id: id2,
to_user_id: targetUserId,
actual_user_id: id4,
fast_connect_user_id: getLastFastConnectIdentifyUserId(),
linked_user_ids: MultiAccountStore.getUsers().map($mk90387()),
has_ever_connected,
switch_origin: location2
},
colliding_user_ids: item
};
c8803_6.log("Per-user token collision detected", r6);
AnalyticsUtils.track(AnalyticEvents.MULTI_ACCOUNT_SWITCH_TOKEN_COLLISION, r6);
}
});
}
id2 = null;
targetUserId = null;
location2 = null;
c8803_11 = false;
navigateHome = false;
has_ever_connected = true;
id = user.id;
}
});
export default multiAccountSwitchStore;
+32
View File
@@ -0,0 +1,32 @@
// Metro module 10257 (f10258).
import { intl } from "../../intl/index.native";
export function getStatusExpiryParts(a0) {
const date = new Date(Number(a0));
const date2 = new Date();
const r1 = date.getFullYear() === date2.getFullYear() && date.getMonth() === date2.getMonth() && date.getDate() === date2.getDate();
const date3 = new Date();
date3.setDate(date3.getDate() + 1);
const r2 = date.getFullYear() === date3.getFullYear() && date.getMonth() === date3.getMonth() && date.getDate() === date3.getDate();
const timeString = intl.data.formatTime(date, {
format: "short"
});
return r1 ? {
kind: "today",
dateString: intl.data.formatRelativeTime(0, "day", {
numeric: "auto"
}),
timeString
} : r2 ? {
kind: "tomorrow",
dateString: intl.data.formatRelativeTime(1, "day", {
numeric: "auto"
}),
timeString
} : {
kind: "date",
dateString: intl.data.formatDate(date, {
dateStyle: "short"
}),
timeString
};
}
@@ -0,0 +1,93 @@
// Metro module 14866 (f14867).
import { Pressable, View } from "react-native";
import UserRecord from "../../../records/UserRecord";
import StreamerModeStore from "../../../stores/StreamerModeStore";
import UserStore from "../../../stores/UserStore";
import { MultiAccountTokenStatus } from "../MultiAccountStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../_bundle/Module589";
import { CircleCheckIcon } from "../../../design/components/Icon/native/redesign/generated/CircleCheckIcon";
import Module712 from "../../../_bundle/Module712";
import { CircleInformationIcon } from "../../../design/components/Icon/native/redesign/generated/CircleInformationIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { useRadioA11yNative } from "../../../_bundle/Module3907";
import { Avatar } from "../../../design/void/native";
import UserUtils from "../../../utils/UserUtils";
let useStyles;
const AccountStatusIcon = function AccountStatusIcon(props) {
const user = props.user;
return user.id === useStateFromStores([UserStore], () => UserStore.getCurrentUser())?.id ? <CircleCheckIcon color={Module712.colors.TEXT_BRAND} /> : user.tokenStatus === MultiAccountTokenStatus.INVALID ? <CircleInformationIcon color={Module712.colors.ICON_FEEDBACK_CRITICAL} /> : null;
};
useStyles = createStyles({
accountListTag: {
marginLeft: 12,
flex: 1
},
tagContainer: {
display: "flex",
flexDirection: "row"
},
accountSwitcherListItem: {
display: "flex",
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "center",
paddingVertical: 8,
paddingHorizontal: 16
},
username: {
flexShrink: 1
},
accountInfo: {
flex: 1,
minWidth: "30%",
display: "flex",
flexDirection: "row",
alignItems: "center"
}
});
export default function AccountSwitcherListItem(props) {
const { user, onPressUser, showActiveAccountLabel = false, sortHandlers, delayLongPress, leading } = props;
let trailing = props.trailing;
const styles = useStyles();
const stateFromStores = useStateFromStores([StreamerModeStore], () => StreamerModeStore.hidePersonalInformation);
const selected = user.id === useStateFromStores([UserStore], () => UserStore.getCurrentUser())?.id;
const r15 = Object.create(UserRecord.prototype);
const userRecord = new UserRecord(user);
const r16 = selected && showActiveAccountLabel ? <Text variant="text-sm/semibold" color="text-brand">
{intl.string(t.seV8yt)}
</Text> : user.tokenStatus === MultiAccountTokenStatus.INVALID ? <Text variant="text-sm/semibold" color="text-feedback-critical">
{intl.string(t.tYX2ps)}
</Text> : null;
const Component = onPressUser == null ? Pressable : PressableOpacity;
const radioA11yNative = useRadioA11yNative({
selected
});
const accessibilityHint = selected ? void 0 : intl.string(t.wY4y0R);
const user2 = userRecord;
const children = [leading, <View style={styles.accountInfo}>
<Avatar user={user2} guildId={void 0} />
<View style={styles.accountListTag}>
<View style={styles.tagContainer}>
<Text variant="text-md/semibold" color="text-default" style={styles.username} lineClamp={1}>
{UserUtils.getUserTag(user2, {
mode: "username",
identifiable: stateFromStores ? "never" : "always"
})}
</Text>
{(stateFromStores ? !stateFromStores : !user2.hasUniqueUsername()) && <Text variant="text-md/normal" color="text-muted">
{`#${user2.discriminator}`}
</Text>}
</View>
{r16}
</View>
</View>, ,];
if (trailing === void 0) {
trailing = <AccountStatusIcon user={user} />;
}
children[2] = trailing;
return <Component key={user.id} accessibilityRole={radioA11yNative.accessibilityRole} accessibilityState={radioA11yNative.accessibilityState} accessibilityHint={accessibilityHint} style={styles.accountSwitcherListItem} delayLongPress={delayLongPress} onPress={onPressUser} {...sortHandlers}>{children}</Component>;
};
export { AccountStatusIcon };
@@ -0,0 +1,24 @@
// Metro module 16252 (f16253).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { intl, t } from "../../../intl/index.native";
import { ActivityIndicator } from "../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
import { ModalAnimation } from "../../../ConstantsIOS";
let useStyles;
const AccountSwitchingSpinnerModal = function AccountSwitchingSpinnerModal() {
return <View style={useStyles().switchingSpinnerContainer} accessible accessibilityLabel={intl.string(t.n8qMH0)}>
<ActivityIndicator />
</View>;
};
useStyles = createStyles({
switchingSpinnerContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center"
}
});
AccountSwitchingSpinnerModal.modalConfig = {
animation: ModalAnimation.FADE,
closable: false
};
export default AccountSwitchingSpinnerModal;
@@ -0,0 +1,133 @@
// Metro module 14864 (f14865).
import { View } from "react-native";
import { MultiAccountTokenStatus } from "../MultiAccountStore";
import { MAX_ACCOUNTS, MultiAccountSwitchLocation } from "../Constants";
import { AnalyticEvents, AuthStates } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useNavigation } from "../../../design/components/Navigator/native/useNavigation.native";
import { useMultiAccountUsers } from "../useMultiAccount";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { removeAccount, switchAccount } from "../MultiAccountActionCreators";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
import { ButtonColors, Icon } from "../../../design/void/native";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { showSimpleActionSheet } from "../../action_sheet/native/showSimpleActionSheet";
import AuthFormView from "../../auth/native/components/AuthFormView";
import { Text } from "../../../design/components/Text/native/Text";
import Module13002 from "../../../_bundle/Module13002";
import AccountSwitcherListItem from "./AccountSwitcherListItem";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import Module8334 from "../../../_bundle/Module8334";
import { FormRow } from "../../../design/void/Form/native/index";
import Module14867 from "../../../_bundle/Module14867";
const useStyles = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
borderRadius: Module712.radii.sm,
paddingTop: Module712.space.PX_16,
margin: Module712.space.PX_16
},
mainCard: {
marginVertical: Module712.space.PX_16,
borderRadius: Module712.radii.sm,
flexDirection: "column",
alignItems: "stretch",
alignSelf: "stretch",
display: "flex"
},
addAccountLabel: {
color: Module712.colors.TEXT_LINK
}
});
export default function ChooseAccount() {
let navigation, multiAccountUsers;
let _handlePressRemove2 = function _handlePressRemove() {
const r9 = async (c30795_0) => {
let c30795_2;
c30795_2 = void 0;
let c31743_0 = c30795_0;
if (await AlertActionCreators.confirm({
title: intl.string(t.n0Fbg6),
body: intl.formatToPlainString(t.phEQmS, {
username: c30795_0.discriminator === "0" ? `${c30795_0.username}` : `${c30795_0.username}#${c30795_0.discriminator}`
}),
confirmText: intl.string(t.N86XcP),
confirmColor: ButtonColors.RED,
cancelText: intl.string(t["ETE/oC"]),
isDismissable: true
})) {
ActionSheetActionCreators.hideActionSheet();
removeAccount(c31743_0.id);
}
};
_handlePressRemove2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
navigation = useNavigation();
multiAccountUsers = useMultiAccountUsers().multiAccountUsers;
return <AuthFormView headerText={intl.string(t.bVbB63)} subHeader={<Text variant="text-sm/medium" color="text-default">
{intl.string(t["0M5fN7"])}
</Text>} backgroundImageSource={Module13002} backgroundImageCover contentStyle={styles.container}>
<View style={styles.mainCard}>
{multiAccountUsers.map((multiAccountUser) => {
return <AccountSwitcherListItem key={multiAccountUser.id} user={multiAccountUser} onPressUser={() => {
if (multiAccountUser.tokenStatus === MultiAccountTokenStatus.INVALID) {
navigation.push(AuthStates.LOGIN);
AnalyticsUtils.track(AnalyticEvents.LOGIN_VIEWED, {
source: "choose_account_user_invalid"
});
} else {
switchAccount(multiAccountUser.id, void 0, MultiAccountSwitchLocation.CHOOSE_ACCOUNT);
}
}} trailing={<PressableOpacity accessibilityRole="button" onPress={() => {
let c30796_0 = multiAccountUser;
ActionSheetActionCreators.hideActionSheet();
showSimpleActionSheet({
key: "RemoveAccount",
options: [{
label: intl.string(t["DSN+hw"]),
onPress: () => {
if (c30796_0.tokenStatus === MultiAccountTokenStatus.INVALID) {
navigation.push(AuthStates.LOGIN);
AnalyticsUtils.track(AnalyticEvents.LOGIN_VIEWED, {
source: "choose_account_user_invalid"
});
} else {
switchAccount(c30796_0.id, void 0, MultiAccountSwitchLocation.CHOOSE_ACCOUNT);
}
}
}, {
label: intl.string(t.lSLMaU),
onPress: () => (function handlePressRemove(a0) {
return _handlePressRemove2.apply(this, arguments);
})(c30796_0),
isDestructive: true
}],
hasIcons: false
});
}}>
<Icon size={Icon.Sizes.SMALL_20} source={Module8334} disableColor />
</PressableOpacity>} />;
})}
<FormRow leading={<FormRow.Icon themedColor={Module712.colors.TEXT_LINK} size={Icon.Sizes.SMALL_20} source={Module14867} />} label={intl.string(t.bPP34Q)} labelStyle={styles.addAccountLabel} onPress={function handlePressAddAccount() {
if (multiAccountUsers.length >= MAX_ACCOUNTS) {
AlertActionCreators.show({
title: intl.string(t.w7wfXi),
body: intl.formatToPlainString(t.WOyelG, {
maxNumAccounts: MAX_ACCOUNTS
}),
isDismissable: true
});
} else {
navigation.push(AuthStates.LOGIN);
AnalyticsUtils.track(AnalyticEvents.LOGIN_VIEWED, {
source: "choose_account_add_account"
});
}
}} />
</View>
</AuthFormView>;
};
@@ -0,0 +1,65 @@
// Metro module 15252 (f15253).
import { forwardRef, useRef, useCallback, useImperativeHandle } from "react";
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../design/animation/reanimated/timing/timing";
const __initData = {
code: "function FadeInOutTsx1(){const{opacity}=this.__closure;return{opacity:opacity.get()};}"
};
const __initData2 = {
code: "function FadeInOutTsx2(finished){const{runOnJS,handleTransitionFinished}=this.__closure;if(finished){runOnJS(handleTransitionFinished)();}}"
};
const r22 = forwardRef(function({ children, duration, style }, a1) {
let ref, callback;
ref = void 0;
callback = void 0;
const sharedValue = useSharedValue(0);
const h = () => ({
opacity: sharedValue.get()
});
h.__closure = {
opacity: sharedValue
};
h.__workletHash = 8749472415282;
h.__initData = __initData;
const animatedStyle = useAnimatedStyle(h);
ref = useRef(null);
callback = useCallback(() => {
const current = ref.current;
if (current != null) {
current.call(ref);
}
}, [ref]);
useImperativeHandle(a1, () => ({
componentDidAppear: () => {
sharedValue.set(withTiming(1, {
duration
}));
},
componentDidEnter: () => {
sharedValue.set(withTiming(1, {
duration
}));
},
componentWillLeave: (a0) => {
ref.current = a0;
const r6 = {
duration
};
const t = function t(a0) {
if (a0) {
_ReanimatedRexport.runOnJS(callback)();
}
};
t.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
handleTransitionFinished: callback
};
t.__workletHash = 7644958904451;
t.__initData = __initData2;
sharedValue.set(withTiming(0, r6, "respect-motion-settings", t));
}
}));
return <ReanimatedRexport.View style={[style, animatedStyle]}>{children}</ReanimatedRexport.View>;
});
export default r22;
@@ -0,0 +1,15 @@
// Metro module 15250 (f15251).
import { AuthStates } from "../../../Constants";
const LOGIN = AuthStates.LOGIN;
const r13 = {
MANAGE_ACCOUNTS: "MANAGE_ACCOUNTS",
LOGIN
};
r13[LOGIN] = "LOGIN";
const ACCOUNT_DISABLED_OR_DELETION_SCHEDULED = AuthStates.ACCOUNT_DISABLED_OR_DELETION_SCHEDULED;
r13.ACCOUNT_DISABLED_OR_DELETION_SCHEDULED = ACCOUNT_DISABLED_OR_DELETION_SCHEDULED;
r13[ACCOUNT_DISABLED_OR_DELETION_SCHEDULED] = "ACCOUNT_DISABLED_OR_DELETION_SCHEDULED";
const MFA = AuthStates.MFA;
r13.MFA = MFA;
r13[MFA] = "MFA";
export { r13 as ManageAccountsScreens };
@@ -0,0 +1,252 @@
// Metro module 15249 (f15250).
import { useEffect, memo, useState } from "react";
import { View } from "react-native";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import StreamerModeStore from "../../../stores/StreamerModeStore";
import UserStore from "../../../stores/UserStore";
import { MultiAccountTokenStatus } from "../MultiAccountStore";
import { MANAGE_EDIT_TRANSITION_DURATION, MAX_ACCOUNTS, MultiAccountSwitchLocation } from "../Constants";
import { ManageAccountsScreens } from "./ManageAccountsConstants";
import { AnalyticEvents, AuthStates } from "../../../Constants";
import { createNativeStackNavigator } from "../../../_bundle/Module9109";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { useStateFromStores, useStateFromStoresObject } from "../../../_bundle/Module589";
import { ButtonColors, Spacer } from "../../../design/void/native";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
import { removeAccount, moveAccount, switchAccount } from "../MultiAccountActionCreators";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { CircleMinusIcon } from "../../../design/components/Icon/native/redesign/generated/CircleMinusIcon";
import { useMultiAccountUsers } from "../useMultiAccount";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import usePrevious from "../../../hooks/usePrevious";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import SortableListView from "../../../components_native/common/SortableListView";
import AccountSwitcherListItem, { AccountStatusIcon } from "./AccountSwitcherListItem";
import { TransitionGroup } from "../../../_bundle/Module10391";
import FadeInOut from "./FadeInOut";
import { DragIcon } from "../../../design/components/Icon/native/redesign/generated/DragIcon";
import { FormRow } from "../../../design/void/Form/native/index";
import { CirclePlusIcon } from "../../../design/components/Icon/native/redesign/generated/CirclePlusIcon";
import { useAccessibilityNativeStackOptions } from "../../../design/components/Navigator/native/Navigator.native";
import { GenericHeaderTitle, getRenderModalCloseImage, getRenderHeaderTextButton } from "../../main_tabs_v2/native/shared_components/HeaderShared";
import getNavigationModalPresentation from "../../main_tabs_v2/native/utils/getNavigationModalPresentation";
import AccountDisabledOrDeletionScheduled from "../../auth/native/components/AccountDisabledOrDeletionScheduled";
import AuthenticationActionCreators from "../../../actions/AuthenticationActionCreators";
import Login from "../../auth/native/components/Login";
import MFA from "../../auth/native/components/MFA";
let nativeStackNavigator, useStyles, __initData, ManageAccounts;
const RemoveMultiAccountUserButton = function RemoveMultiAccountUserButton(props) {
let username;
const user = props.user;
username = void 0;
let _handlePressRemove2 = function _handlePressRemove() {
const r9 = async () => {
let c30856_0;
c30856_0 = void 0;
if (await AlertActionCreators.confirm({
title: intl.string(t.n0Fbg6),
body: intl.formatToPlainString(t.phEQmS, {
username
}),
confirmText: intl.string(t.N86XcP),
confirmColor: ButtonColors.RED,
cancelText: intl.string(t["ETE/oC"]),
isDismissable: true
})) {
removeAccount(user.id);
}
};
_handlePressRemove2 = r9;
return r9.apply(this, arguments);
};
let r16 = useStateFromStores([StreamerModeStore], () => StreamerModeStore.hidePersonalInformation);
if (useStateFromStores([UserStore], () => UserStore.getCurrentUser())?.id === user.id) {
return <Spacer size={21} />;
}
username = user.username;
if (!r16) {
r16 = user.discriminator === "0";
}
if (!r16) {
username = username + `#${user.discriminator}`;
}
return <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string(t.lSLMaU)} onPress={function handlePressRemove() {
return _handlePressRemove2.apply(this, arguments);
}}>
<CircleMinusIcon color={Module712.colors.ICON_FEEDBACK_CRITICAL} />
</PressableOpacity>;
};
ManageAccounts = function ManageAccounts(props) {
let sharedValue, animatedStyle, c21807_7;
const { isEditing, navigation } = props;
sharedValue = void 0;
animatedStyle = void 0;
c21807_7 = void 0;
const styles = useStyles();
const multiAccountUsers = useMultiAccountUsers().multiAccountUsers;
const currentUserId = useStateFromStoresObject([AuthenticationStore], () => ({
currentUserId: AuthenticationStore.getId()
})).currentUserId;
sharedValue = useSharedValue(0);
const l = () => ({
width: _timing.withTiming(sharedValue.get(), {
duration: MANAGE_EDIT_TRANSITION_DURATION
})
});
l.__closure = {
withTiming: _timing.withTiming,
leadingWidth: sharedValue,
MANAGE_EDIT_TRANSITION_DURATION
};
l.__workletHash = 3389178545077;
l.__initData = __initData;
animatedStyle = useAnimatedStyle(l);
c21807_7 = usePrevious(isEditing);
useEffect(() => {
if (c21807_7 != null && c21807_7 !== isEditing) {
sharedValue.set(isEditing ? 37 : 0);
}
});
return <SafeAreaPaddingView style={styles.container} bottom>
<SortableListView data={multiAccountUsers} onRowMoved={function handleUserMove(event) {
moveAccount(event.from, event.to);
}} disableSorting={!isEditing} wrapperStyles={styles.sortableListView} renderRow={(a0, a1) => {
let r51;
const props = {
user: a0,
onPressUser: isEditing ? null : () => {
if (!isEditing && a0.id !== currentUserId) {
if (a0.tokenStatus === MultiAccountTokenStatus.INVALID) {
navigation.push(AuthStates.LOGIN);
AnalyticsUtils.track(AnalyticEvents.LOGIN_VIEWED, {
source: "multi_account_invalid_user"
});
} else {
switchAccount(a0.id, void 0, MultiAccountSwitchLocation.MANAGE_ACCOUNTS_MODAL);
}
}
},
showActiveAccountLabel: true,
leading: <TransitionGroup component={ReanimatedRexport.View} transitionEnter transitionLeave style={animatedStyle}>
{isEditing ? <FadeInOut duration={MANAGE_EDIT_TRANSITION_DURATION}>
<RemoveMultiAccountUserButton user={a0} />
</FadeInOut> : isEditing}
</TransitionGroup>,
trailing: null,
delayLongPress: null
};
const props2 = {
duration: MANAGE_EDIT_TRANSITION_DURATION,
style: styles.trailingIcon,
children: null
};
if (isEditing) {
props2.children = <DragIcon />;
r51 = <FadeInOut key="drag" {...props2} />;
} else {
props2.children = <AccountStatusIcon user={a0} />;
r51 = <FadeInOut key="status" {...props2} />;
}
props.trailing = <TransitionGroup component={View} transitionEnter transitionLeave transitionAppear style={styles.trailingIconContainer}>{r51}</TransitionGroup>;
props.delayLongPress = isEditing ? 100 : void 0;
return <AccountSwitcherListItem key={a1} {...props} />;
}} keyboardShouldPersistTaps="handled" scrollEventThrottle={16} scrollEnabled footer={<TransitionGroup component={View} transitionEnter transitionLeave transitionAppear>
{isEditing ? !isEditing : <FadeInOut duration={MANAGE_EDIT_TRANSITION_DURATION}>
<FormRow leading={<CirclePlusIcon color={Module712.colors.TEXT_LINK} />} label={<FormRow.Label style={styles.addAccountLabel} text={intl.string(t.bPP34Q)} />} onPress={function handlePressAddAccount() {
if (multiAccountUsers.length >= MAX_ACCOUNTS) {
AlertActionCreators.show({
title: intl.string(t.w7wfXi),
body: intl.formatToPlainString(t.WOyelG, {
maxNumAccounts: MAX_ACCOUNTS
}),
isDismissable: true
});
} else {
navigation.push(AuthStates.LOGIN);
AnalyticsUtils.track(AnalyticEvents.LOGIN_VIEWED, {
source: "multi_account_add_account"
});
}
}} />
</FadeInOut>}
</TransitionGroup>} />
</SafeAreaPaddingView>;
};
nativeStackNavigator = createNativeStackNavigator();
useStyles = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
flex: 1,
paddingTop: 16
},
sortableListView: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
addAccountLabel: {
color: Module712.colors.TEXT_LINK
},
trailingIconContainer: {
width: 24,
height: 24
},
trailingIcon: {
position: "absolute"
}
});
__initData = {
code: "function ManageAccountsModalTsx1(){const{withTiming,leadingWidth,MANAGE_EDIT_TRANSITION_DURATION}=this.__closure;return{width:withTiming(leadingWidth.get(),{duration:MANAGE_EDIT_TRANSITION_DURATION})};}"
};
const r78 = memo(function ManageAccountsModal(props) {
let initialRouteName = props.initialRouteName;
if (initialRouteName === void 0) {
initialRouteName = ManageAccountsScreens.MANAGE_ACCOUNTS;
}
const accessibilityNativeStackOptions = useAccessibilityNativeStackOptions();
const [state, setState] = useState(false);
return <nativeStackNavigator.Navigator initialRouteName={initialRouteName} screenOptions={({ navigation: navigation2 }) => ({
headerTitle: (a0) => {
const { children, ...rest } = a0;
return <GenericHeaderTitle title={a0.children} {...rest} />;
},
headerLeft: state ? void 0 : getRenderModalCloseImage(navigation2),
headerTitleAlign: "center",
...accessibilityNativeStackOptions,
...getNavigationModalPresentation()
})}>
<nativeStackNavigator.Screen name={ManageAccountsScreens.MANAGE_ACCOUNTS} options={() => ({
title: intl.string(t.WbFpq4),
headerRight: state ? getRenderHeaderTextButton(intl.string(t.i4jeWR), () => setState(false)) : getRenderHeaderTextButton(intl.string(t.bt75uw), () => setState(true))
})}>
{(a0) => <ManageAccounts isEditing={state} navigation={a0.navigation} />}
</nativeStackNavigator.Screen>
<nativeStackNavigator.Screen name={ManageAccountsScreens.ACCOUNT_DISABLED_OR_DELETION_SCHEDULED} options={() => ({
title: intl.string(t.WbFpq4)
})}>
{() => <AccountDisabledOrDeletionScheduled handleLogin={(a0, a1, a2) => {
AuthenticationActionCreators.login({
login: a0,
password: a1,
undelete: a2
});
}} onReset={() => {
AuthenticationActionCreators.loginReset(true);
}} />}
</nativeStackNavigator.Screen>
<nativeStackNavigator.Screen name={ManageAccountsScreens.LOGIN} options={() => ({
headerShown: false
})}>
{() => <Login isMultiAccount />}
</nativeStackNavigator.Screen>
<nativeStackNavigator.Screen name={ManageAccountsScreens.MFA} options={() => ({
headerShown: false
})}>
{() => <MFA isMultiAccount />}
</nativeStackNavigator.Screen>
</nativeStackNavigator.Navigator>;
});
export default r78;
@@ -0,0 +1,151 @@
// Metro module 16251 (f16252).
import { SWITCH_ACCOUNTS_MODAL_KEY } from "../Constants";
import { Routes } from "../../../Constants";
import Logger from "../../debug/Logger";
import Durations from "../../../utils/Durations";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import MultiAccountManager from "../MultiAccountManager";
import { closeFastConnectSocket } from "../../gateway/native/fast_connect";
import { reportAccountSwitchTimeout } from "../MultiAccountActionCreators";
import { transitionTo } from "../../routing/router_utils";
import { MobileHomeDrawerExperiment } from "../../home_drawer/native/HomeDrawerExperiment";
import { setHomeDrawerState } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { intl, t } from "../../../intl/index.native";
import Module16254 from "../../../_bundle/Module16254";
function $mk99088($env) {
return () => {
const r3 = $env.$parent;
const r2 = r3[1];
const r1 = r3[2];
const r7 = r2(r1[4]);
const r12 = (0, r3[0])(r1[6])(r1[5], r1.paths);
const r13 = r3[7];
r7.pushLazy(r12, {}, r13);
if ($env[0].cancelled) {
r2(r1[4]).popWithKey(r13);
}
};
}
function $mk99089($env) {
return () => {
const r2 = $env;
const r3 = r2[0];
r3.cancelled = false;
const r4 = $env.$parent;
const r6 = r4[0];
const r5 = r4[2];
const rootNavigationRef = r6(r5[7]).getRootNavigationRef();
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
r3.push();
} else {
r6(r5[8]).ComponentDispatch.subscribeOnce(r4[4].NAVIGATOR_READY, $mk112706(r2));
}
};
}
function $mk99090($env) {
return () => {
$env[0].cancelled = true;
const r5 = $env.$parent;
(0, r5[1])(r5[2][4]).popWithKey(r5[7]);
};
}
function $mk112706($env) {
return () => {
const r2 = $env[0];
if (!r2.cancelled) {
r2.push();
}
};
}
let c11681_0, c11680_10, c11680_11;
let env11680;
let env11681;
const r7 = env11680 = {};
const c11680_6 = new Logger("MultiAccountManagerNative");
const c11680_7 = "switch-accounts-spinner-modal";
const c11680_8 = 15 * Durations.Millis.SECOND;
env11680[9] = null;
const r38 = {
__proto__: (function MultiAccountModalManagerImpl() {
let env22921;
const r5 = {
__proto__: new.target.prototype
};
const r2 = env22921 = {
$parent: env11680
};
env22921[0] = r5;
r5.cancelled = false;
r5.push = $mk99088(r2);
r5.enqueue = $mk99089(r2);
r5.pop = $mk99090(r2);
return r5;
}).prototype
};
const r39 = env11681 = {
$parent: r7
};
c11681_0 = r38;
r38.cancelled = false;
r38.push = $mk99088(r39);
r38.enqueue = $mk99089(r39);
r38.pop = $mk99090(r39);
c11680_10 = r38;
class MultiAccountManagerNative extends MultiAccountManager {
constructor() {
super(...arguments);
}
onSwitchStart() {
ModalActionCreators.popWithKey(SWITCH_ACCOUNTS_MODAL_KEY);
c11680_6.info("Closing fast-connect socket because of account switch logout");
closeFastConnectSocket();
c11680_10.enqueue();
if (env11680[9] !== null) {
clearTimeout(env11680[9]);
}
env11680[9] = setTimeout(() => {
c11680_10.pop();
reportAccountSwitchTimeout();
}, c11680_8);
}
onSwitchSuccess(c22922_0, a1) {
if (a1) {
transitionTo(Routes.ME, {
navigationReplace: true
});
if (MobileHomeDrawerExperiment.getConfig({
location: "multi-account"
}).enableHome) {
setHomeDrawerState(false);
}
}
setTimeout(() => {
ToastActionCreators.open({
key: "SWITCH_ACCOUNTS_TOAST_LOGIN_SUCCESS",
content: intl.formatToPlainString(t.wx7O3L, {
username: c22922_0.username
}),
icon: Module16254
});
}, 100);
}
onSwitchError() {
ToastActionCreators.open({
key: "SWITCH_ACCOUNTS_TOAST_LOGIN_ERROR",
content: intl.string(t.pqvKWA),
icon: Module16254
});
}
onSwitchComplete() {
ModalActionCreators.popWithKey(SWITCH_ACCOUNTS_MODAL_KEY);
c11680_10.pop();
if (env11680[9] !== null) {
clearTimeout(env11680[9]);
env11680[9] = null;
}
}
}
c11680_11 = MultiAccountManagerNative;
const r58 = new MultiAccountManagerNative();
export default r58;
@@ -0,0 +1,10 @@
// Metro module 15248 (f15249).
import { SWITCH_ACCOUNTS_MODAL_KEY } from "../Constants";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import ModalActionCreators from "../../../actions/ModalActionCreators";
export default function openManageAccountsModal(a0) {
ActionSheetActionCreators.hideActionSheet();
ModalActionCreators.pushLazy(import("./ManageAccountsModal"), {
initialRouteName: a0
}, SWITCH_ACCOUNTS_MODAL_KEY);
};
+107
View File
@@ -0,0 +1,107 @@
// Metro module 10256 (f10257).
import LastMentionTimestampStore from "../notifications/LastMentionTimestampStore";
import SelfPresenceStore from "../../stores/SelfPresenceStore";
import { AnalyticEvents } from "../../Constants";
import { humanizeStatus } from "../../utils/UserUtils";
import { intl, t } from "../../intl/index.native";
import { getStatusExpiryParts } from "./StatusUtils";
import { UserSettingsDelay, PreloadedUserSettingsActionCreators } from "../user_settings/UserSettingsProtoActionCreators";
import { StringValue, UInt64Value } from "../../_bundle/Module1337";
import { AccessibilityAnnouncer } from "../../_bundle/Module4004";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
function $mk115639($env) {
return (a0) => {
const r5 = $env;
const value = r5[0];
a0.status = StringValue.create({
value
});
a0.statusExpiresAtMs = r5[5];
a0.statusCreatedAtMs = r5[1] === value && a0.statusCreatedAtMs != null ? a0.statusCreatedAtMs : UInt64Value.create({
value: `${Date.now()}`
});
};
}
function $mk115640($env) {
return function getStatusUpdateAnnouncement(a0, a1) {
const statusLabel = humanizeStatus(a0);
if (a1 === "0") {
return intl.formatToPlainString(t.dO2aLi, {
statusLabel
});
}
const statusExpiryParts = getStatusExpiryParts(a1);
const { kind, dateString, timeString } = statusExpiryParts;
return kind === "today" ? intl.formatToPlainString(t["r50t/S"], {
statusLabel,
timeString
}) : intl.formatToPlainString(t["J+GJHv"], {
statusLabel,
dateString,
timeString
});
};
}
let env6845 = {};
export default async function setUserStatus(c26641_0) {
let env30207;
const r27 = env6845;
let c26641_2 = r27;
const r10 = env30207 = {
$parent: r27
};
let c26641_1 = r10;
env30207[0] = void 0;
env30207[1] = void 0;
env30207[2] = void 0;
env30207[3] = void 0;
env30207[4] = void 0;
env30207[0] = c26641_0.nextStatus;
env30207[1] = c26641_0.prevStatus;
env30207[2] = c26641_0.analyticsContext;
env30207[3] = c26641_0.durationMillis;
const disableTracking = c26641_0.disableTracking;
if (disableTracking !== void 0) {
env30207[4] = disableTracking;
env30207[5] = void 0;
env30207[6] = void 0;
env30207[7] = void 0;
} else {
env30207[4] = false;
env30207[5] = void 0;
env30207[6] = void 0;
env30207[7] = void 0;
}
await void 0;
if (env30207[1] == null) {
env30207[1] = SelfPresenceStore.getStatus();
}
const r54 = env30207[3] != null ? `${Date.now() + env30207[3]}` : "0";
env30207[5] = r54;
const INFREQUENT_USER_ACTION = UserSettingsDelay.INFREQUENT_USER_ACTION;
await PreloadedUserSettingsActionCreators.updateAsync("status", $mk115639(c26641_1), INFREQUENT_USER_ACTION);
const r102 = env30207[0];
const r103 = env30207[5];
env30207[6] = $mk115640(env6845)(r102, r103);
AccessibilityAnnouncer.announce(env30207[6]);
if (!env30207[4]) {
env30207[7] = {
next_status: env30207[0],
prev_status: env30207[1],
...LastMentionTimestampStore.getGlobalStats()
};
if (env30207[3] != null) {
env30207[7] = {
...env30207[7],
expire_duration_minutes: env30207[3] != null ? env30207[3] / 60000 : null
};
}
if (env30207[2] != null) {
env30207[7] = {
...env30207[7],
...env30207[2]
};
}
AnalyticsUtils.track(AnalyticEvents.USER_STATUS_UPDATED, env30207[7]);
}
};
+33
View File
@@ -0,0 +1,33 @@
// Metro module 14865 (f14866).
import { useEffect } from "react";
import UserStore from "../../stores/UserStore";
import MultiAccountStore, { MultiAccountTokenStatus } from "./MultiAccountStore";
import { useStateFromStoresObject } from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
import { validateMultiAccountTokens } from "./MultiAccountActionCreators";
export function useMultiAccountUsers() {
const stateFromStoresObject = useStateFromStoresObject([MultiAccountStore, UserStore], () => {
const users = MultiAccountStore.getUsers();
const currentUser = UserStore.getCurrentUser();
return currentUser != null && !users.some((user) => user.id === currentUser.id) ? {
isLoading: MultiAccountStore.getIsValidatingUsers(),
multiAccountUsers: [{
id: currentUser.id,
avatar: currentUser.avatar,
username: currentUser.username,
discriminator: currentUser.discriminator,
tokenStatus: MultiAccountTokenStatus.VALID,
pushSyncToken: null
}, ...users]
} : {
isLoading: MultiAccountStore.getIsValidatingUsers(),
multiAccountUsers: users
};
});
useEffect(() => {
Dispatcher.wait(() => {
validateMultiAccountTokens();
});
}, []);
return stateFromStoresObject;
}