360 lines
20 KiB
TypeScript
360 lines
20 KiB
TypeScript
/* Metro module 14306; source: modules/auth/native/components/Welcome.tsx; dependencies: [31, 27, 14307, 4107, 7069, 11876, 1885, 4097, 9156, 661, 6934, 4118, 33, 4501, 697, 11976, 1244, 44, 1305, 3995, 10555, 7556, 12636, 4573, 1484, 1585, 566, 4594, 4884, 683, 587, 5076, 6518, 14308, 14303, 6261, 4578, 3868, 5314, 9871, 2] */
|
|
function _fun108260(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#108260, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:6, offset: 0x02319d06, size: 681 bytes, params: 8, frame: 24
|
|
var object3;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
let value = require(27) /* metro dependency 27 */;
|
|
const env0_4 = value.View;
|
|
const env0_5 = value.Image;
|
|
const env0_6 = value.ScrollView;
|
|
const ageGateStore = importDefault(14307) /* metro dependency 14307: AgeGateStore */;
|
|
const experimentStore = importDefault(4107) /* metro dependency 4107: ExperimentStore */;
|
|
const guildTemplateStore = importDefault(7069) /* metro dependency 7069: GuildTemplateStore */;
|
|
const multiAccountStore = importDefault(11876) /* metro dependency 11876: MultiAccountStore */;
|
|
const userRecord = importDefault(1885) /* metro dependency 1885: UserRecord */;
|
|
const inviteStore = importDefault(4097) /* metro dependency 4097: InviteStore */;
|
|
const displayedInviteStore = importDefault(9156) /* metro dependency 9156: DisplayedInviteStore */;
|
|
value = require(661) /* metro dependency 661: Constants */;
|
|
const Fonts = value.Fonts;
|
|
const env0_14 = value.AnalyticEvents;
|
|
const env0_15 = value.StorageKeys;
|
|
const env0_16 = value.AuthStates;
|
|
const env0_17 = value.InviteStates;
|
|
const env0_18 = (require(6934) /* metro dependency 6934: GuildTemplatesConstants */).GuildTemplateStates;
|
|
const env0_19 = (require(4118) /* metro dependency 4118: Constants */).InviteTypes;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_20 = value.jsx;
|
|
const env0_21 = value.jsxs;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
let createStyles = value.createStyles;
|
|
const env0_22 = Reflect.apply(createStyles, value, [_fun108264]);
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
createStyles = value.createStyles;
|
|
object3 = {};
|
|
const object4 = {'backgroundColor': null, 'padding': 16, 'flexDirection': 'row'};
|
|
const BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
|
|
object4.backgroundColor = BACKGROUND_BASE_LOWEST;
|
|
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
object3.container = object4;
|
|
object3.text = {marginLeft: 16};
|
|
const MOBILE_TEXT_HEADING_PRIMARY = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_TEXT_HEADING_PRIMARY;
|
|
const PRIMARY_SEMIBOLD = Fonts.PRIMARY_SEMIBOLD;
|
|
object3.name = {color: MOBILE_TEXT_HEADING_PRIMARY, fontFamily: PRIMARY_SEMIBOLD, fontSize: 16, lineHeight: 20};
|
|
const TEXT_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_SUBTLE;
|
|
object3.inviteText = {'color': null, 'fontSize': 14, 'lineHeight': 18, color: TEXT_SUBTLE};
|
|
const env0_23 = Reflect.apply(createStyles, value, [object3]);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/auth/native/components/Welcome.tsx');
|
|
exports.default = Welcome;
|
|
}
|
|
|
|
function InviteCard({invite, style}) { // fn#108261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:1365, offset: 0x02319faf, size: 708 bytes, params: 2, frame: 28
|
|
var r5;
|
|
var r12;
|
|
var r17;
|
|
const Avatar = (require(1305) /* metro dependency 1305: native */).Avatar;
|
|
var userRecord;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
var value7;
|
|
var avatar;
|
|
var value10;
|
|
var formattedName;
|
|
var value12;
|
|
var value13;
|
|
var name;
|
|
var items2;
|
|
const LegacyText = (require(1305) /* metro dependency 1305: native */).LegacyText;
|
|
var items3;
|
|
const styles = useStyles();
|
|
const guild = invite.guild;
|
|
const inviter = invite.inviter;
|
|
const channel = invite.channel;
|
|
const state = invite.state;
|
|
const RESOLVED = InviteStates.RESOLVED;
|
|
if (state !== RESOLVED) {
|
|
return null;
|
|
}
|
|
if (guild != null) {
|
|
value12 = ((Component) => <Component guild={guild} />)(importDefault(11976) /* metro dependency 11976: GuildInviteIcon */);
|
|
value13 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['3rE1P8']);
|
|
name = guild.name;
|
|
r5 = value12;
|
|
r12 = name;
|
|
r17 = value13;
|
|
var viewBindingProps = {style: [styles.container, style]};
|
|
items2 = [r5];
|
|
var viewBinding2Props = {style: styles.text};
|
|
items3 = [<LegacyText style={styles.inviteText}>{r17}</LegacyText>];
|
|
name = styles.name;
|
|
items3[1] = <LegacyText style={name}>{r12}</LegacyText>;
|
|
items2[1] = <View {...viewBinding2Props}>{items3}</View>;
|
|
return (
|
|
<View {...viewBindingProps}>
|
|
{items2}
|
|
</View>
|
|
);
|
|
}
|
|
if (channel != null) {
|
|
(importDefault(44) /* metro dependency 44 */)(inviter != null, 'Null inviter');
|
|
value7 = Object.create(UserRecord.prototype, {constructor: {value: UserRecord}});
|
|
userRecord = new UserRecord(inviter);
|
|
avatar = <Avatar user={userRecord instanceof Object ? userRecord : value7} guildId={undefined} />;
|
|
value10 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.OsdY8B);
|
|
formattedName = (importDefault(3995) /* metro dependency 3995: UserUtils */).getFormattedName(inviter);
|
|
r5 = avatar;
|
|
r12 = formattedName;
|
|
r17 = value10;
|
|
var viewBindingProps = {style: [styles.container, style]};
|
|
items2 = [r5];
|
|
var viewBinding2Props = {style: styles.text};
|
|
items3 = [<LegacyText style={styles.inviteText}>{r17}</LegacyText>];
|
|
items3[1] = <LegacyText style={styles.name}>{r12}</LegacyText>;
|
|
items2[1] = <View {...viewBinding2Props}>{items3}</View>;
|
|
return (
|
|
<View {...viewBindingProps}>
|
|
{items2}
|
|
</View>
|
|
);
|
|
}
|
|
if (inviter == null) {
|
|
return null;
|
|
}
|
|
const value2 = Object.create(UserRecord.prototype, {constructor: {value: UserRecord}});
|
|
userRecord = new UserRecord(inviter);
|
|
return (
|
|
<View style={[styles.container, style]}>
|
|
<Avatar user={userRecord instanceof Object ? userRecord : value2} guildId={undefined} />
|
|
<View style={styles.text}>
|
|
<LegacyText style={styles.inviteText}>
|
|
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t['+ITYkQ'])}
|
|
</LegacyText>
|
|
<LegacyText style={styles.name}>
|
|
{(importDefault(3995) /* metro dependency 3995: UserUtils */).getFormattedName(inviter, true)}
|
|
</LegacyText>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function GuildTemplateCard({guildTemplate, style}) { // fn#108262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:2097, offset: 0x0231a273, size: 303 bytes, params: 2, frame: 29
|
|
const styles = useStyles();
|
|
const items2 = [styles.container, style];
|
|
const image = <Image source={importDefault(10555) /* metro dependency 10555 */} />;
|
|
const LegacyText = (require(1305) /* metro dependency 1305: native */).LegacyText;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const QzUORX = (require(1244) /* metro dependency 1244: indexNative */).t.QzUORX;
|
|
return (
|
|
<View style={items2}>
|
|
{image}
|
|
<View style={styles.text}>
|
|
<LegacyText style={styles.inviteText}>
|
|
{Reflect.apply(string, intl, [QzUORX])}
|
|
</LegacyText>
|
|
<LegacyText style={styles.name}>
|
|
{guildTemplate.name}
|
|
</LegacyText>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function Centerpiece({invite, guildTemplate, inlineButtons}) { // fn#108263, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:2409, offset: 0x0231a3a2, size: 591 bytes, params: 2, frame: 38
|
|
const value2 = (importDefault(7556) /* metro dependency 7556: useIsWindowLarge */)();
|
|
const styles = useStyles(value2);
|
|
const moduleValue = require(12636) /* metro dependency 12636 */;
|
|
const value4 = invite != null;
|
|
const r15 = guildTemplate != null && guildTemplate.state === GuildTemplateStates.RESOLVED;
|
|
const items2 = [styles.centerpieceContainer];
|
|
const image = <Image style={styles.logo} source={moduleValue} />;
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
const r16 = value2 ? 1 : 2;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
let string = intl.string;
|
|
const items3 = [<Text style={styles.header} adjustsFontSizeToFit lineClamp={r16} variant="display-md" color="always-white" maxFontSizeMultiplier={1}>{Reflect.apply(string,
|
|
intl, [(require(1244) /* metro dependency 1244: indexNative */).t['3S2xmm']])}</Text>];
|
|
const items4 = [styles.subHeader];
|
|
items4[1] = value4 || r15 ? styles.subHeaderWithInvite : null;
|
|
string = intl.string;
|
|
const Gtcthl = (require(1244) /* metro dependency 1244: indexNative */).t.Gtcthl;
|
|
items3[1] = <Text variant="text-md/medium" color="always-white" style={items4} maxFontSizeMultiplier={3}>{Reflect.apply(string,
|
|
intl, [Gtcthl])}</Text>;
|
|
items3[2] = value4 ? <InviteCard invite={invite} /> : null;
|
|
items3[3] = r15 ? <GuildTemplateCard guildTemplate={guildTemplate} /> : null;
|
|
return (
|
|
<View style={items2}>
|
|
<ScrollView alwaysBounceVertical={false} contentContainerStyle={styles.scrollViewContainer}>
|
|
{image}
|
|
<View>
|
|
{items3}
|
|
</View>
|
|
{inlineButtons}
|
|
</ScrollView>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function _fun108264(a0) { // fn#108264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:414, offset: 0x0231a5f1, size: 173 bytes, params: 2, frame: 5
|
|
return {container: {'height': '100%', 'flex': 1, 'padding': 16}, logo: {'flex': 0, 'width': 93, 'height': 70,
|
|
'tintColor': 'white', 'alignSelf': 'center', 'marginBottom': 24}, scrollViewContainer: {'flexShrink': 0,
|
|
'flexGrow': 1, 'justifyContent': 'center'}, header: {'textAlign': 'center', 'marginBottom': 8,
|
|
'textTransform': 'uppercase'}, subHeader: {'fontSize': 18, 'textAlign': 'center', 'alignSelf': 'center',
|
|
'maxWidth': null, 'marginBottom': 24, 'marginHorizontal': 16, maxWidth: a0 ? 480 : 300},
|
|
subHeaderWithInvite: {marginBottom: 16}, centerpieceContainer: {'flexGrow': 1, 'flexShrink': 1,
|
|
'justifyContent': 'center'}, buttonContainer: {'paddingHorizontal': 28, 'maxWidth': 480, 'alignSelf': 'center',
|
|
'width': '100%'}};
|
|
}
|
|
|
|
function Welcome() { // fn#108265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:3287, offset: 0x0231a69e, size: 1013 bytes, params: 1, frame: 34
|
|
const TTIFirstContentfulPaint = (require(9871) /* metro dependency 9871: TTIFirstContentfulPaint */).TTIFirstContentfulPaint;
|
|
const ButtonGroup = (require(6261) /* metro dependency 6261: ButtonGroupNative */).ButtonGroup;
|
|
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
var items4;
|
|
var view;
|
|
const ThemeContextProvider = (require(3868) /* metro dependency 3868: native */).ThemeContextProvider;
|
|
var object;
|
|
var items2;
|
|
var object2;
|
|
var items3;
|
|
const value2 = (importDefault(7556) /* metro dependency 7556: useIsWindowLarge */)();
|
|
const styles = useStyles(value2);
|
|
const env0_0 = (require(1484) /* metro dependency 1484: useNavigationNative */).useNavigation();
|
|
const {top, bottom} = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)();
|
|
const env0_1 = (require(566) /* metro dependency 566: flux */).useStateFromStores([DisplayedInviteStore],
|
|
function() {
|
|
return DisplayedInviteStore.getDisplayedInviteCode();
|
|
});
|
|
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([InviteStore], _fun108267);
|
|
const guildTemplate = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildTemplateStore],
|
|
_fun108268);
|
|
const env0_3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([AgeGateStore], function() {
|
|
return AgeGateStore.isUnderageAnonymous();
|
|
});
|
|
const hasLoggedInAccounts = (require(566) /* metro dependency 566: flux */).useStateFromStores([MultiAccountStore],
|
|
function() {
|
|
return MultiAccountStore.getHasLoggedInAccounts();
|
|
});
|
|
const canUseMultiAccountMobile = (require(566) /* metro dependency 566: flux */).useStateFromStores([MultiAccountStore],
|
|
function() {
|
|
return MultiAccountStore.getCanUseMultiAccountMobile();
|
|
});
|
|
(importDefault(4594) /* metro dependency 4594: useMountEffect */)(_fun108272);
|
|
const binding = env0_3;
|
|
binding.useEffect(_fun108273, []);
|
|
(importDefault(6518) /* metro dependency 6518: useInitialValue */)(ExperimentStore.hasLoadedExperiments);
|
|
binding.useEffect(function() {
|
|
});
|
|
binding.useEffect(function() {
|
|
});
|
|
if (canUseMultiAccountMobile) {
|
|
if (hasLoggedInAccounts) {
|
|
return ((Component) => <Component />)(importDefault(14308) /* metro dependency 14308: ChooseAccount */);
|
|
}
|
|
var viewBindingProps = {style: styles.buttonContainer};
|
|
items4 = [<Button size="lg" variant="primary-overlay" onPress={onPress_108276} text={intl.string(t.pV8xeR)} />];
|
|
items4[1] = <Button size="lg" variant="secondary-overlay" onPress={onPress_108277} text={intl.string(t.dKhVQN)} />;
|
|
view = <View {...viewBindingProps}><ButtonGroup>{items4}</ButtonGroup></View>;
|
|
object = {};
|
|
items2 = [styles.container];
|
|
object2 = {};
|
|
object2.paddingTop = top + (require(5314) /* metro dependency 5314: NavigatorConstantsNative */).NAV_BAR_HEIGHT;
|
|
object2.paddingBottom = bottom;
|
|
items2[1] = object2;
|
|
object.style = items2;
|
|
items3 = [<Centerpiece invite={value4} guildTemplate={guildTemplate} inlineButtons={value2 ? view : null} />];
|
|
items3[1] = !value2 && view;
|
|
items3[2] = <TTIFirstContentfulPaint label="welcome" />;
|
|
return (
|
|
<ThemeContextProvider theme="darker">
|
|
<View {...object}>
|
|
{items3}
|
|
</View>
|
|
</ThemeContextProvider>
|
|
);
|
|
}
|
|
const button = <Button size="lg" variant="primary-overlay" onPress={onPress_108276} text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.pV8xeR)} />;
|
|
view = <View style={styles.buttonContainer}><ButtonGroup>{button}<Button size="lg" variant="secondary-overlay" onPress={onPress_108277} text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.dKhVQN)} /></ButtonGroup></View>;
|
|
items2 = [styles.container];
|
|
const NAV_BAR_HEIGHT = (require(5314) /* metro dependency 5314: NavigatorConstantsNative */).NAV_BAR_HEIGHT;
|
|
items2[1] = {paddingTop: top + NAV_BAR_HEIGHT, paddingBottom: bottom};
|
|
return (
|
|
<ThemeContextProvider theme="darker">
|
|
<View style={items2}>
|
|
<Centerpiece
|
|
invite={value4}
|
|
guildTemplate={guildTemplate}
|
|
inlineButtons={value2 ? view : null}
|
|
/>
|
|
{!value2 && view}
|
|
<TTIFirstContentfulPaint label="welcome" />
|
|
</View>
|
|
</ThemeContextProvider>
|
|
);
|
|
}
|
|
|
|
function _fun108267() { // fn#108267, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:3492, offset: 0x0231aaa6, size: 40 bytes, params: 1, frame: 12
|
|
const displayedInviteCodeBinding = displayedInviteCode;
|
|
const value2 = null;
|
|
return value2 != displayedInviteCodeBinding ? InviteStore.getInvite(displayedInviteCode) : value2;
|
|
}
|
|
|
|
function _fun108268() { // fn#108268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:3561, offset: 0x0231aace, size: 30 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
return GuildTemplateStore.getGuildTemplate(GuildTemplateStore.getDisplayedGuildTemplateCode());
|
|
}
|
|
|
|
function _fun108272() { // fn#108272, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:3857, offset: 0x0231ab29, size: 313 bytes, params: 1, frame: 21
|
|
const value2 = undefined;
|
|
(require(4884) /* metro dependency 4884: TTIAnalyticsUtils */).trackAppUIViewed();
|
|
(require(4884) /* metro dependency 4884: TTIAnalyticsUtils */).trackAppLaunchCompleted();
|
|
const value4 = null;
|
|
const r5 = value4 != env0_2 && value4 != env0_2.type ? InviteTypes[env0_2.type] : value4;
|
|
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
const APP_LANDING_VIEWED = AnalyticEvents.APP_LANDING_VIEWED;
|
|
const Storage = (require(587) /* metro dependency 587: Storage */).Storage;
|
|
const get = Storage.get;
|
|
const LOGOUT_TIMESTAMP_KEY = StorageKeys.LOGOUT_TIMESTAMP_KEY;
|
|
Reflect.apply(track, defaultImport, [APP_LANDING_VIEWED, {last_logout_ts: Reflect.apply(get, Storage,
|
|
[LOGOUT_TIMESTAMP_KEY]), invite_type: r5,
|
|
guild_id: value4 == env0_2 || value4 == env0_2.guild ? value2 : env0_2.guild.id,
|
|
channel_id: value4 == env0_2 || value4 == env0_2.channel ? value2 : env0_2.channel.id,
|
|
invite_code: value4 == env0_2 ? value2 : env0_2.code}]);
|
|
return value2;
|
|
}
|
|
|
|
function _fun108273() { // fn#108273, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:4239, offset: 0x0231ac62, size: 37 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
(importDefault(5076) /* metro dependency 5076: AuthenticationActionCreators */).getLocationMetadata();
|
|
}
|
|
|
|
function WelcomeOnPress() { // fn#108276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:4526, owner: Welcome.onPress, offset: 0x0231ac87, size: 146 bytes, params: 1, frame: 16
|
|
var moduleValue;
|
|
var binding;
|
|
var value;
|
|
if (env0_3) {
|
|
binding = env0_0;
|
|
binding.push(AuthStates.AGE_GATE_UNDERAGE, {fromRegister: true});
|
|
} else {
|
|
moduleValue = require(14303) /* metro dependency 14303: RegistrationStepsUtils */;
|
|
env0_0.push(moduleValue.getNextAuthState(AuthStates.WELCOME));
|
|
value = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
value.track(AnalyticEvents.REGISTER_VIEWED);
|
|
}
|
|
}
|
|
|
|
function WelcomeOnPress_108277() { // fn#108277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14503:4814, owner: Welcome.onPress, offset: 0x0231ad19, size: 87 bytes, params: 1, frame: 15
|
|
const binding = env0_0;
|
|
const push = binding.push;
|
|
const LOGIN = AuthStates.LOGIN;
|
|
Reflect.apply(push, binding, [LOGIN]);
|
|
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
const LOGIN_VIEWED = AnalyticEvents.LOGIN_VIEWED;
|
|
Reflect.apply(track, defaultImport, [LOGIN_VIEWED, {source: 'welcome'}]);
|
|
}
|
|
|