Files
discord-decomp/sources/modules/avatar/native/components/AddAvatarModal.tsx
T
2026-07-28 01:06:53 +03:00

291 lines
17 KiB
TypeScript

/* Metro module 15779; source: modules/avatar/native/components/AddAvatarModal.tsx; dependencies: [5, 57, 31, 27, 7624, 661, 33, 4501, 697, 5314, 6597, 1585, 566, 8403, 15780, 8421, 4660, 8400, 8402, 4573, 1244, 15789, 1305, 4578, 15777, 480, 5277, 5282, 5280, 2] */
import Module00005 from '../../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import Native from '../../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import UseSafeAreaInsetsNative from '../../../safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */
import TextStyles from '../../../rebrand/native/TextStyles.tsx'; /* Metro dependency 6597 */
import UserProfileSettingsStore from '../../../user_profile/UserProfileSettingsStore.tsx'; /* Metro dependency 7624 */
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 AnalyticsUtilsModule from '../../../../external/discord_common/js/packages/analytics-utils/AnalyticsUtils.tsx'; /* Metro dependency 480 */
import * as FluxModule from '../../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as NativeModule from '../../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as TextModule from '../../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ButtonNativeModule from '../../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as HeaderActionButtonNativeModule from '../../../../design/components/Navigator/native/HeaderActionButton.native.tsx'; /* Metro dependency 5277 */
import * as NavigatorNativeModule from '../../../../design/components/Navigator/native/Navigator.native.tsx'; /* Metro dependency 5280 */
import * as NavigatorConstantsNativeModule from '../../../../design/components/Navigator/native/NavigatorConstants.native.tsx'; /* Metro dependency 5314 */
import * as VideoBackgroundModule from '../../../calls/native/VideoBackground.tsx'; /* Metro dependency 8421 */
import * as AddAvatarModalActionCreatorsModule from '../AddAvatarModalActionCreators.tsx'; /* Metro dependency 15777 */
function _fun121256(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:6, offset: 0x0254266b, size: 542 bytes, params: 8, frame: 27
const env0_0 = require;
const AddAvatarModal2 = AddAvatarModal;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const Fonts = value.Fonts;
const ModalAnimation = value.ModalAnimation;
const env0_8 = value.UPLOAD_MEDIUM_SIZE;
value = require(33) /* metro dependency 33 */;
const env0_9 = value.jsx;
const env0_10 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const object2 = {'flex': 1, 'backgroundColor': null, 'justifyContent': 'center', 'paddingTop': null,
'alignItems': 'center'};
const BACKGROUND_BASE_LOW = (Native).colors.BACKGROUND_BASE_LOW;
object2.backgroundColor = BACKGROUND_BASE_LOW;
const NAV_BAR_HEIGHT = (NavigatorConstantsNativeModule).NAV_BAR_HEIGHT;
object2.paddingTop = NAV_BAR_HEIGHT + 32;
object.container = object2;
object.headerContainer = {'display': 'flex', 'alignItems': 'center'};
object.buttonContainer = {'marginHorizontal': 16, 'marginBottom': 16};
object.title = {'marginBottom': 8, 'textAlign': 'center'};
object.subtitle = {textAlign: 'center'};
object.errorContainer = {'alignSelf': 'center', 'paddingTop': 24};
const object4 = {};
const DISPLAY_MEDIUM = Fonts.DISPLAY_MEDIUM;
const RED_400 = (Native).unsafe_rawColors.RED_400;
copyDataProperties(object4, TextStyles(DISPLAY_MEDIUM, RED_400, 12), undefined);
object.errorText = object4;
const env0_11 = Reflect.apply(createStyles, value, [object]);
const SLIDE_IN_OUT = ModalAnimation.SLIDE_IN_OUT;
AddAvatarModal2.modalConfig = {animation: SLIDE_IN_OUT};
(FileImportTrackerModule).fileFinishedImporting('modules/avatar/native/components/AddAvatarModal.tsx');
exports.default = AddAvatarModal2;
function AddAvatarScreen() { // fn#121257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:724, offset: 0x02542889, size: 1068 bytes, params: 1, frame: 38
var r0;
var moduleValue2;
var createPendingImage;
const value2 = undefined;
const styles = useStyles();
const [property, env0_0] = Module00057(ReactModule.useState(false), 2);
const [property2, property3] = Module00057(ReactModule.useState(), 2);
const bottom = (UseSafeAreaInsetsNative)().bottom;
const useStateFromStores = FluxModule.useStateFromStores;
let object = [UserProfileSettingsStore];
const pendingAvatar = Reflect.apply(useStateFromStores, FluxModule, [object, function() {
return UserProfileSettingsStore.getPendingChanges().pendingAvatar;
}]);
if (property2 != null) {
moduleValue2 = require(8403) /* metro dependency 8403: RecentAvatarUtils */;
createPendingImage = moduleValue2.createPendingImage;
object = {};
object.imageUri = (require(15780) /* metro dependency 15780: PresetAvatarSelect */).DEFAULT_AVATARS[property2];
object.description = (require(8403) /* metro dependency 8403: RecentAvatarUtils */).generateAvatarDescription();
r0 = Reflect.apply(createPendingImage, moduleValue2, [object]);
} else {
r0 = value2;
}
const r11 = r0 ?? pendingAvatar;
const value7 = VideoBackgroundModule.memoizedImageSource(r11 == null ? value2 : r11.imageUri);
const items2 = [styles.container];
items2[1] = {paddingBottom: bottom > 0 ? bottom : 16};
const Text = (TextModule).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
const XQRWvR = (require(1244) /* metro dependency 1244: indexNative */).t.XQRWvR;
const items3 = [
<View>
<Text
style={styles.title}
accessibilityRole="header"
variant="heading-xl/extrabold"
color="mobile-text-heading-primary"
>
{Reflect.apply(string, intl, [XQRWvR])}
</Text>
<Text
style={styles.subtitle}
variant="heading-deprecated-12/medium"
color="text-default"
>
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.fH9TLT)}
</Text>
</View>,
];
items3[1] = ((Component) => <Component avatarSource={value7} showPendingAvatar={r11 != null} onSelectAvatar={function() {
return _handleSelectAvatar.apply(this, arguments);
}} />)(importDefault(15789) /* metro dependency 15789: TouchableUploadAvatar */);
const LegacyText = (NativeModule).LegacyText;
items3[2] = (
<View style={styles.errorContainer}>
<LegacyText style={styles.errorText}>
{property && intl.string((require(1244) /* metro dependency 1244: indexNative */).t.XyLlVm)}
</LegacyText>
</View>
);
const items4 = [
<View style={styles.headerContainer}>
{items3}
</View>,
];
items4[1] = ((Component) => <Component onAvatarSelect={property3} selectedAvatar={property2} />)(importDefault(15780) /* metro dependency 15780: PresetAvatarSelect */);
const Button = (ButtonNativeModule).Button;
string = intl.string;
const PDTjLN = (require(1244) /* metro dependency 1244: indexNative */).t.PDTjLN;
items4[2] = (
<View style={styles.buttonContainer}>
<Button
text={Reflect.apply(string, intl, [PDTjLN])}
grow
onPress={onPress_121263}
disabled={r11 == null}
/>
</View>
);
return (
<View style={items2}>
{items4}
</View>
);
function _handleSelectAvatar() { // fn#121258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:1142, owner: AddAvatarScreen._handleSelectAvatar, offset: 0x02542cb5, size: 53 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_3(_fun121260).apply(this, arguments);
function* _fun121260() { // fn#121260, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:1203, offset: 0x02542cf5, size: 313 bytes, params: 1, frame: 22
var r4;
var match;
var binding2;
var value8;
var createPendingImage;
var binding3;
var value11;
var announcePendingAvatarChange;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
const value3 = undefined;
require(false);
let binding = env3_0;
const value5 = binding(env3_2[16]);
const openImagePicker = value5.openImagePicker;
let object = {size: env3_8};
yield Reflect.apply(openImagePicker, value5, [object]);
const value6 = undefined;
if (false) {
return value6;
}
const base64 = value6.base64;
if (base64 == null) {
if (base64 != null) {
binding = env3_0;
binding2 = env3_2;
value8 = binding(binding2[13]);
createPendingImage = value8.createPendingImage;
object = {imageUri: base64};
object.description = binding(binding2[13]).generateAvatarDescription();
r4 = Reflect.apply(createPendingImage, value8, [object]);
} else {
r4 = value3;
}
binding = env3_0;
binding3 = env3_2;
binding(binding3[17]).setPendingChanges({avatar: r4});
value11 = binding(binding3[18]);
announcePendingAvatarChange = value11.announcePendingAvatarChange;
r4 = r4 == null ? 'remove' : 'set';
Reflect.apply(announcePendingAvatarChange, value11, [r4]);
dependencyMap(value3);
} else {
match = base64.match;
binding = env3_0;
if (Reflect.apply(match, base64, [binding(env3_2[16]).base64GIFRegex]) != null) {
require(true);
} else {
if (base64 != null) {
binding = env3_0;
binding2 = env3_2;
value8 = binding(binding2[13]);
createPendingImage = value8.createPendingImage;
object = {imageUri: base64};
object.description = binding(binding2[13]).generateAvatarDescription();
r4 = Reflect.apply(createPendingImage, value8, [object]);
} else {
r4 = value3;
}
binding = env3_0;
binding3 = env3_2;
binding(binding3[17]).setPendingChanges({avatar: r4});
value11 = binding(binding3[18]);
announcePendingAvatarChange = value11.announcePendingAvatarChange;
r4 = r4 == null ? 'remove' : 'set';
Reflect.apply(announcePendingAvatarChange, value11, [r4]);
dependencyMap(value3);
}
}
return value3;
}
}
function AddAvatarScreenOnPress() { // fn#121263, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:2486, owner: AddAvatarScreen.onPress, offset: 0x02542e47, size: 50 bytes, params: 1, frame: 13
let value = environment.__proto__;
value = require(15777) /* metro dependency 15777: AddAvatarModalActionCreators */;
return value.handlePressNext(Module00005, env0_1);
}
}
function AddAvatarModal() { // fn#121264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:2544, offset: 0x02542e79, size: 87 bytes, params: 1, frame: 14
const value2 = ReactModule.useMemo(function() {
return _fun121266();
}, []);
const Navigator = (NavigatorNativeModule).Navigator;
return <Navigator screens={value2} initialRouteName="ADD_AVATAR" />;
function _fun121265() { // fn#121265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:2587, offset: 0x02542ed0, size: 17 bytes, params: 1, frame: 9
return getScreens_121266();
function getScreens_121266() { // fn#121266, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:2591, offset: 0x02542ee1, size: 130 bytes, params: 1, frame: 15
var environment;
const object2 = {};
const value = environment.__proto__.__proto__;
const ImpressionNames = (AnalyticsUtilsModule).ImpressionNames;
const AVATAR_UPLOAD = ImpressionNames.AVATAR_UPLOAD;
object2.impressionName = AVATAR_UPLOAD;
object2.headerRight = headerRight_121267;
object2.headerLeft = function() {
return null;
};
object2.headerTitle = (require(5282) /* metro dependency 5282: NavigatorHeaderNative */).getHeaderNoTitle();
object2.ignoreKeyboard = true;
object2.fullscreen = true;
object2.render = render_121270;
return {ADD_AVATAR: object2};
function getScreens_121266HeaderRight() { // fn#121267, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:2698, owner: getScreens_121266.headerRight, offset: 0x02542f63, size: 109 bytes, params: 1, frame: 18
const HeaderActionButton = (HeaderActionButtonNativeModule).HeaderActionButton;
const intl = (IndexNativeModule).intl;
return (
<HeaderActionButton
text={intl.string((IndexNativeModule).t['5Wxrcd'])}
onPress={onPress_121268}
/>
);
function headerRightOnPress_121268() { // fn#121268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:2789, owner: getScreens_121266.headerRight.onPress, offset: 0x02542fd0, size: 37 bytes, params: 1, frame: 11
const value = environment.__proto__.__proto__.__proto__.__proto__;
return (AddAvatarModalActionCreatorsModule).showSkipAvatarModal();
}
}
function getScreens_121266Render() { // fn#121270, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15987:2925, owner: getScreens_121266.render, offset: 0x02542ff5, size: 23 bytes, params: 1, frame: 13
return <AddAvatarScreen />;
}
}
}
}
}
global.__d(_fun121256, 15779, [5, 57, 31, 27, 7624, 661, 33, 4501, 697, 5314, 6597, 1585, 566, 8403, 15780, 8421,
4660, 8400, 8402, 4573, 1244, 15789, 1305, 4578, 15777, 480, 5277, 5282, 5280,
2]) /* metro module 15779, dependencies: [5, 57, 31, 27, 7624, 661, 33, 4501, 697, 5314, 6597, 1585, 566, 8403, 15780, 8421, 4660, 8400, 8402, 4573, 1244, 15789, 1305, 4578, 15777, 480, 5277, 5282, 5280, 2] */;