241 lines
13 KiB
TypeScript
241 lines
13 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] */
|
|
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
|
|
var object3;
|
|
const env0_0 = require;
|
|
const closure = AddAvatarModal;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
const env0_4 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_5 = importAll(31) /* metro dependency 31 */;
|
|
const env0_6 = (require(27) /* metro dependency 27 */).View;
|
|
const userProfileSettingsStore = importDefault(7624) /* metro dependency 7624: UserProfileSettingsStore */;
|
|
let value = require(661) /* metro dependency 661: Constants */;
|
|
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;
|
|
object3 = {};
|
|
const object5 = {'flex': 1, 'backgroundColor': null, 'justifyContent': 'center', 'paddingTop': null,
|
|
'alignItems': 'center'};
|
|
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
|
|
object5.backgroundColor = BACKGROUND_BASE_LOW;
|
|
const NAV_BAR_HEIGHT = (require(5314) /* metro dependency 5314: NavigatorConstantsNative */).NAV_BAR_HEIGHT;
|
|
object5.paddingTop = NAV_BAR_HEIGHT + 32;
|
|
object3.container = object5;
|
|
object3.headerContainer = {'display': 'flex', 'alignItems': 'center'};
|
|
object3.buttonContainer = {'marginHorizontal': 16, 'marginBottom': 16};
|
|
object3.title = {'marginBottom': 8, 'textAlign': 'center'};
|
|
object3.subtitle = {textAlign: 'center'};
|
|
object3.errorContainer = {'alignSelf': 'center', 'paddingTop': 24};
|
|
const object6 = {};
|
|
const textStyles = importDefault(6597) /* metro dependency 6597: TextStyles */;
|
|
const DISPLAY_MEDIUM = Fonts.DISPLAY_MEDIUM;
|
|
const RED_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_400;
|
|
copyDataProperties(object6, textStyles(DISPLAY_MEDIUM, RED_400, 12), undefined);
|
|
object3.errorText = object6;
|
|
const env0_11 = Reflect.apply(createStyles, value, [object3]);
|
|
const SLIDE_IN_OUT = ModalAnimation.SLIDE_IN_OUT;
|
|
closure.modalConfig = {animation: SLIDE_IN_OUT};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/avatar/native/components/AddAvatarModal.tsx');
|
|
exports.default = closure;
|
|
}
|
|
|
|
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] = env0_4(env0_5.useState(false), 2);
|
|
const [property2, property3] = env0_4(env0_5.useState(), 2);
|
|
const bottom = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)().bottom;
|
|
const fluxModule = require(566) /* metro dependency 566: flux */;
|
|
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 videoBackgroundModule = require(8421) /* metro dependency 8421: VideoBackground */;
|
|
const value7 = videoBackgroundModule.memoizedImageSource(r11 == null ? value2 : r11.imageUri);
|
|
const items2 = [styles.container];
|
|
items2[1] = {paddingBottom: bottom > 0 ? bottom : 16};
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).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 AddAvatarScreen_handleSelectAvatar.apply(this, arguments);
|
|
}} />)(importDefault(15789) /* metro dependency 15789: TouchableUploadAvatar */);
|
|
const LegacyText = (require(1305) /* metro dependency 1305: native */).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 = (require(4578) /* metro dependency 4578: ButtonNative */).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 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 = env0_5.useMemo(function() {
|
|
return _fun121266();
|
|
}, []);
|
|
const Navigator = (require(5280) /* metro dependency 5280: NavigatorNative */).Navigator;
|
|
return <Navigator screens={value2} initialRouteName="ADD_AVATAR" />;
|
|
}
|
|
|
|
function AddAvatarScreen_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 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(env0_3, env0_1);
|
|
}
|
|
|
|
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* _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 object2 = {size: env3_8};
|
|
yield Reflect.apply(openImagePicker, value5, [object2]);
|
|
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;
|
|
object2 = {imageUri: base64};
|
|
object2.description = binding(binding2[13]).generateAvatarDescription();
|
|
r4 = Reflect.apply(createPendingImage, value8, [object2]);
|
|
} 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;
|
|
object2 = {imageUri: base64};
|
|
object2.description = binding(binding2[13]).generateAvatarDescription();
|
|
r4 = Reflect.apply(createPendingImage, value8, [object2]);
|
|
} 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 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 object = {};
|
|
const value = environment.__proto__.__proto__;
|
|
const ImpressionNames = (require(480) /* metro dependency 480: AnalyticsUtils */).ImpressionNames;
|
|
const AVATAR_UPLOAD = ImpressionNames.AVATAR_UPLOAD;
|
|
object.impressionName = AVATAR_UPLOAD;
|
|
object.headerRight = headerRight_121267;
|
|
object.headerLeft = function() {
|
|
return null;
|
|
};
|
|
object.headerTitle = (require(5282) /* metro dependency 5282: NavigatorHeaderNative */).getHeaderNoTitle();
|
|
object.ignoreKeyboard = true;
|
|
object.fullscreen = true;
|
|
object.render = render_121270;
|
|
return {ADD_AVATAR: object};
|
|
}
|
|
|
|
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 = (require(5277) /* metro dependency 5277: HeaderActionButtonNative */).HeaderActionButton;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
return (
|
|
<HeaderActionButton
|
|
text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['5Wxrcd'])}
|
|
onPress={onPress_121268}
|
|
/>
|
|
);
|
|
}
|
|
|
|
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 />;
|
|
}
|
|
|
|
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 (require(15777) /* metro dependency 15777: AddAvatarModalActionCreators */).showSkipAvatarModal();
|
|
}
|
|
|