250 lines
15 KiB
TypeScript
250 lines
15 KiB
TypeScript
/* Metro module 14308; source: modules/multi_account/native/ChooseAccount.tsx; dependencies: [5, 31, 27, 11876, 11877, 661, 33, 4501, 697, 1484, 14309, 683, 11880, 4496, 1244, 1305, 4080, 6802, 9001, 4573, 12638, 14310, 5278, 9139, 7972, 14311, 2] */
|
|
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
|
|
import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */
|
|
import AuthFormView from '../../auth/native/components/AuthFormView.tsx'; /* Metro dependency 9001 */
|
|
import AccountSwitcherListItem from './AccountSwitcherListItem.tsx'; /* Metro dependency 14310 */
|
|
import Module14311 from '../../../by-id/module-14311.js'; /* Metro dependency 14311 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
|
|
import * as UseNavigationNativeModule from '../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
|
|
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as PressablesModule from '../../../design/void/Pressables/native/Pressables.tsx'; /* Metro dependency 5278 */
|
|
import * as NativeModule2 from '../../../design/void/Form/native/index.tsx'; /* Metro dependency 7972 */
|
|
import * as MultiAccountStoreModule from '../MultiAccountStore.tsx'; /* Metro dependency 11876 */
|
|
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 11877 */
|
|
import * as UseMultiAccountModule from '../useMultiAccount.tsx'; /* Metro dependency 14309 */
|
|
|
|
function _fun108287(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#108287, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:6, offset: 0x0231af67, size: 508 bytes, params: 8, frame: 22
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
ReactModule;
|
|
let value = ConstantsModule;
|
|
const env0_7 = value.MAX_ACCOUNTS;
|
|
const env0_8 = value.MultiAccountSwitchLocation;
|
|
value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_9 = value.AnalyticEvents;
|
|
const env0_10 = value.AuthStates;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_11 = value.jsx;
|
|
const env0_12 = value.jsxs;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
object = {};
|
|
const object2 = {};
|
|
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
|
|
object2.backgroundColor = BACKGROUND_BASE_LOW;
|
|
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object2.paddingTop = PX_16;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object2.margin = PX_16;
|
|
object.container = object2;
|
|
const object3 = {'marginVertical': null, 'borderRadius': null, 'flexDirection': 'column', 'alignItems': 'stretch',
|
|
'alignSelf': 'stretch', 'display': 'flex'};
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object3.marginVertical = PX_16;
|
|
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
object.mainCard = object3;
|
|
const TEXT_LINK = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_LINK;
|
|
object.addAccountLabel = {color: TEXT_LINK};
|
|
const env0_13 = Reflect.apply(createStyles, value, [object]);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/multi_account/native/ChooseAccount.tsx');
|
|
exports.default = ChooseAccount;
|
|
function ChooseAccount() { // fn#108288, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:766, offset: 0x0231b163, size: 586 bytes, params: 1, frame: 28
|
|
const styles = useStyles();
|
|
const env0_0 = (UseNavigationNativeModule).useNavigation();
|
|
const useMultiAccountUsers = UseMultiAccountModule.useMultiAccountUsers;
|
|
const multiAccountUsers = Reflect.apply(useMultiAccountUsers, UseMultiAccountModule, []).multiAccountUsers;
|
|
const env0_3 = _fun108290();
|
|
const object = {};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
object.headerText = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.bVbB63);
|
|
const Text = (TextModule).Text;
|
|
object.subHeader = (
|
|
<Text variant="text-sm/medium" color="text-default">
|
|
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t['0M5fN7'])}
|
|
</Text>
|
|
);
|
|
object.backgroundImageSource = importDefault(12638) /* metro dependency 12638 */;
|
|
object.backgroundImageCover = true;
|
|
object.contentStyle = styles.container;
|
|
const value = multiAccountUsers.map(_fun108294);
|
|
const FormRow = (NativeModule2).FormRow;
|
|
const FormRow2 = (NativeModule2).FormRow;
|
|
const Icon = FormRow2.Icon;
|
|
const TEXT_LINK = (Native).colors.TEXT_LINK;
|
|
const Icon2 = (NativeModule).Icon;
|
|
const Sizes = Icon2.Sizes;
|
|
const SMALL_20 = Sizes.SMALL_20;
|
|
return (
|
|
<AuthFormView {...object}>
|
|
<View style={styles.mainCard}>
|
|
{value}
|
|
<FormRow
|
|
leading={<Icon
|
|
themedColor={TEXT_LINK}
|
|
size={SMALL_20}
|
|
source={Module14311}
|
|
/>}
|
|
label={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.bPP34Q)}
|
|
labelStyle={styles.addAccountLabel}
|
|
onPress={onPress_108300}
|
|
/>
|
|
</View>
|
|
</AuthFormView>
|
|
);
|
|
function handlePressUser(a0) { // fn#108289, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:895, owner: ChooseAccount.handlePressUser, offset: 0x0231b3ad, size: 164 bytes, params: 2, frame: 16
|
|
var binding;
|
|
var defaultImport;
|
|
const tokenStatus = a0.tokenStatus;
|
|
const INVALID = MultiAccountTokenStatus.INVALID;
|
|
if (tokenStatus === INVALID) {
|
|
binding = env0_0;
|
|
binding.push(AuthStates.LOGIN);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.LOGIN_VIEWED, {source: 'choose_account_user_invalid'});
|
|
} else {
|
|
var moduleValue = importAll(11880) /* metro dependency 11880: MultiAccountActionCreators */;
|
|
var switchAccount = moduleValue.switchAccount;
|
|
var id = a0.id;
|
|
var CHOOSE_ACCOUNT = MultiAccountSwitchLocation.CHOOSE_ACCOUNT;
|
|
Reflect.apply(switchAccount, moduleValue, [id, undefined, CHOOSE_ACCOUNT]);
|
|
}
|
|
}
|
|
|
|
function _fun108290() { // fn#108290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:1082, offset: 0x0231b451, size: 36 bytes, params: 1, frame: 12
|
|
const env0_0 = env1_4(_fun108292);
|
|
return _fun108293;
|
|
function* _fun108292(a0) { // fn#108292, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:1102, offset: 0x0231b480, size: 474 bytes, params: 2, frame: 27
|
|
var binding4;
|
|
if (true) {
|
|
value = environment.__proto__.__proto__.__proto__;
|
|
var binding = env3_1;
|
|
var binding2 = env3_3;
|
|
var value3 = binding(binding2[13]);
|
|
var confirm = value3.confirm;
|
|
var object = {};
|
|
binding = env3_0;
|
|
var intl = binding(binding2[14]).intl;
|
|
var string = intl.string;
|
|
object.title = Reflect.apply(string, intl, [binding(binding2[14]).t.n0Fbg6]);
|
|
intl = binding(binding2[14]).intl;
|
|
object.body = intl.formatToPlainString(binding(binding2[14]).t.phEQmS,
|
|
{username: a0.discriminator === '0' ? '' + a0.username : '' + a0.username + '#' + a0.discriminator});
|
|
binding = env3_0;
|
|
var binding3 = env3_3;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
var N86XcP = binding(binding3[14]).t.N86XcP;
|
|
object.confirmText = Reflect.apply(string, intl, [N86XcP]);
|
|
var ButtonColors = binding(binding3[15]).ButtonColors;
|
|
var RED = ButtonColors.RED;
|
|
object.confirmColor = RED;
|
|
intl = binding(binding3[14]).intl;
|
|
object.cancelText = intl.string(binding(binding3[14]).t['ETE/oC']);
|
|
object.isDismissable = true;
|
|
yield Reflect.apply(confirm, value3, [object]);
|
|
var value6 = undefined;
|
|
if (false) {
|
|
return value6;
|
|
}
|
|
if (value6) {
|
|
binding = env3_1;
|
|
binding4 = env3_3;
|
|
binding(binding4[16]).hideActionSheet();
|
|
binding = env3_2;
|
|
value = binding(binding4[12]);
|
|
value.removeAccount(a0.id);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _fun108293() { // fn#108293, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:1562, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
|
|
return env0_0.apply(this, arguments);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun108294(a0) { // fn#108294, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:1933, offset: 0x0231b65a, size: 206 bytes, params: 2, frame: 23
|
|
const env0_0 = a0;
|
|
const object = {user: a0, onPressUser: onPressUser_108295};
|
|
const PressableOpacity = (PressablesModule).PressableOpacity;
|
|
const object2 = {accessibilityRole: 'button', onPress: onPress_108296};
|
|
const Icon = (NativeModule).Icon;
|
|
const Icon2 = (NativeModule).Icon;
|
|
const Sizes = Icon2.Sizes;
|
|
const SMALL_20 = Sizes.SMALL_20;
|
|
object.trailing = (
|
|
<PressableOpacity {...object2}>
|
|
<Icon
|
|
size={SMALL_20}
|
|
source={importDefault(9139) /* metro dependency 9139 */}
|
|
disableColor
|
|
/>
|
|
</PressableOpacity>
|
|
);
|
|
return <AccountSwitcherListItem {...object} key={a0.id} />;
|
|
function onPressUser_108295() { // fn#108295, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:1967, offset: 0x016f88b2, size: 23 bytes, params: 1, frame: 11
|
|
return handlePressUser(env0_0);
|
|
}
|
|
|
|
function onPress_108296() { // fn#108296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:2063, offset: 0x0231b728, size: 25 bytes, params: 1, frame: 11
|
|
_fun108297(env0_0);
|
|
function _fun108297(a0) { // fn#108297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:2068, offset: 0x0231b741, size: 239 bytes, params: 2, frame: 20
|
|
var environment;
|
|
const env0_0 = a0;
|
|
let value = environment.__proto__.__proto__.__proto__;
|
|
(ActionSheetActionCreators).hideActionSheet();
|
|
value = require(6802) /* metro dependency 6802: showSimpleActionSheet */;
|
|
const showSimpleActionSheet = value.showSimpleActionSheet;
|
|
const intl = (IndexNativeModule).intl;
|
|
const string = intl.string;
|
|
const t = (IndexNativeModule).t;
|
|
Reflect.apply(showSimpleActionSheet, value, [{'key': 'RemoveAccount', 'options': null, 'hasIcons': false,
|
|
options: [{label: Reflect.apply(string, intl, [t['DSN+hw']]), onPress: onPress_108298},
|
|
{label: intl.string(t.lSLMaU), onPress: onPress_108299, isDestructive: true}]}]);
|
|
function onPress_108298() { // fn#108298, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:2218, offset: 0x0231b830, size: 23 bytes, params: 1, frame: 11
|
|
return handlePressUser(env0_0);
|
|
}
|
|
|
|
function onPress_108299() { // fn#108299, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:2297, offset: 0x0231b847, size: 23 bytes, params: 1, frame: 11
|
|
return env3_3(env0_0);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function ChooseAccountOnPress() { // fn#108300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14505:2674, owner: ChooseAccount.onPress, offset: 0x0231b85e, size: 268 bytes, params: 1, frame: 20
|
|
var binding;
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
var value;
|
|
if (multiAccountUsers.length >= MAX_ACCOUNTS) {
|
|
value = importDefault(4496) /* metro dependency 4496: AlertActionCreators */;
|
|
value.show({title: intl.string(t.w7wfXi), body: intl.formatToPlainString(t.WOyelG,
|
|
{maxNumAccounts: MAX_ACCOUNTS}),
|
|
isDismissable: true});
|
|
} else {
|
|
binding = env0_0;
|
|
binding.push(AuthStates.LOGIN);
|
|
value = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
value.track(AnalyticEvents.LOGIN_VIEWED, {source: 'choose_account_add_account'});
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun108287, 14308, [5, 31, 27, 11876, 11877, 661, 33, 4501, 697, 1484, 14309, 683, 11880, 4496, 1244,
|
|
1305, 4080, 6802, 9001, 4573, 12638, 14310, 5278, 9139, 7972, 14311,
|
|
2]) /* metro module 14308, dependencies: [5, 31, 27, 11876, 11877, 661, 33, 4501, 697, 1484, 14309, 683, 11880, 4496, 1244, 1305, 4080, 6802, 9001, 4573, 12638, 14310, 5278, 9139, 7972, 14311, 2] */;
|