211 lines
12 KiB
TypeScript
211 lines
12 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] */
|
|
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
|
|
var object4;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(5) /* metro dependency 5 */;
|
|
importAll(31) /* metro dependency 31 */;
|
|
const env0_5 = (require(27) /* metro dependency 27 */).View;
|
|
const env0_6 = (require(11876) /* metro dependency 11876: MultiAccountStore */).MultiAccountTokenStatus;
|
|
let value = require(11877) /* metro dependency 11877: Constants */;
|
|
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;
|
|
object4 = {};
|
|
const object5 = {};
|
|
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
|
|
object5.backgroundColor = BACKGROUND_BASE_LOW;
|
|
object5.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object5.paddingTop = PX_16;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object5.margin = PX_16;
|
|
object4.container = object5;
|
|
const object6 = {'marginVertical': null, 'borderRadius': null, 'flexDirection': 'column', 'alignItems': 'stretch',
|
|
'alignSelf': 'stretch', 'display': 'flex'};
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object6.marginVertical = PX_16;
|
|
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
object4.mainCard = object6;
|
|
const TEXT_LINK = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_LINK;
|
|
object4.addAccountLabel = {color: TEXT_LINK};
|
|
const env0_13 = Reflect.apply(createStyles, value, [object4]);
|
|
(require(2) /* metro dependency 2 */).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 = (require(1484) /* metro dependency 1484: useNavigationNative */).useNavigation();
|
|
const useMultiAccountModule = require(14309) /* metro dependency 14309: useMultiAccount */;
|
|
const useMultiAccountUsers = useMultiAccountModule.useMultiAccountUsers;
|
|
const multiAccountUsers = Reflect.apply(useMultiAccountUsers, useMultiAccountModule, []).multiAccountUsers;
|
|
const env0_3 = _fun108290();
|
|
const AuthFormView = importDefault(9001) /* metro dependency 9001: AuthFormView */;
|
|
const object2 = {};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
object2.headerText = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.bVbB63);
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
object2.subHeader = <Text variant="text-sm/medium" color="text-default">{intl.string((require(1244) /* metro dependency 1244: indexNative */).t['0M5fN7'])}</Text>;
|
|
object2.backgroundImageSource = importDefault(12638) /* metro dependency 12638 */;
|
|
object2.backgroundImageCover = true;
|
|
object2.contentStyle = styles.container;
|
|
const value = multiAccountUsers.map(_fun108294);
|
|
const FormRow = (require(7972) /* metro dependency 7972: native */).FormRow;
|
|
const FormRow2 = (require(7972) /* metro dependency 7972: native */).FormRow;
|
|
const Icon = FormRow2.Icon;
|
|
const TEXT_LINK = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_LINK;
|
|
const Icon2 = (require(1305) /* metro dependency 1305: native */).Icon;
|
|
const Sizes = Icon2.Sizes;
|
|
const SMALL_20 = Sizes.SMALL_20;
|
|
return (
|
|
<AuthFormView {...object2}>
|
|
<View style={styles.mainCard}>
|
|
{value}
|
|
<FormRow
|
|
leading={<Icon themedColor={TEXT_LINK} size={SMALL_20} source={importDefault(14311) /* metro dependency 14311 */} />}
|
|
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 _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 AccountSwitcherListItem = importDefault(14310) /* metro dependency 14310: AccountSwitcherListItem */;
|
|
const object3 = {user: a0, onPressUser: onPressUser};
|
|
const PressableOpacity = (require(5278) /* metro dependency 5278: Pressables */).PressableOpacity;
|
|
const object4 = {accessibilityRole: 'button', onPress: onPress_108296};
|
|
const Icon = (require(1305) /* metro dependency 1305: native */).Icon;
|
|
const Icon2 = (require(1305) /* metro dependency 1305: native */).Icon;
|
|
const Sizes = Icon2.Sizes;
|
|
const SMALL_20 = Sizes.SMALL_20;
|
|
object3.trailing = <PressableOpacity {...object4}><Icon size={SMALL_20} source={importDefault(9139) /* metro dependency 9139 */} disableColor /></PressableOpacity>;
|
|
return <AccountSwitcherListItem {...object3} key={a0.id} />;
|
|
}
|
|
|
|
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 = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).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'});
|
|
}
|
|
}
|
|
|
|
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 object2 = {};
|
|
binding = env3_0;
|
|
var intl = binding(binding2[14]).intl;
|
|
var string = intl.string;
|
|
object2.title = Reflect.apply(string, intl, [binding(binding2[14]).t.n0Fbg6]);
|
|
intl = binding(binding2[14]).intl;
|
|
object2.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;
|
|
object2.confirmText = Reflect.apply(string, intl, [N86XcP]);
|
|
var ButtonColors = binding(binding3[15]).ButtonColors;
|
|
var RED = ButtonColors.RED;
|
|
object2.confirmColor = RED;
|
|
intl = binding(binding3[14]).intl;
|
|
object2.cancelText = intl.string(binding(binding3[14]).t['ETE/oC']);
|
|
object2.isDismissable = true;
|
|
yield Reflect.apply(confirm, value3, [object2]);
|
|
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 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__;
|
|
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
|
|
value = require(6802) /* metro dependency 6802: showSimpleActionSheet */;
|
|
const showSimpleActionSheet = value.showSimpleActionSheet;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).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);
|
|
}
|
|
|