decord/alpha/source/modules/rtc/native/SecureFramesUserVerificationModal.tsx
github-actions 72019a2d0c chore: update source for alpha 348.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
2026-09-25 08:38:05 +00:00

241 lines
13 KiB
TypeScript

// Module ID: 9157
// Function ID: 9158
// Name: SecureFramesUserVerificationModal
// Dependencies: [32, 19, 17, 2044, 1372, 9154, 1074, 1181, 21, 4829, 576, 504, 4981, 9158, 9160, 9133, 9161, 9152, 5032, 4525, 4788, 1115, 9162, 9163, 7801, 6578, 7617, 9164, 1177, 6539, 5428, 5935, 4825, 5272, 9165, 9167, 5274, 2]
// Exports: default
// Module 9157 (SecureFramesUserVerificationModal)
import nativeDefault from "native" /* 576 */;
import util from "util" /* 1115 */;
import native from "native" /* 1177 */;
import ToastActionCreatorsDefault from "ToastActionCreators" /* 4525 */;
import CircleCheckIcon from "CircleCheckIcon" /* 4788 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 5032 */;
import showUserProfileActionSheetDefault from "showUserProfileActionSheet" /* 7617 */;
import SecureFramesUtils from "SecureFramesUtils" /* 9152 */;
import SecureFramesTracking from "SecureFramesTracking" /* 9163 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
import ChannelStore from "ChannelStore" /* 2044 */;
import UserStore from "UserStore" /* 1372 */;
require = fn;
get_ActivityIndicator = fn(17);
({ ActivityIndicator: hasOwnProperty, View: metroRequire } = get_ActivityIndicator);
const SecureFramesConstants = fn(9154);
({ USER_VERIFICATION_CHUNK_SIZE: closure_9, USER_VERIFICATION_LENGTH: c10, USER_VERIFICATION_NUM_COLUMNS: closure_11, USER_VERIFIED_TOAST_KEY: closure_12 } = SecureFramesConstants);
const Constants = fn(1074);
({ AnalyticsLocations: map1, AnalyticsSections: closure_14 } = Constants);
const ANDROID_FOREGROUND_RIPPLE = fn(1181).ANDROID_FOREGROUND_RIPPLE;
const jsxProd = fn(21);
({ jsx: closure_16, jsxs: closure_17 } = jsxProd);
const createStyles = fn(4829);
let obj2 = { container: { flex: 1, padding: 16, flexDirection: "column", backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOW }, footer: { flex: 1, gap: 16, justifyContent: "flex-end" }, footerText: { textAlign: "center" }, header: { height: 56, flexDirection: "row", alignItems: "center", justifyContent: "space-between" }, subtitle: { textAlign: "center" }, code: { marginTop: 24 }, helpMessage: { marginBottom: 16 } };
let closure_18 = createStyles.createStyles(obj2);
const size = fn(2);
let result = size.fileFinishedImporting("modules/rtc/native/SecureFramesUserVerificationModal.tsx");
export default function SecureFramesUserVerificationModal(userId) {
userId = userId.userId;
const channelId = userId.channelId;
let name;
let isCurrentUserKeyPersistent;
let isOtherUserKeyPersistent;
let enabled;
let analyticsLocations;
const tmp = closure_18();
let items = [isOtherUserKeyPersistent];
const stateFromStores = userId(name[11]).useStateFromStores(items, () => UserStore.getUser(userId));
let obj = userId(name[11]);
let items1 = [isCurrentUserKeyPersistent];
const stateFromStores1 = userId(name[11]).useStateFromStores(items1, () => {
const channel = ChannelStore.getChannel(channelId);
let guildId;
if (channel != null) {
guildId = channel.getGuildId();
}
return guildId;
});
let obj2 = userId(name[11]);
name = channelId(name[12]).useName(stateFromStores1, null, stateFromStores);
let obj3 = channelId(name[12]);
const secureFramesPairwiseFingerprint = userId(name[13]).useSecureFramesPairwiseFingerprint({ userId });
const fingerprint = secureFramesPairwiseFingerprint.fingerprint;
const fingerprintUserKey = secureFramesPairwiseFingerprint.fingerprintUserKey;
let obj4 = userId(name[13]);
const readableSecureFramesFingerprint = userId(name[14]).useReadableSecureFramesFingerprint({ fingerprintBase64: fingerprint, chunkSize: enabled, desiredLength: analyticsLocations });
const obj5 = userId(name[14]);
const obj6 = { fingerprintBase64: fingerprint, chunkSize: enabled, desiredLength: analyticsLocations };
const isUserSecureFramesVerified = userId(name[15]).useIsUserSecureFramesVerified({ userId, channelId, userKey: fingerprintUserKey });
const obj7 = userId(name[15]);
const isPersistentSecureFramesFingerprint = userId(name[16]).useIsPersistentSecureFramesFingerprint({ userId, userKey: fingerprintUserKey });
isCurrentUserKeyPersistent = isPersistentSecureFramesFingerprint.isCurrentUserKeyPersistent;
isOtherUserKeyPersistent = isPersistentSecureFramesFingerprint.isOtherUserKeyPersistent;
const items2 = [channelId, fingerprintUserKey, isOtherUserKeyPersistent, name, userId];
let callback = fingerprintUserKey.useCallback(() => {
if (null != fingerprintUserKey) {
const obj = SecureFramesUtils;
obj.addVerification(userId, tmp, isOtherUserKeyPersistent, channelId, map1.E2EE_USER_VERIFY_MODAL);
ModalActionCreatorsDefault.pop();
const obj3 = { key, iconColor: "text-feedback-positive", IconComponent: CircleCheckIcon.CircleCheckIcon, content: null };
const intl = util.intl;
const obj4 = { username: name };
obj3.content = intl.formatToPlainString(util.t.Gwu134, obj4);
ToastActionCreatorsDefault.open(obj3);
}
}, items2);
const items3 = [fingerprintUserKey, isOtherUserKeyPersistent, userId];
const callback1 = fingerprintUserKey.useCallback(() => {
if (null != fingerprintUserKey) {
SecureFramesUtils.deleteVerification(userId, tmp, isOtherUserKeyPersistent);
ModalActionCreatorsDefault.pop();
}
}, items3);
const obj8 = userId(name[16]);
enabled = userId(name[22]).useSecureFramesDeeplinkExperiment({ location: "SecureFramesUserVerificationModal" }).enabled;
const items4 = [channelId, readableSecureFramesFingerprint, fingerprint, enabled, userId];
const callback2 = fingerprintUserKey.useCallback(() => {
if (null != fingerprint) {
if (null != readableSecureFramesFingerprint) {
let obj2 = dependencyMap;
ModalActionCreatorsDefault.pop();
let showShareActionSheet = require;
const obj = { userId, channelId };
const result = SecureFramesTracking.trackE2EEUserVerificationShareClicked(obj);
if (enabled) {
let userVerificationDeeplink = showShareActionSheet(9152).getUserVerificationDeeplink(tmp8, tmp);
const showShareActionSheetResult = showShareActionSheet(9152);
} else {
userVerificationDeeplink = obj3.join(" ");
}
tmp8 = userId;
showShareActionSheet = showShareActionSheet(7801).showShareActionSheet;
obj2 = { message: userVerificationDeeplink };
showShareActionSheet(obj2, constants.SECURE_FRAMES_VOICE_BOTTOM_SHEET);
const showShareActionSheetResult1 = showShareActionSheet(7801);
}
obj3 = readableSecureFramesFingerprint;
}
}, items4);
analyticsLocations = channelId(name[25])().analyticsLocations;
const items5 = [analyticsLocations, channelId, userId];
const callback3 = fingerprintUserKey.useCallback(() => {
ModalActionCreatorsDefault.pop();
showUserProfileActionSheetDefault({ userId, channelId, isVoiceContext: true, sourceAnalyticsLocations: analyticsLocations });
}, items5);
const obj9 = userId(name[22]);
const obj10 = userId(name[27]);
const alertIfSecureFramesKeyInconsistent = obj10.useAlertIfSecureFramesKeyInconsistent({ channelId, userId, nickname: name, onAlertOpen: channelId(name[18]).pop });
const items6 = [isUserSecureFramesVerified];
const obj11 = { channelId, userId, nickname: name, onAlertOpen: channelId(name[18]).pop };
const items7 = [isCurrentUserKeyPersistent, isOtherUserKeyPersistent, name];
[tmp18, tmp19] = fingerprint(fingerprintUserKey.useMemo(() => {
const intl = util.intl;
const string = intl.string;
const t = util.t;
if (isUserSecureFramesVerified) {
const items = [string(t.UNUuem), native.BadgeColors.INFO];
let items1 = items;
} else {
items1 = [string(t.y2b7CA), native.BadgeColors.DANGER];
}
return items1;
}, items6), 2);
const items8 = [channelId, userId];
const memo = fingerprintUserKey.useMemo(() => SecureFramesUtils.getUserVerificationFooterText({ isCurrentUserKeyPersistent, isOtherUserKeyPersistent, otherUserNickname: name }), items7);
const effect = fingerprintUserKey.useEffect(() => {
const result = SecureFramesTracking.trackE2EEUserVerificationViewed({ userId, channelId });
}, items8);
const rect = { top: true, bottom: true, style: tmp.container, children: null };
const obj12 = { style: tmp.header, children: null };
const obj13 = { accessibilityRole: "button", accessibilityLabel: null, androidRippleConfig: null, hitSlop: 8, onPress: null, children: null };
let intl = userId(name[21]).intl;
obj13.accessibilityLabel = intl.string(userId(name[21]).t.cpT0Cq);
obj13.androidRippleConfig = ANDROID_FOREGROUND_RIPPLE;
obj13.onPress = callback3;
obj13.children = closure_16(userId(name[31]).ArrowLargeLeftIcon, { size: "md" });
const items9 = [closure_16(userId(name[30]).PressableOpacity, obj13), ];
let tmp24Result = null != fingerprint && null != readableSecureFramesFingerprint;
if (tmp24Result) {
const obj14 = { accessibilityRole: "button", accessibilityLabel: null, androidRippleConfig: null, hitSlop: 8, onPress: null, children: null };
const intl2 = tmp2(tmp3[21]).intl;
obj14.accessibilityLabel = intl2.string(tmp2(tmp3[21]).t.RDE0Sc);
obj14.androidRippleConfig = tmp25;
obj14.onPress = callback2;
const obj15 = { variant: "text-md/semibold", color: "text-brand", children: null };
const intl3 = tmp2(tmp3[21]).intl;
obj15.children = intl3.string(tmp2(tmp3[21]).t.RDE0Sc);
obj14.children = tmp24(tmp2(tmp3[32]).Text, obj15);
tmp24Result = tmp24(tmp2(tmp3[30]).PressableOpacity, obj14);
}
items9[1] = tmp24Result;
obj12.children = items9;
const items10 = [closure_17(isUserSecureFramesVerified, obj12), , , ];
const obj16 = { spacing: 8, justify: "center", align: "center", direction: "vertical", children: null };
const obj17 = { variant: "heading-xl/bold", color: "mobile-text-heading-primary", children: null };
const intl4 = tmp2(tmp3[21]).intl;
obj17.children = intl4.string(userId(name[21]).t["/WPGnF"]);
const items11 = [closure_16(userId(name[32]).Text, obj17), ];
const obj18 = { style: tmp.subtitle, variant: "text-md/medium", color: "text-default", children: null };
const intl5 = tmp2(tmp3[21]).intl;
obj18.children = intl5.format(userId(name[21]).t.oc2kce, { username: name });
items11[1] = closure_16(userId(name[32]).Text, obj18);
obj16.children = items11;
items10[1] = closure_17(userId(name[33]).Stack, obj16);
const obj19 = { style: tmp.code, children: null };
const items12 = [closure_16(channelId(name[34]), { style: tmp.helpMessage, userId, userKey: fingerprintUserKey }), ];
const obj21 = { title: null, chunks: null, columns: null, trailing: null };
const obj20 = { style: tmp.helpMessage, userId, userKey: fingerprintUserKey };
const tmp17 = fingerprint(fingerprintUserKey.useMemo(() => {
const intl = util.intl;
const string = intl.string;
const t = util.t;
if (isUserSecureFramesVerified) {
const items = [string(t.UNUuem), native.BadgeColors.INFO];
let items1 = items;
} else {
items1 = [string(t.y2b7CA), native.BadgeColors.DANGER];
}
return items1;
}, items6), 2);
tmp25 = ANDROID_FOREGROUND_RIPPLE;
const intl6 = tmp2(tmp3[21]).intl;
obj21.title = intl6.string(userId(name[21]).t["/WPGnF"]);
obj21.chunks = readableSecureFramesFingerprint;
obj21.columns = columns;
if (null == readableSecureFramesFingerprint) {
let tmp24Result2 = tmp24(readableSecureFramesFingerprint, {});
} else {
const obj22 = { color: tmp19, text: tmp18 };
tmp24Result2 = tmp24(tmp2(tmp3[28]).TextBadge, obj22);
}
obj21.trailing = tmp24Result2;
items12[1] = closure_16(channelId(name[35]), obj21);
obj19.children = items12;
items10[2] = closure_17(isUserSecureFramesVerified, obj19);
const obj23 = { style: tmp.footer, children: null };
const items13 = [closure_16(userId(name[32]).Text, { style: tmp.footerText, variant: "text-xs/normal", color: "text-default", children: memo }), ];
let loading = null == readableSecureFramesFingerprint;
if (!loading) {
loading = isPersistentSecureFramesFingerprint.loading;
}
const obj25 = { disabled: loading, variant: "primary", onPress: null, text: null };
if (isUserSecureFramesVerified) {
callback = callback1;
}
obj25.onPress = callback;
const intl7 = tmp2(tmp3[21]).intl;
let string = intl7.string;
let t = tmp2(tmp3[21]).t;
if (isUserSecureFramesVerified) {
let stringResult = string(t["Osb+/n"]);
} else {
stringResult = string(t["0tvNAn"]);
}
obj25.text = stringResult;
items13[1] = closure_16(userId(name[36]).Button, obj25);
obj23.children = items13;
items10[3] = closure_17(isUserSecureFramesVerified, obj23);
rect.children = items10;
return closure_17(userId(name[29]).SafeAreaPaddingView, rect);
};