Files
2026-07-28 01:06:53 +03:00

243 lines
13 KiB
TypeScript

/* Metro module 15795; source: modules/avatar/native/components/RedesignAddAvatarModal.tsx; dependencies: [5, 57, 31, 27, 7624, 661, 33, 4501, 697, 1585, 566, 8403, 15780, 8421, 4660, 8400, 8402, 4573, 1244, 15789, 4578, 15777, 2] */
import Module00005 from '../../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import UseSafeAreaInsetsNative from '../../../safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */
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 FluxModule from '../../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */
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 VideoBackgroundModule from '../../../calls/native/VideoBackground.tsx'; /* Metro dependency 8421 */
function _fun121353(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121353, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16003:6, offset: 0x025453a4, size: 494 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_6 = value.View;
const env0_7 = value.ScrollView;
value = require(33) /* metro dependency 33 */;
const env0_10 = value.jsx;
const env0_11 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object.container = {flex: 1, backgroundColor: BACKGROUND_BASE_LOW};
object.contentContainer = {'flexGrow': 2, 'alignItems': 'center'};
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.growContainer = {flexGrow: 2, minHeight: PX_24};
object.headerContainer = {'display': 'flex', 'alignItems': 'center'};
object.buttonContainer = {width: '100%'};
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.title = {marginBottom: PX_8, textAlign: 'center'};
object.subtitle = {textAlign: 'center'};
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.errorContainer = {alignSelf: 'center', paddingTop: PX_24};
const env0_12 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/avatar/native/components/RedesignAddAvatarModal.tsx');
exports.default = RedesignAddAvatarModal;
function RedesignAddAvatarModal(a0) { // fn#121354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16003:773, offset: 0x02545592, size: 1138 bytes, params: 2, frame: 37
var r0;
var moduleValue2;
var createPendingImage;
const env0_0 = a0.route.params.onComplete;
const value = undefined;
const env0_4 = value;
const styles = useStyles();
let useState = ReactModule.useState;
const value3 = Reflect.apply(useState, ReactModule, [false]);
const binding2 = env0_4;
const value4 = binding2(value3, 2);
const property = value4[0];
const env0_1 = value4[1];
useState = ReactModule.useState;
const value5 = binding2(Reflect.apply(useState, ReactModule, []), 2);
const property2 = value5[0];
const property3 = value5[1];
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 = value;
}
const r10 = r0 ?? pendingAvatar;
const value6 = VideoBackgroundModule.memoizedImageSource(r10 == null ? value : r10.imageUri);
const items2 = [styles.contentContainer];
const object2 = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.paddingBottom = bottom + PX_16;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.paddingHorizontal = PX_16;
items2[1] = object2;
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="text-sm/medium"
color="text-default"
>
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.fH9TLT)}
</Text>
</View>,
];
items3[1] = ((Component) => <Component avatarSource={value6} showPendingAvatar={r10 != null} onSelectAvatar={function() {
return RedesignAddAvatarModal_handleSelectAvatar.apply(this, arguments);
}} />)(importDefault(15789) /* metro dependency 15789: TouchableUploadAvatar */);
items3[2] = (
<View style={styles.errorContainer}>
{property && <Text variant="text-sm/medium" color="text-feedback-critical">{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.XyLlVm)}</Text>}
</View>
);
const items4 = [
<View style={styles.headerContainer}>
{items3}
</View>,
];
items4[1] = ((Component) => <Component onAvatarSelect={property3} selectedAvatar={property2} />)(importDefault(15780) /* metro dependency 15780: PresetAvatarSelect */);
items4[2] = <View style={styles.growContainer} />;
const Button = (ButtonNativeModule).Button;
string = intl.string;
const PDTjLN = (require(1244) /* metro dependency 1244: indexNative */).t.PDTjLN;
items4[3] = (
<View style={styles.buttonContainer}>
<Button
variant="primary"
size="lg"
text={Reflect.apply(string, intl, [PDTjLN])}
onPress={onPress_121360}
disabled={r10 == null}
/>
</View>
);
return (
<ScrollView
style={styles.container}
alwaysBounceVertical={false}
contentContainerStyle={items2}
>
{items4}
</ScrollView>
);
function RedesignAddAvatarModal_handleSelectAvatar() { // fn#121355, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16003:1228, owner: RedesignAddAvatarModal._handleSelectAvatar, offset: 0x02545a04, size: 53 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_3(_fun121357).apply(this, arguments);
function* _fun121357() { // fn#121357, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16003:1289, offset: 0x02545a44, 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;
importDefault(false);
let binding = env3_0;
const value5 = binding(env3_2[14]);
const openImagePicker = value5.openImagePicker;
let object = {size: env3_9};
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[11]);
createPendingImage = value8.createPendingImage;
object = {imageUri: base64};
object.description = binding(binding2[11]).generateAvatarDescription();
r4 = Reflect.apply(createPendingImage, value8, [object]);
} else {
r4 = value3;
}
binding = env3_0;
binding3 = env3_2;
binding(binding3[15]).setPendingChanges({avatar: r4});
value11 = binding(binding3[16]);
announcePendingAvatarChange = value11.announcePendingAvatarChange;
r4 = r4 == null ? 'remove' : 'set';
Reflect.apply(announcePendingAvatarChange, value11, [r4]);
env2_3(value3);
} else {
match = base64.match;
binding = env3_0;
if (Reflect.apply(match, base64, [binding(env3_2[14]).base64GIFRegex]) != null) {
importDefault(true);
} else {
if (base64 != null) {
binding = env3_0;
binding2 = env3_2;
value8 = binding(binding2[11]);
createPendingImage = value8.createPendingImage;
object = {imageUri: base64};
object.description = binding(binding2[11]).generateAvatarDescription();
r4 = Reflect.apply(createPendingImage, value8, [object]);
} else {
r4 = value3;
}
binding = env3_0;
binding3 = env3_2;
binding(binding3[15]).setPendingChanges({avatar: r4});
value11 = binding(binding3[16]);
announcePendingAvatarChange = value11.announcePendingAvatarChange;
r4 = r4 == null ? 'remove' : 'set';
Reflect.apply(announcePendingAvatarChange, value11, [r4]);
env2_3(value3);
}
}
return value3;
}
}
function RedesignAddAvatarModalOnPress() { // fn#121360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16003:2755, owner: RedesignAddAvatarModal.onPress, offset: 0x02545b96, size: 76 bytes, params: 1, frame: 17
var environment;
let value = environment.__proto__;
value = require(15777) /* metro dependency 15777: AddAvatarModalActionCreators */;
return value.handlePressNext(env0_4, env0_2, onComplete ?? (function() {
}));
}
}
}
global.__d(_fun121353, 15795, [5, 57, 31, 27, 7624, 661, 33, 4501, 697, 1585, 566, 8403, 15780, 8421, 4660, 8400,
8402, 4573, 1244, 15789, 4578, 15777,
2]) /* metro module 15795, dependencies: [5, 57, 31, 27, 7624, 661, 33, 4501, 697, 1585, 566, 8403, 15780, 8421, 4660, 8400, 8402, 4573, 1244, 15789, 4578, 15777, 2] */;