decord/source/modules/user_profile/native/ChangeBannerActionSheet.tsx

305 lines
12 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 14074
// Function ID: 14075
2026-07-20 16:05:17 +00:00
// Name: ChangeBannerColorRow
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 19, 17, 8409, 676, 21, 4668, 712, 7177, 4042, 4346, 4843, 14075, 8424, 7213, 6987, 1236, 8027, 6317, 6322, 8122, 14076, 589, 8423, 8455, 8452, 688, 8413, 14077, 14079, 4739, 1297, 14084, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 14074 (ChangeBannerColorRow)
import ThemesDefault from "Themes" /* 712 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
import TableRowGroupTitle from "TableRowGroupTitle" /* 6317 */;
import TableRowInner from "TableRowInner" /* 6322 */;
import RedesignBottomSheetTitleHeaderBase from "RedesignBottomSheetTitleHeaderBase" /* 6987 */;
import context from "context" /* 7177 */;
import ActionSheet from "ActionSheet" /* 7213 */;
import Form from "Form" /* 8122 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
import closure_6 from "handleFormOpen" /* 8409 */;
import ME from "ME" /* 676 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4668 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function ChangeBannerColorRow(user) {
user = user.user;
2026-07-23 10:11:24 +00:00
let _require;
2026-07-29 08:29:29 +00:00
pendingAccentColor = undefined;
2026-08-24 06:08:38 +00:00
dependencyMap = undefined;
let tmp = callback3();
2026-07-29 08:29:29 +00:00
let obj = _require(589);
2026-08-24 06:08:38 +00:00
const items = [closure_6];
2026-07-29 08:29:29 +00:00
const stateFromStoresObject = obj.useStateFromStoresObject(items, () => pendingChanges.getPendingChanges());
({ pendingAccentColor, pendingAvatar } = stateFromStoresObject);
2026-08-24 06:08:38 +00:00
obj1 = _require(8423);
2026-07-29 08:29:29 +00:00
obj = { userId: user.id, image: pendingAvatar };
2026-07-20 16:05:17 +00:00
let pendingAvatarSrc = obj1.getPendingAvatarSrc(obj);
2026-08-24 06:08:38 +00:00
const tmp7 = pendingAccentColor(8455)(user.id);
2026-07-29 08:29:29 +00:00
if (pendingAvatarSrc == null) {
2026-07-20 16:05:17 +00:00
pendingAvatarSrc = user.getAvatarURL(undefined, 80);
}
2026-08-24 06:08:38 +00:00
let tmp2Result = tmp2(8452);
2026-07-29 08:29:29 +00:00
tmp2Result = tmp2(688);
const memoizedImageSourceResult = tmp2Result.memoizedImageSource(pendingAvatarSrc);
2026-08-24 06:08:38 +00:00
const rgb2intResult = tmp2Result.rgb2int(_require(8452).useDominantColorFromImage(pendingAvatarSrc, memoizedImageSourceResult));
2026-07-23 10:11:24 +00:00
_require = rgb2intResult;
2026-07-20 16:05:17 +00:00
if (undefined === pendingAccentColor) {
let primaryColor;
2026-07-29 08:29:29 +00:00
if (tmp7 != null) {
primaryColor = tmp7.primaryColor;
2026-07-20 16:05:17 +00:00
}
pendingAccentColor = primaryColor;
}
2026-07-29 08:29:29 +00:00
if (pendingAccentColor == null) {
pendingAccentColor = rgb2intResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (pendingAccentColor == null) {
pendingAccentColor = 0;
2026-07-20 16:05:17 +00:00
}
const items1 = [rgb2intResult];
2026-07-23 10:11:24 +00:00
dependencyMap = React.useCallback((arg0) => {
2026-07-20 16:05:17 +00:00
let tmp = arg0;
2026-07-23 10:11:24 +00:00
if (arg0 === _undefined) {
2026-07-20 16:05:17 +00:00
tmp = null;
}
2026-08-24 06:08:38 +00:00
_undefined(8413).setPendingChanges({ accentColor: tmp });
2026-07-20 16:05:17 +00:00
}, items1);
2026-07-29 08:29:29 +00:00
obj = { label: null, trailing: null, onPress: null };
obj1 = { style: tmp.label, text: null };
const intl = tmp2(1236).intl;
obj1[1] = intl.string(_require(1236).t.xzNfPz);
2026-08-24 06:08:38 +00:00
obj[0] = callback(_require(8122).FormLabel, obj1);
2026-07-29 08:29:29 +00:00
const obj2 = { style: tmp.selectedColor, children: null };
2026-08-24 06:08:38 +00:00
const items2 = [callback(pendingAccentColor(14079), { style: tmp.bannerColor, color: pendingAccentColor }), , ];
2026-07-29 08:29:29 +00:00
const obj4 = { style: tmp.selectedColorHex, variant: "text-md/medium", color: "interactive-text-default", children: null };
const obj3 = { style: tmp.bannerColor, color: pendingAccentColor };
2026-08-24 06:08:38 +00:00
const tmp2Result1 = _require(8452);
2026-07-29 08:29:29 +00:00
obj4[3] = _require(688).int2hex(pendingAccentColor);
2026-08-24 06:08:38 +00:00
items2[1] = callback(_require(4739).Text, obj4);
const tmp2Result2 = _require(688);
items2[2] = callback(_require(1297).Icon, { style: tmp.rowArrow, size: _require(1297).Icon.Sizes.CUSTOM, source: pendingAccentColor(14084) });
2026-07-29 08:29:29 +00:00
obj2[1] = items2;
obj[1] = callback2(View, obj2);
obj[2] = function handleChangeColor() {
2026-08-24 06:08:38 +00:00
pendingAccentColor(14077)({ color: pendingAccentColor, onSelect: dependencyMap });
2026-07-20 16:05:17 +00:00
};
2026-08-24 06:08:38 +00:00
return callback(_require(6322).TableRow, obj);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
({ AnalyticsObjects: error, UPLOAD_BANNER_SIZE: closure_8 } = ME);
2026-07-29 08:29:29 +00:00
({ jsx: c9, jsxs: c10, Fragment: unpackModuleId } = jsxProd);
createCacheKey = { label: null, sublabel: null, nitroWheel: null, bannerColor: null, selectedColor: null, selectedColorHex: null, rowArrow: null, upsellButton: null, remove: null, titleWrapper: null, titleContainer: null };
2026-08-24 06:08:38 +00:00
createCacheKey = { color: ThemesDefault.colors.INTERACTIVE_TEXT_ACTIVE, alignItems: "center", flexDirection: "row" };
2026-07-29 08:29:29 +00:00
createCacheKey[0] = createCacheKey;
2026-08-24 06:08:38 +00:00
createCacheKey[1] = { color: ThemesDefault.colors.TEXT_DEFAULT };
let obj1 = { color: ThemesDefault.colors.TEXT_DEFAULT };
createCacheKey[2] = { marginLeft: ThemesDefault.space.PX_8 };
let obj2 = { marginLeft: ThemesDefault.space.PX_8 };
createCacheKey[3] = { borderColor: ThemesDefault.colors.INTERACTIVE_TEXT_DEFAULT, borderWidth: 1, borderRadius: ThemesDefault.radii.xs, height: 24, minWidth: 24 };
2026-07-29 08:29:29 +00:00
createCacheKey[4] = { flexDirection: "row", alignItems: "center" };
createCacheKey[5] = { textTransform: "uppercase" };
createCacheKey[6] = { height: 13, width: 8, marginLeft: 10, marginTop: 2 };
2026-08-24 06:08:38 +00:00
let obj3 = { borderColor: ThemesDefault.colors.INTERACTIVE_TEXT_DEFAULT, borderWidth: 1, borderRadius: ThemesDefault.radii.xs, height: 24, minWidth: 24 };
createCacheKey[7] = { marginTop: ThemesDefault.space.PX_8 };
let obj4 = { marginTop: ThemesDefault.space.PX_8 };
createCacheKey[8] = { color: ThemesDefault.colors.TEXT_FEEDBACK_CRITICAL };
2026-07-29 08:29:29 +00:00
createCacheKey[9] = { flex: 0 };
createCacheKey[10] = { justifyContent: "flex-start" };
2026-08-24 06:08:38 +00:00
let closure_12 = createCacheKey.createStyles(createCacheKey);
let obj5 = { color: ThemesDefault.colors.TEXT_FEEDBACK_CRITICAL };
const result = require("set").fileFinishedImporting("modules/user_profile/native/ChangeBannerActionSheet.tsx");
2026-07-20 16:05:17 +00:00
export default function ChangeBannerActionSheet(isTryItOut) {
2026-07-23 10:11:24 +00:00
({ user, onBannerChange: require, removeText, showRemoveBanner } = isTryItOut);
2026-07-20 16:05:17 +00:00
if (showRemoveBanner === undefined) {
showRemoveBanner = false;
}
let flag = isTryItOut.isTryItOut;
if (flag === undefined) {
flag = false;
}
function _handleBannerUploadSelect(arg0) {
2026-07-29 08:29:29 +00:00
const self = this;
2026-08-24 06:08:38 +00:00
const tmp = closure_1_3(function*() {
2026-07-29 08:29:29 +00:00
if (c3 === 2) {
c3 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === originalMd5) {
if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let base64 = tmp5;
let lib = tmp2;
lib = undefined;
base64 = undefined;
originalMd5 = undefined;
2026-08-24 06:08:38 +00:00
let obj3 = closure_1_1(4346);
2026-08-11 06:20:06 +00:00
obj3.hideActionSheet();
2026-07-29 08:29:29 +00:00
originalMd5 = 1;
c3 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = closure_1_1(4843).openImagePicker(closure_1_8);
2026-07-29 08:29:29 +00:00
return obj1;
}
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 3;
2026-08-11 06:20:06 +00:00
const obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
2026-07-29 08:29:29 +00:00
} else {
lib = arg1;
base64 = lib.base64;
originalMd5 = lib.originalMd5;
if (null != base64) {
2026-08-24 06:08:38 +00:00
obj = closure_1_0(14075);
obj3 = { assetOrigin: null, imageUri: null, description: "", originalAsset: "Array", originalMd5: "Wumpus" };
obj3[0] = closure_1_0(8424).AssetOriginTypes.NEW_ASSET;
2026-08-11 06:20:06 +00:00
obj3[1] = base64;
obj3[4] = originalMd5;
lib(obj.createPendingImage(obj3));
2026-07-29 08:29:29 +00:00
}
c3 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
2026-08-11 06:20:06 +00:00
} catch (tmp20) {
2026-07-29 08:29:29 +00:00
c3 = tmp;
2026-08-11 06:20:06 +00:00
throw tmp20;
2026-07-29 08:29:29 +00:00
}
}
});
2026-08-24 06:08:38 +00:00
closure_1 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
let tmp = callback3();
2026-07-20 16:05:17 +00:00
if (!flag) {
2026-08-24 06:08:38 +00:00
flag = tmp2(4042).canUsePremiumProfileCustomization(user);
const tmp2Result = tmp2(4042);
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
let obj = { value: _handleBannerUploadSelect(7177)(isTryItOut.analyticsLocations).analyticsLocations, children: null };
2026-07-29 08:29:29 +00:00
obj = { title: null, trailing: null, titleWrapperStyle: null, titleContainerStyle: null };
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
obj[0] = intl.string(getSystemLocale.t.Vgdusv);
2026-07-29 08:29:29 +00:00
let tmp4Result = flag;
2026-07-20 16:05:17 +00:00
if (flag) {
2026-08-24 06:08:38 +00:00
tmp4Result = tmp4(tmp5(8027).NitroWheelIcon, {});
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = tmp4Result;
({ titleWrapper: obj3[2], titleContainer: obj3[3] } = tmp);
2026-08-24 06:08:38 +00:00
const items = [closure_9(RedesignBottomSheetTitleHeaderBase.BottomSheetTitleHeader, obj), ];
2026-07-29 08:29:29 +00:00
tmp4Result = null;
2026-07-20 16:05:17 +00:00
if (!flag) {
2026-08-24 06:08:38 +00:00
obj1 = { user: null };
2026-07-29 08:29:29 +00:00
obj1[0] = user;
tmp4Result = tmp4(ChangeBannerColorRow, obj1);
}
const items1 = [tmp4Result, , ];
2026-08-11 06:20:06 +00:00
let obj2 = { style: tmp.label, children: null };
2026-07-29 08:29:29 +00:00
const intl2 = tmp5(1236).intl;
2026-07-20 16:05:17 +00:00
const string = intl2.string;
2026-07-29 08:29:29 +00:00
const t = tmp5(1236).t;
2026-07-20 16:05:17 +00:00
if (showRemoveBanner) {
let stringResult = string(t.N0bC3P);
} else {
2026-07-23 10:11:24 +00:00
stringResult = string(t["70CYsY"]);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const items2 = [closure_9(Form.FormLabel, { text: stringResult }), ];
2026-07-29 08:29:29 +00:00
let tmp4Result1 = !flag;
if (!flag) {
2026-08-11 06:20:06 +00:00
let obj3 = { style: null, size: "sm" };
2026-07-29 08:29:29 +00:00
obj3[0] = tmp.nitroWheel;
2026-08-24 06:08:38 +00:00
tmp4Result1 = tmp4(tmp5(8027).NitroWheelIcon, obj3);
2026-07-29 08:29:29 +00:00
}
const obj4 = { label: closure_10(View, obj2), subLabel: null, onPress: null };
items2[1] = tmp4Result1;
obj2[1] = items2;
const obj5 = { style: tmp.sublabel, numberOfLines: 2, text: null };
const intl3 = tmp5(1236).intl;
2026-07-20 16:05:17 +00:00
const string2 = intl3.string;
2026-07-29 08:29:29 +00:00
const t2 = tmp5(1236).t;
2026-07-20 16:05:17 +00:00
if (flag) {
let string2Result = string2(t2.IhzZlo);
} else {
string2Result = string2(t2.NSTmdO);
}
2026-07-29 08:29:29 +00:00
obj5[2] = string2Result;
2026-08-24 06:08:38 +00:00
const items3 = [closure_9(Form.FormSubLabel, obj5), ];
2026-07-29 08:29:29 +00:00
let tmp4Result2 = !flag;
if (!flag) {
const obj6 = { style: null, children: null };
obj6[0] = tmp.upsellButton;
const obj7 = { analyticsObject: null };
obj7[0] = constants.EDIT_PROFILE_BANNER;
2026-08-24 06:08:38 +00:00
obj6[1] = tmp4(tmp2(14076), obj7);
2026-07-29 08:29:29 +00:00
tmp4Result2 = tmp4(tmp10, obj6);
}
items3[1] = tmp4Result2;
obj4[1] = closure_10(closure_11, { children: items3 });
2026-07-20 16:05:17 +00:00
let handleBannerUploadSelect;
if (flag) {
handleBannerUploadSelect = function handleBannerUploadSelect() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _handleBannerUploadSelect.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};
}
2026-07-29 08:29:29 +00:00
obj4[2] = handleBannerUploadSelect;
2026-08-24 06:08:38 +00:00
items1[1] = closure_9(TableRowInner.TableRow, obj4);
2026-07-20 16:05:17 +00:00
if (showRemoveBanner) {
2026-07-29 08:29:29 +00:00
const obj8 = { style: null, text: null };
2026-07-20 16:05:17 +00:00
const items4 = [, ];
({ label: arr5[0], remove: arr5[1] } = tmp);
2026-07-29 08:29:29 +00:00
obj8[0] = items4;
if (removeText == null) {
const intl4 = tmp5(1236).intl;
removeText = intl4.string(tmp5(1236).t.tT9n7D);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj9 = { label: null, onPress: null };
obj8[1] = removeText;
2026-08-24 06:08:38 +00:00
obj9[0] = tmp4(tmp5(8122).FormLabel, obj8);
2026-07-29 08:29:29 +00:00
obj9[1] = function handleBannerDelete() {
2026-07-20 16:05:17 +00:00
callback(null);
2026-08-24 06:08:38 +00:00
_handleBannerUploadSelect(closure_1_2[10]).hideActionSheet();
2026-07-20 16:05:17 +00:00
};
2026-08-24 06:08:38 +00:00
showRemoveBanner = tmp4(tmp5(6322).TableRow, obj9);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj10 = { children: null };
2026-07-20 16:05:17 +00:00
items1[2] = showRemoveBanner;
2026-08-24 06:08:38 +00:00
items[1] = closure_10(TableRowGroupTitle.TableRowGroup, { hasIcons: false, children: items1 });
2026-07-29 08:29:29 +00:00
obj10[0] = items;
2026-08-24 06:08:38 +00:00
obj[1] = closure_10(ActionSheet.ActionSheet, obj10);
return closure_9(context.AnalyticsLocationProvider, obj);
2026-07-20 16:05:17 +00:00
};