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

278 lines
16 KiB
TypeScript

/* Metro module 13185; source: modules/user_profile/native/ChangeBannerActionSheet.tsx; dependencies: [5, 31, 27, 7624, 661, 33, 4501, 697, 6771, 3802, 4080, 4660, 6805, 6758, 1244, 7954, 6231, 6238, 7972, 13186, 566, 8403, 8490, 8421, 673, 8400, 13187, 4573, 1305, 13188, 13189, 2] */
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */
import UserProfileSettingsStore from '../UserProfileSettingsStore.tsx'; /* Metro dependency 7624 */
import UseDisplayProfile from '../hooks/useDisplayProfile.tsx'; /* Metro dependency 8490 */
import ColorBlock from '../../../components_native/common/color_picker/ColorBlock.tsx'; /* Metro dependency 13187 */
import ShowCustomColorPickerActionSheet from '../../color_picker/native/showCustomColorPickerActionSheet.tsx'; /* Metro dependency 13189 */
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 ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as ColorUtilsModule from '../../../external/discord_common/js/shared/utils/ColorUtils.tsx'; /* Metro dependency 673 */
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 TableRowGroupNativeModule from '../../../design/components/TableRow/native/TableRowGroup.native.tsx'; /* Metro dependency 6231 */
import * as TableRowNativeModule from '../../../design/components/TableRow/native/TableRow.native.tsx'; /* Metro dependency 6238 */
import * as BottomSheetTitleHeaderNativeModule from '../../../design/components/Sheet/native/BottomSheetTitleHeader.native.tsx'; /* Metro dependency 6758 */
import * as UseAnalyticsLocationsModule from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
import * as ActionSheetNativeModule from '../../../design/components/Sheet/native/ActionSheet.native.tsx'; /* Metro dependency 6805 */
import * as NativeModule2 from '../../../design/void/Form/native/index.tsx'; /* Metro dependency 7972 */
import * as RecentAvatarUtilsModule from '../../recent_avatars/RecentAvatarUtils.tsx'; /* Metro dependency 8403 */
import * as VideoBackgroundModule from '../../calls/native/VideoBackground.tsx'; /* Metro dependency 8421 */
function _fun100641(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#100641, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:6, offset: 0x021f1753, size: 608 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const env0_7 = value.AnalyticsObjects;
const env0_8 = value.UPLOAD_BANNER_SIZE;
value = require(33) /* metro dependency 33 */;
const env0_9 = value.jsx;
const env0_10 = value.jsxs;
const env0_11 = value.Fragment;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
object.label = {'color': null, 'alignItems': 'center', 'flexDirection': 'row', color: INTERACTIVE_TEXT_ACTIVE};
const TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_DEFAULT;
object.sublabel = {color: TEXT_DEFAULT};
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.nitroWheel = {marginLeft: PX_8};
const object4 = {'borderColor': null, 'borderWidth': 1, 'borderRadius': null, 'height': 24, 'minWidth': 24};
const INTERACTIVE_TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_DEFAULT;
object4.borderColor = INTERACTIVE_TEXT_DEFAULT;
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
object.bannerColor = object4;
object.selectedColor = {'flexDirection': 'row', 'alignItems': 'center'};
object.selectedColorHex = {textTransform: 'uppercase'};
object.rowArrow = {'height': 13, 'width': 8, 'marginLeft': 10, 'marginTop': 2};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.upsellButton = {marginTop: PX_8};
const TEXT_FEEDBACK_CRITICAL = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_FEEDBACK_CRITICAL;
object.remove = {color: TEXT_FEEDBACK_CRITICAL};
object.titleWrapper = {flex: 0};
object.titleContainer = {justifyContent: 'flex-start'};
const env0_12 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/user_profile/native/ChangeBannerActionSheet.tsx');
exports.default = ChangeBannerActionSheet;
function ChangeBannerColorRow({user}) { // fn#100642, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:894, offset: 0x021f19b3, size: 747 bytes, params: 2, frame: 29
const styles = useStyles();
const {pendingAvatar,
pendingAccentColor} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([UserProfileSettingsStore],
function() {
return UserProfileSettingsStore.getPendingChanges();
});
const pendingAvatarSrc = (RecentAvatarUtilsModule).getPendingAvatarSrc({userId: user.id,
image: pendingAvatar});
const value5 = (UseDisplayProfile)(user.id);
const r11 = pendingAvatarSrc ?? user.getAvatarURL(undefined, 80);
const value7 = (VideoBackgroundModule).memoizedImageSource(r11);
const rgb2int = ColorUtilsModule.rgb2int;
const useDominantColorFromImage = VideoBackgroundModule.useDominantColorFromImage;
const value8 = Reflect.apply(rgb2int, ColorUtilsModule, [Reflect.apply(useDominantColorFromImage,
VideoBackgroundModule, [r11, value7])]);
const r19 = (pendingAccentColor !== undefined ? pendingAccentColor : value5?.primaryColor) ?? value8 ?? 0;
const env0_2 = ReactModule.useCallback(_fun100644, [value8]);
const TableRow = (TableRowNativeModule).TableRow;
object = {};
const FormLabel = (NativeModule2).FormLabel;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object.label = (
<FormLabel
style={styles.label}
text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.xzNfPz)}
/>
);
const items2 = [
((Component) => <Component style={styles.bannerColor} color={r19} />)(ColorBlock),
];
const Text = (TextModule).Text;
items2[1] = (
<Text
style={styles.selectedColorHex}
variant="text-md/medium"
color="interactive-text-default"
>
{ColorUtilsModule.int2hex(r19)}
</Text>
);
const Icon = (NativeModule).Icon;
const Icon2 = (NativeModule).Icon;
const Sizes = Icon2.Sizes;
const CUSTOM = Sizes.CUSTOM;
items2[2] = (
<Icon
style={styles.rowArrow}
size={CUSTOM}
source={importDefault(13188) /* metro dependency 13188 */}
/>
);
object.trailing = (
<View style={styles.selectedColor}>
{items2}
</View>
);
object.onPress = onPress_100645;
return <TableRow {...object} />;
function _fun100644(a0) { // fn#100644, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:1349, offset: 0x021f1cb1, size: 61 bytes, params: 2, frame: 13
let value = a0;
const r4 = value !== env0_0 ? value : null;
value = environment.__proto__;
value = require(8400) /* metro dependency 8400: UserProfileSettingsActionCreators */;
value.setPendingChanges({accentColor: r4});
}
function ChangeBannerColorRowOnPress() { // fn#100645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:1851, owner: ChangeBannerColorRow.onPress, offset: 0x021f1cee, size: 54 bytes, params: 1, frame: 13
const value = environment.__proto__;
(ShowCustomColorPickerActionSheet)({color: env0_1,
onSelect: env0_2});
}
}
function ChangeBannerActionSheet({user, analyticsLocations, onBannerChange, removeText, showRemoveBanner, isTryItOut}) { // fn#100646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:1896, offset: 0x021f1d24, size: 1166 bytes, params: 2, frame: 47
var r12;
var object;
showRemoveBanner = !(showRemoveBanner === undefined) && showRemoveBanner;
isTryItOut = !(isTryItOut === undefined) && isTryItOut;
const styles = useStyles();
analyticsLocations = (importDefault(6771) /* metro dependency 6771: useAnalyticsLocations */)(analyticsLocations).analyticsLocations;
const r26 = isTryItOut || (importDefault(3802) /* metro dependency 3802: PremiumUtils */).canUsePremiumProfileCustomization(user);
const value5 = _fun100647();
const AnalyticsLocationProvider = (UseAnalyticsLocationsModule).AnalyticsLocationProvider;
const ActionSheet = (ActionSheetNativeModule).ActionSheet;
const BottomSheetTitleHeader = (BottomSheetTitleHeaderNativeModule).BottomSheetTitleHeader;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const Vgdusv = t.Vgdusv;
const bottomSheetTitleHeader = (
<BottomSheetTitleHeader
title={Reflect.apply(string, intl, [Vgdusv])}
trailing={r26 && ((NitroWheelIcon) => <NitroWheelIcon />)((require(7954) /* metro dependency 7954: NitroWheelIcon */).NitroWheelIcon)}
titleWrapperStyle={styles.titleWrapper}
titleContainerStyle={styles.titleContainer}
/>
);
const TableRowGroup = (TableRowGroupNativeModule).TableRowGroup;
const items2 = [
r26
? null
: (
<ChangeBannerColorRow user={user} />
),
];
const TableRow = (TableRowNativeModule).TableRow;
const object3 = {};
const FormLabel = (NativeModule2).FormLabel;
string = intl.string;
const formLabel = (
<FormLabel
text={showRemoveBanner ? Reflect.apply(string, intl, [t.N0bC3P]) : Reflect.apply(string, intl,
[t['70CYsY']])}
/>
);
const value13 = !r26;
object3.label = (
<View style={styles.label}>
{formLabel}
{
r26
? value13
: ((NitroWheelIcon) => <NitroWheelIcon style={styles.nitroWheel} size="sm" />)((require(7954) /* metro dependency 7954: NitroWheelIcon */).NitroWheelIcon)
}
</View>
);
const jsxRuntimeEnv0_11Binding = jsxRuntimeEnv0_11;
const FormSubLabel = (NativeModule2).FormSubLabel;
string = intl.string;
object3.subLabel = (
<>
<FormSubLabel
style={styles.sublabel}
numberOfLines={2}
text={r26 ? Reflect.apply(string, intl, [t.IhzZlo]) : Reflect.apply(string, intl, [t.NSTmdO])}
/>
{
r26
? value13
: (
<View style={styles.upsellButton}>
{((Component) => <Component analyticsObject={AnalyticsObjects.EDIT_PROFILE_BANNER} />)(importDefault(13186) /* metro dependency 13186: UserProfileUpsellButton */)}
</View>
)
}
</>
);
object3.onPress = r26 ? value5 : undefined;
items2[1] = <TableRow {...object3} />;
if (showRemoveBanner) {
r12 = (
<TableRow
label={<FormLabel
style={[styles.label, styles.remove]}
text={removeText ?? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.tT9n7D)}
/>}
onPress={onPress_100651}
/>
);
} else {
r12 = showRemoveBanner;
}
items2[2] = r12;
return (
<AnalyticsLocationProvider value={analyticsLocations}>
<ActionSheet>
{bottomSheetTitleHeader}
<TableRowGroup hasIcons={false}>
{items2}
</TableRowGroup>
</ActionSheet>
</AnalyticsLocationProvider>
);
function _fun100647() { // fn#100647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:2122, offset: 0x021f21b2, size: 36 bytes, params: 1, frame: 12
const env0_0 = env1_3(_fun100649);
return _fun100650;
function* _fun100649() { // fn#100649, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:2142, offset: 0x021f21e1, size: 119 bytes, params: 1, frame: 16
if (true) {
value = environment.__proto__.__proto__.__proto__;
var binding = env3_1;
var binding2 = env3_2;
binding(binding2[10]).hideActionSheet();
var value4 = binding(binding2[11]);
yield value4.openImagePicker(env3_8);
value = undefined;
if (false) {
return value;
}
var base64 = value.base64;
if (base64 != null) {
require(base64, environment.__proto__.__proto__.originalMd5);
}
}
}
function _fun100650() { // fn#100650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:2274, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
}
function ChangeBannerActionSheetOnPress() { // fn#100651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13375:3363, owner: ChangeBannerActionSheet.onPress, offset: 0x021f2258, size: 51 bytes, params: 1, frame: 12
onBannerChange(null);
const value = environment.__proto__;
(ActionSheetActionCreators).hideActionSheet();
}
}
}
global.__d(_fun100641, 13185, [5, 31, 27, 7624, 661, 33, 4501, 697, 6771, 3802, 4080, 4660, 6805, 6758, 1244, 7954,
6231, 6238, 7972, 13186, 566, 8403, 8490, 8421, 673, 8400, 13187, 4573, 1305, 13188, 13189,
2]) /* metro module 13185, dependencies: [5, 31, 27, 7624, 661, 33, 4501, 697, 6771, 3802, 4080, 4660, 6805, 6758, 1244, 7954, 6231, 6238, 7972, 13186, 566, 8403, 8490, 8421, 673, 8400, 13187, 4573, 1305, 13188, 13189, 2] */;