decord/source/modules/activities/native/ActivityShareLinkModal.tsx
2026-08-05 07:35:12 +00:00

312 lines
12 KiB
TypeScript

// Module ID: 13630
// Function ID: 13631
// Name: ActivityShareLinkModal
// Dependencies: [5, 32, 19, 17, 1372, 1874, 1371, 9510, 4248, 21, 4255, 712, 589, 7200, 11404, 13629, 5601, 1351, 13631, 6811, 7036, 3956, 1236, 5623, 3955, 1474, 500, 5230, 8165, 5223, 5902, 4199, 4799, 10132, 10151, 2]
// Exports: default
// Module 13630 (ActivityShareLinkModal)
import mergeGuildAvatar from "mergeGuildAvatar";
import getMixedGradientColor from "getMixedGradientColor";
import trackInvite from "trackInvite";
import { View } from "isDiscordFrontendDevelopment";
import ensureGuildLoaded from "ensureGuildLoaded";
import closure_8 from "mergeGuildAvatar";
import participantFromServer from "participantFromServer";
import { UserRowModes } from "UserRowModes";
import { MessageSendLocation } from "MESSAGE_GROUP_SPACING";
import jsxProd from "dispatcher";
import createCacheKey from "createCacheKey";
let closure_12;
let map1;
const require = arg1;
({ jsx: closure_12, jsxs: map1 } = jsxProd);
createCacheKey = { headerContainer: null, header: null, container: null };
createCacheKey = { paddingHorizontal: require("Themes").space.PX_16, paddingVertical: require("Themes").space.PX_8, backgroundColor: require("Themes").colors.BACKGROUND_BASE_LOWER };
createCacheKey[0] = createCacheKey;
createCacheKey[1] = { borderBottomWidth: 0, shadowColor: "transparent", backgroundColor: "transparent" };
createCacheKey[2] = { flex: 1, display: "flex", backgroundColor: require("Themes").colors.BACKGROUND_BASE_LOWER };
createCacheKey = createCacheKey.createStyles(createCacheKey);
let obj1 = { flex: 1, display: "flex", backgroundColor: require("Themes").colors.BACKGROUND_BASE_LOWER };
let result = require("noop").fileFinishedImporting("modules/activities/native/ActivityShareLinkModal.tsx");
export default function ActivityShareLinkModal(applicationId) {
let c6;
let tmp7;
applicationId = applicationId.applicationId;
const customId = applicationId.customId;
const linkId = applicationId.linkId;
const message = applicationId.message;
const onShare = applicationId.onShare;
let stateFromStores;
c6 = undefined;
let first;
let closure_8;
let first1;
let UserRowModes;
let stateFromStores1;
let first2;
let c13;
let first3;
let closure_15;
let height;
const tmp = first3();
let obj = applicationId(linkId[12]);
const items = [first1];
stateFromStores = obj.useStateFromStores(items, () => first1.getConnectedActivityChannelId());
const items1 = [stateFromStores];
const memo = stateFromStores.useMemo(() => {
let destinationIdFromChannelId;
if (null != stateFromStores) {
destinationIdFromChannelId = applicationId(linkId[13]).getDestinationIdFromChannelId(tmp);
const obj = applicationId(linkId[13]);
}
return destinationIdFromChannelId;
}, items1);
[tmp7, c6] = onShare(stateFromStores.useState(false), 2);
const tmp8 = onShare(stateFromStores.useState(false), 2);
first = tmp8[0];
closure_8 = tmp8[1];
const tmp10 = onShare(stateFromStores.useState([]), 2);
first1 = tmp10[0];
UserRowModes = tmp10[1];
const callback = stateFromStores.useCallback((arg0) => {
callback(arg0);
}, []);
let obj1 = applicationId(linkId[12]);
const items2 = [closure_8];
stateFromStores1 = obj1.useStateFromStores(items2, () => currentUser.getCurrentUser());
const tmp13 = onShare(stateFromStores.useState(""), 2);
first2 = tmp13[0];
c13 = tmp15;
const items3 = [applicationId, stateFromStores1, customId, linkId, tmp13[1]];
const effect = stateFromStores.useEffect(() => {
let obj = applicationId(linkId[14]);
obj = { applicationId, referrerId: null, customId: null, linkId: null };
let id;
if (stateFromStores1 != null) {
id = stateFromStores1.id;
}
obj[1] = id;
obj[2] = customId;
obj[3] = linkId;
c13(obj.getActivityLaunchURL(obj));
}, items3);
const items4 = [first, onShare];
const callback1 = stateFromStores.useCallback(() => {
onShare(false, first);
const result = applicationId(linkId[15]).closeActivityShareLinkModal();
}, items4);
const items5 = [applicationId];
first3 = onShare(customId(linkId[16])(items5), 1)[0];
const items6 = [first3, first, first2, message, onShare, first1];
const items7 = [first2];
const callback2 = stateFromStores.useCallback(message(function*() {
if (c3 === 2) {
c3 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp5 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
return { value: "T", done: null };
}
} else {
try {
c3 = 2;
if (0 === dependencyMap) {
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 closure_1 = tmp3;
let closure_0 = tmp2;
closure_0 = undefined;
closure_1 = undefined;
if (null != outer1_14) {
dependencyMap = 1;
c3 = 1;
let obj1 = { value: null, done: false };
obj1[0] = Promise.all(outer1_9.map(outer1_0(7200).getOrResolveChannelIdFromDestinationId));
return obj1;
} else {
c3 = 3;
}
}
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 !== 2) {
closure_0 = arg1.filter(outer1_0(1351).isNotNullish);
closure_1 = outer1_0(13631).resolveActivityShareMessageContent(c3, name, closure_12);
callback2(true);
const item = closure_0.forEach((() => {
let closure_0 = v3((arg0) => {
let closure_0 = arg0;
let c2 = 0;
let c1 = 0;
return (function*(arg0) {
if (c1 === 2) {
c1 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
return { value: "T", done: null };
}
} else {
try {
c1 = 2;
if (0 === c2) {
if (arg0 === 1) {
c1 = 3;
throw arg1;
} else if (arg0 === 2) {
c1 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
const channel = outer2_7.getChannel(closure_0);
if (null != channel) {
let obj1 = outer2_1(outer2_2[19]);
let obj2 = outer2_1(outer2_2[20]);
obj1 = { location: null };
obj1[0] = outer2_11.ACTIVITY_SHARE;
c2 = 1;
c1 = 1;
obj2 = { value: null, done: false };
obj2[0] = obj1.sendMessage(tmp18, obj2.parse(channel, c1), false, obj1);
return obj2;
}
}
} else if (arg0 === 1) {
c1 = 3;
throw arg1;
} else if (arg0 === 2) {
c1 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
}
c1 = 3;
return { value: "T", done: null };
} catch (tmp12) {
c1 = tmp;
throw tmp12;
}
}
})();
});
return function() {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
})());
const obj5 = outer1_0(13631);
let obj2 = { key: "ACTIVITY_SHARE_LINK_SUCCESS", content: null };
const intl = outer1_0(1236).intl;
const obj3 = { applicationName: null };
obj3[0] = name.name;
obj2[1] = intl.formatToPlainString(outer1_0(1236).t.jQULqL, obj3);
outer1_1(3956).open(obj2);
callback(true, ensureGuildLoaded);
const obj6 = outer1_1(3956);
const result = outer1_0(13629).closeActivityShareLinkModal();
const obj9 = outer1_0(13629);
}
c3 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} catch (tmp11) {
c3 = tmp;
throw tmp11;
}
}
}), items6);
closure_15 = stateFromStores.useCallback(() => {
applicationId(linkId[23]).copy(first2);
currentUser(true);
const obj = applicationId(linkId[23]);
applicationId(linkId[24]).presentLinkCopied();
}, items7);
height = customId(linkId[25])({ ignoreKeyboard: true }).height;
const items8 = [height];
obj = {
style: stateFromStores.useMemo(() => {
const height = "100%";
return { height };
}, items8),
children: null
};
obj = { style: tmp.headerContainer, children: null };
obj1 = { headerStyle: tmp.header, title: null, headerTitle: null, headerLeft: null, headerRight: null, headerStatusBarHeight: null, headerTitleAlign: "center" };
let intl = applicationId(linkId[22]).intl;
obj1[1] = intl.string(applicationId(linkId[22]).t.r9qKow);
obj1[2] = function headerTitle(children) {
return first2(applicationId(linkId[28]).GenericHeaderTitle, { title: children.children, subtitle: message, variant: "redesign/heading-18/bold" });
};
let obj5 = applicationId(linkId[29]);
obj1[3] = obj5.getHeaderCloseButton(callback1);
obj1[4] = function headerRight(arg0) {
const obj = {};
const merged = Object.assign(arg0);
obj.onPress = closure_15;
const intl = applicationId(linkId[22]).intl;
obj.accessibilityLabel = intl.string(applicationId(linkId[22]).t.Xrt5Po);
obj.IconComponent = applicationId(linkId[31]).LinkIcon;
return first2(applicationId(linkId[30]).HeaderActionButton, obj);
};
const tmp6 = onShare(stateFromStores.useState(false), 2);
let num;
if (obj7.isIOS()) {
num = 0;
}
obj1[5] = num;
obj[1] = first2(applicationId(linkId[27]).Header, obj1);
const items9 = [first2(c6, obj), ];
let obj2 = { style: tmp.container, children: null };
const items10 = [first2(customId(linkId[32]), { absolute: true }), first2(customId(linkId[33]), { disableGradient: true, disableStickySections: true, initialSelectedDestinations: [], insetEnd: 0, onSelectedDestinationChange: callback, originDestination: memo, rowMode: UserRowModes.TOGGLE }), ];
const obj4 = { disabled: tmp7, floatingBackgroundColor: tmp.container.backgroundColor, isVisible: first1.length > 0, loading: tmp7, onPress: null, text: null };
let tmp24;
if (!tmp7) {
tmp24 = callback2;
}
obj4[4] = tmp24;
if (1 === first1.length) {
const intl3 = tmp2(tmp3[22]).intl;
let stringResult = intl3.string(tmp2(tmp3[22]).t.TXNS7S);
} else {
const intl2 = tmp2(tmp3[22]).intl;
obj5 = { count: null };
obj5[0] = length;
stringResult = intl2.formatToPlainString(tmp2(tmp3[22]).t.jWtYUm, obj5);
}
obj4[5] = stringResult;
items10[2] = first2(applicationId(linkId[34]).ModalFloatingAction, obj4);
obj2[1] = items10;
items9[1] = c13(c6, obj2);
obj[1] = items9;
return c13(c6, obj);
};