326 lines
12 KiB
TypeScript
326 lines
12 KiB
TypeScript
// Module ID: 11634
|
|
// Function ID: 11635
|
|
// Name: DMMessageStickerGreeting
|
|
// Dependencies: [5, 32, 19, 17, 5219, 4521, 1903, 21, 4303, 712, 4118, 4005, 4151, 4002, 11635, 11636, 6917, 1236, 589, 686, 4146, 11637, 9958, 4036, 4304, 1297, 9957, 4725, 4846, 9849, 4299, 4714, 2]
|
|
// Exports: default
|
|
|
|
// Module 11634 (DMMessageStickerGreeting)
|
|
import reinjectEphemerals from "reinjectEphemerals";
|
|
import set from "set";
|
|
import closure_5 from "set";
|
|
import { View } from "getSystemLocale";
|
|
import loadSavedGuildStickers from "loadSavedGuildStickers";
|
|
import closure_8 from "reinjectEphemerals";
|
|
import mergeGuildAvatar from "mergeGuildAvatar";
|
|
import jsxProd from "MAX_MESSAGES_ALLOWED_FOR_GREETING";
|
|
import createCacheKey from "createCacheKey";
|
|
|
|
let c10;
|
|
let closure_12;
|
|
let unpackModuleId;
|
|
const require = arg1;
|
|
({ jsx: c10, jsxs: unpackModuleId, Fragment: closure_12 } = jsxProd);
|
|
let closure_13 = createCacheKey.createStyles((arg0) => {
|
|
let BACKGROUND_BASE_LOWER = arg0;
|
|
if (arg0 == null) {
|
|
BACKGROUND_BASE_LOWER = importDefault(712).colors.BACKGROUND_BASE_LOWER;
|
|
}
|
|
let obj = { container: { backgroundColor: BACKGROUND_BASE_LOWER, alignItems: "center", paddingHorizontal: 16, paddingBottom: 16, paddingTop: 8 }, stickerContainer: { paddingBottom: 16 }, toastContainer: null, toastContent: null, gradient: null };
|
|
obj = { flexDirection: "row", backgroundColor: importDefault(712).colors.BACKGROUND_BASE_LOWEST, justifyContent: "center", alignItems: "center", gap: 8, height: 48, paddingHorizontal: 16, borderRadius: importDefault(712).radii.xxl };
|
|
obj[2] = obj;
|
|
obj[3] = { lineHeight: 20 };
|
|
obj[4] = { position: "absolute", right: 0, left: 0, top: 0, height: 30 };
|
|
return obj;
|
|
});
|
|
let c14 = "749054660769218631";
|
|
const END = require("getGradientColorByPercentage").GradientPercentage.END;
|
|
let closure_16 = { code: "function DMMessageStickerGreetingTsx1(){const{styles,isRendered,hasInputText,hasMessages,HEIGHT_COMPACT,HEIGHT_FULL,withDelay,withTiming,STANDARD_EASING}=this.__closure;const gradientOverlayOffset=styles.gradient.height;const hasHeight=isRendered&&!hasInputText;const heightExpanded=(hasMessages?HEIGHT_COMPACT:HEIGHT_FULL)-1;const targetHeight=hasHeight?heightExpanded+gradientOverlayOffset:0;const targetMargin=hasHeight?-gradientOverlayOffset:0;function generateAnimationConfig(value){return withDelay(300,withTiming(value,{easing:STANDARD_EASING,duration:250}));}return{justifyContent:'flex-end',overflow:'hidden',marginTop:generateAnimationConfig(targetMargin),height:generateAnimationConfig(targetHeight)};}" };
|
|
const result = require("noop").fileFinishedImporting("modules/messages/native/DMMessageStickerGreeting.tsx");
|
|
|
|
export default function DMMessageStickerGreeting(channel) {
|
|
let tmp17;
|
|
let tmp18;
|
|
channel = channel.channel;
|
|
let _require = channel;
|
|
const hasInputText = channel.hasInputText;
|
|
let first = hasInputText;
|
|
let dependencyMap;
|
|
let first1;
|
|
let callback;
|
|
let React;
|
|
let Text = _require;
|
|
let tmp = dependencyMap;
|
|
let obj = _require(4118);
|
|
let toastContent = callback3(obj.useGradientValue(END));
|
|
dependencyMap = toastContent;
|
|
let obj1 = _require(589);
|
|
const items = [closure_8];
|
|
const stateFromStores = obj1.useStateFromStores(items, () => {
|
|
const messages = outer1_8.getMessages(_undefined.id);
|
|
return messages.filter((type) => type.type !== callback(table[19]).MessageTypes.FRIEND_REQUEST_ACCEPTED).length > 0;
|
|
});
|
|
first1 = stateFromStores;
|
|
let obj2 = _require(589);
|
|
const items1 = [mergeGuildAvatar];
|
|
let tmp5 = first;
|
|
const stateFromStores1 = obj2.useStateFromStores(items1, () => outer1_9.getUser(_undefined.getRecipientId()));
|
|
let obj3 = first(4146);
|
|
let name = obj3.useName(stateFromStores1);
|
|
if (name == null) {
|
|
let intl = Text(1236).intl;
|
|
name = intl.string(Text(1236).t.y1Wu2f);
|
|
}
|
|
const intl2 = Text(1236).intl;
|
|
const formatToPlainStringResult = intl2.formatToPlainString(Text(1236).t.m0zYbV, { username: name });
|
|
const showConvoStarterInDM = Text(11637).useShowConvoStarterInDM(channel);
|
|
callback = showConvoStarterInDM;
|
|
const TextResult = Text(11637);
|
|
const tmp2 = END;
|
|
const items2 = [loadSavedGuildStickers];
|
|
const items3 = [showConvoStarterInDM];
|
|
const stateFromStores2 = Text(589).useStateFromStores(items2, () => {
|
|
let stickerById = null;
|
|
if (set) {
|
|
stickerById = outer1_7.getStickerById(outer1_14);
|
|
}
|
|
return stickerById;
|
|
}, items3);
|
|
const items4 = [showConvoStarterInDM];
|
|
const effect = React.useEffect(() => {
|
|
if (set) {
|
|
const stickerPack = _undefined(lib[22]).fetchStickerPack("847199849233514549", true);
|
|
const obj = _undefined(lib[22]);
|
|
}
|
|
}, items4);
|
|
_require = channel;
|
|
first = undefined;
|
|
dependencyMap = undefined;
|
|
first1 = undefined;
|
|
callback = undefined;
|
|
const tmp11 = callback(React.useState(null), 2);
|
|
first = tmp11[0];
|
|
dependencyMap = tmp11[1];
|
|
const tmp13 = callback(React.useState(false), 2);
|
|
first1 = tmp13[0];
|
|
callback = tmp13[1];
|
|
const items5 = [channel.id];
|
|
const effect1 = React.useEffect(() => {
|
|
lib(null);
|
|
}, items5);
|
|
const items6 = [first1, first, channel.id];
|
|
callback = React.useCallback(first1(function*() {
|
|
if (c5 === 2) {
|
|
c5 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp6 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c5 = 2;
|
|
let tmp7 = v0;
|
|
if (0 === v0) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
let closure_1 = tmp3;
|
|
let showErrorToast = tmp7;
|
|
showErrorToast = function showErrorToast(intl) {
|
|
if (callback !== intl) {
|
|
tmp30(intl);
|
|
}
|
|
let obj = callback(tmp30[13]);
|
|
obj = { key: "HANDLE_WAVE_PRESS_TOAST", content: intl, icon: callback(tmp30[14]) };
|
|
obj.open(obj);
|
|
};
|
|
tmp7 = c3;
|
|
if (!c3) {
|
|
v0(true);
|
|
if (null !== outer1_1) {
|
|
v0(false);
|
|
showErrorToast(tmp26);
|
|
c5 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
} else {
|
|
c3 = 1;
|
|
const obj1 = { channelId: null, source: "In-channel greet" };
|
|
obj1[0] = outer1_0.id;
|
|
outer1_0(outer1_2[15]).trackWaveCtaClicked(obj1);
|
|
const obj5 = outer1_0(outer1_2[15]);
|
|
v0 = 2;
|
|
c5 = 1;
|
|
const obj2 = { value: null, done: false };
|
|
obj2[0] = outer1_1(outer1_2[16]).sendGreetMessage(outer1_0.id, outer1_14);
|
|
return obj2;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (1 === tmp7) {
|
|
c3 = 0;
|
|
closure_1 = closure_2;
|
|
let ok = closure_1.ok;
|
|
if (!ok) {
|
|
ok = 429 !== closure_1.status;
|
|
}
|
|
if (!ok) {
|
|
const intl = outer1_0(outer1_2[17]).intl;
|
|
showErrorToast(intl.string(outer1_0(outer1_2[17]).t.Whhv4w));
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c3 = 0;
|
|
c5 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
c3 = 0;
|
|
}
|
|
tmp7 = v0(false);
|
|
}
|
|
c5 = 3;
|
|
} catch (tmp30) {
|
|
closure_2 = tmp30;
|
|
if (tmp4 === c3) {
|
|
c5 = tmp2;
|
|
throw tmp30;
|
|
} else {
|
|
v0 = tmp;
|
|
}
|
|
}
|
|
}
|
|
}), items6);
|
|
_require = undefined;
|
|
const TextResult1 = Text(589);
|
|
[tmp17, tmp18] = callback(React.useState(false), 2);
|
|
_require = tmp18;
|
|
const items7 = [tmp18];
|
|
React = tmp17;
|
|
const callback1 = React.useCallback(() => {
|
|
_undefined(true);
|
|
}, items7);
|
|
const tmp16 = callback(React.useState(false), 2);
|
|
const fn = function w() {
|
|
const height = lib.gradient.height;
|
|
let tmp = c5;
|
|
if (c5) {
|
|
tmp = !first;
|
|
}
|
|
let num = 0;
|
|
if (tmp) {
|
|
let num2 = 180;
|
|
if (first1) {
|
|
num2 = 72;
|
|
}
|
|
num = num2 - 1 + height;
|
|
}
|
|
let num4 = 0;
|
|
if (tmp) {
|
|
num4 = -height;
|
|
}
|
|
let obj = { justifyContent: "flex-end", overflow: "hidden", marginTop: null, height: null };
|
|
const obj2 = _undefined(lib[23]);
|
|
obj = { easing: _undefined(lib[25]).STANDARD_EASING, duration: 250 };
|
|
obj[2] = obj2.withDelay(300, _undefined(lib[24]).withTiming(num4, obj));
|
|
const obj3 = _undefined(lib[24]);
|
|
const obj5 = _undefined(lib[23]);
|
|
obj = { easing: _undefined(lib[25]).STANDARD_EASING, duration: 250 };
|
|
obj[3] = obj5.withDelay(300, _undefined(lib[24]).withTiming(num, obj));
|
|
return obj;
|
|
};
|
|
obj = { styles: toastContent, isRendered: tmp17, hasInputText, hasMessages: stateFromStores, HEIGHT_COMPACT: 72, HEIGHT_FULL: 180, withDelay: Text(4036).withDelay, withTiming: Text(4304).withTiming, STANDARD_EASING: Text(1297).STANDARD_EASING };
|
|
fn.__closure = obj;
|
|
fn.__workletHash = 6327401707106;
|
|
fn.__initData = closure_16;
|
|
const animatedStyle = Text(4036).useAnimatedStyle(fn);
|
|
const TextResult2 = Text(4036);
|
|
let BACKGROUND_BASE_LOWER = Text(4118).useGradientValue(tmp2);
|
|
const TextResult3 = Text(4118);
|
|
if (BACKGROUND_BASE_LOWER == null) {
|
|
BACKGROUND_BASE_LOWER = tmp5(712).colors.BACKGROUND_BASE_LOWER;
|
|
}
|
|
const token = Text(4005).useToken(BACKGROUND_BASE_LOWER);
|
|
const TextResult4 = Text(4005);
|
|
const items8 = [Text(4151).hexWithOpacity(token, 0), token];
|
|
const TextResult5 = Text(4151);
|
|
const shouldAnimateSticker = Text(9957).useShouldAnimateSticker(false);
|
|
if (!showConvoStarterInDM) {
|
|
return null;
|
|
} else {
|
|
obj = { style: null, onLayout: null, children: null };
|
|
obj[0] = animatedStyle;
|
|
obj[1] = callback1;
|
|
obj1 = { style: null, colors: null };
|
|
obj1[0] = toastContent.gradient;
|
|
obj1[1] = items8;
|
|
const items9 = [callback2(tmp5(4725), obj1), ];
|
|
obj2 = { style: null, children: null };
|
|
obj2[0] = toastContent.container;
|
|
if (stateFromStores) {
|
|
obj3 = { style: null, accessibilityRole: "button", accessibilityLabel: null, onPress: null, children: null };
|
|
obj3[0] = toastContent.toastContainer;
|
|
const intl3 = Text(1236).intl;
|
|
obj3[2] = intl3.string(Text(1236).t.pJObYI);
|
|
obj3[3] = callback;
|
|
let tmp24Result = null;
|
|
if (null != stateFromStores2) {
|
|
tmp5 = tmp5(9849);
|
|
const obj4 = { sticker: null, size: 24, animated: null };
|
|
obj4[0] = stateFromStores2;
|
|
obj4[2] = shouldAnimateSticker;
|
|
tmp24Result = tmp24(tmp5, obj4);
|
|
}
|
|
callback = [tmp24Result, ];
|
|
Text = Text(4299).Text;
|
|
let obj5 = { style: null, variant: "text-md/bold", children: null };
|
|
toastContent = toastContent.toastContent;
|
|
obj5[0] = toastContent;
|
|
obj5[2] = formatToPlainStringResult;
|
|
tmp = tmp24(Text, obj5);
|
|
callback[1] = tmp;
|
|
obj3[4] = callback;
|
|
let tmp23Result = tmp23(Text(4846).PressableOpacity, obj3);
|
|
} else {
|
|
tmp24Result = null;
|
|
if (null != stateFromStores2) {
|
|
const obj6 = { style: null, children: null };
|
|
obj6[0] = toastContent.stickerContainer;
|
|
const obj7 = { sticker: null, size: 100, animated: null };
|
|
obj7[0] = stateFromStores2;
|
|
obj7[2] = shouldAnimateSticker;
|
|
obj6[1] = tmp24(tmp5(9849), obj7);
|
|
tmp24Result = tmp24(tmp25, obj6);
|
|
}
|
|
const obj8 = { children: null };
|
|
const items10 = [tmp24Result, ];
|
|
const obj9 = { text: null, onPress: null, shrink: true };
|
|
obj9[0] = formatToPlainStringResult;
|
|
obj9[1] = callback;
|
|
items10[1] = tmp24(Text(4714).Button, obj9);
|
|
obj8[0] = items10;
|
|
tmp23Result = tmp23(closure_12, obj8);
|
|
const tmp26 = closure_12;
|
|
}
|
|
obj2[1] = tmp23Result;
|
|
obj2 = tmp24(tmp25, obj2);
|
|
items9[1] = obj2;
|
|
obj[2] = items9;
|
|
tmp23Result = tmp23(tmp5(4036).View, obj);
|
|
}
|
|
};
|