decord/source/components_native/QRScannerModal.tsx

157 lines
6.5 KiB
TypeScript
Raw Normal View History

// Module ID: 13956
// Function ID: 13957
// Name: QRScannerModal
// Dependencies: [32, 19, 17, 1074, 7641, 21, 1363, 13957, 576, 7141, 1611, 1365, 13937, 4839, 13952, 1896, 7485, 12044, 4331, 4981, 1114, 9179, 7192, 1176, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 13956 (QRScannerModal)
import nativeDefault from "native" /* 576 */;
import util from "util" /* 1114 */;
import URLUtilsDefault from "URLUtils" /* 1365 */;
import useSafeAreaInsetsDefault from "useSafeAreaInsets" /* 1611 */;
import ModalActionCreatorsDefault from "ModalActionCreators" /* 4839 */;
import actions_AlertActionCreatorsDefault from "actions/AlertActionCreators" /* 4981 */;
import _modDef7192 from "module_7192" /* 7192 */;
import TouchableHitBoxDefault from "TouchableHitBox" /* 9179 */;
import QRLoginUtils from "QRLoginUtils" /* 13937 */;
import QRScannerNativeComponentDefault from "QRScannerNativeComponent" /* 13957 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function DCDQRScanner(arg0) {
const merged = Object.assign(arg0);
return React6(importDefaultResult, {});
2026-07-20 16:05:17 +00:00
}
get_ActivityIndicator = fn(17);
({ View: hasOwnProperty, requireNativeComponent } = get_ActivityIndicator);
const UserSettingsSections = fn(1074).UserSettingsSections;
let closure_7 = fn(7641).FAMILY_CENTER_LINK_REQUEST_REGEX;
const jsxProd = fn(21);
({ jsx: closure_8, jsxs: closure_9 } = jsxProd);
const PlatformUtils = fn(1363);
if (PlatformUtils.isAndroid()) {
let importDefaultResult = QRScannerNativeComponentDefault;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
importDefaultResult = requireNativeComponent("DCDQRScanner");
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let c10 = importDefaultResult;
let obj2 = { scanner: { position: "absolute", height: "100%", width: "100%" }, closeButton: { marginLeft: 8 }, emptyView: { backgroundColor: nativeDefault.unsafe_rawColors.BLACK }, showHelp: null, text: null };
let obj3 = { backgroundColor: nativeDefault.unsafe_rawColors.BLACK };
obj2.showHelp = { marginLeft: 16, marginRight: 16, marginTop: "auto", borderRadius: 16, backgroundColor: nativeDefault.unsafe_rawColors.BRAND_500, paddingTop: 4, paddingBottom: 4, paddingLeft: 16, paddingRight: 16 };
let obj4 = { marginLeft: 16, marginRight: 16, marginTop: "auto", borderRadius: 16, backgroundColor: nativeDefault.unsafe_rawColors.BRAND_500, paddingTop: 4, paddingBottom: 4, paddingLeft: 16, paddingRight: 16 };
obj2.text = { color: nativeDefault.unsafe_rawColors.WHITE, textAlign: "center" };
2026-07-29 08:29:29 +00:00
let closure_13 = { SUCCEEDED: "SUCCEEDED", FAILED: "FAILED" };
const size = fn(2);
let result = size.fileFinishedImporting("components_native/QRScannerModal.tsx");
2026-07-20 16:05:17 +00:00
export default function QRScannerModal(showHelp) {
showHelp = showHelp.showHelp;
2026-07-23 10:11:24 +00:00
const onScanSuccess = showHelp.onScanSuccess;
[tmp3, importDefault] = noop.useState(true);
const effect = noop.useEffect(() => {
closure_0 = onScanSuccess(dependencyMap[9]).runAfterInteractions(() => {
closure_1_1(false);
2026-07-20 16:05:17 +00:00
});
return () => {
closure_0.cancel();
};
}, []);
2026-07-29 08:29:29 +00:00
const tmp = undefined !== showHelp && showHelp;
const tmp2 = _slicedToArray(noop.useState(true), 2);
2026-07-29 08:29:29 +00:00
let obj = { style: { flex: 1 }, children: null };
2026-08-24 06:08:38 +00:00
({ bottom, top } = useSafeAreaInsetsDefault());
2026-07-29 08:29:29 +00:00
if (tmp3) {
obj2 = { style: null };
2026-07-29 08:29:29 +00:00
const items = [, ];
({ scanner: arr[0], emptyView: arr[1] } = obj2);
obj2.style = items;
let tmp10Result = tmp10(tmp9, obj2);
let tmp12 = obj2;
2026-07-29 08:29:29 +00:00
let tmp14 = tmp10;
2026-07-20 16:05:17 +00:00
} else {
let obj3 = { style: null, pointerEvents: "none", onQRCodeFound: null };
tmp12 = obj2;
obj3.style = obj2.scanner;
obj3.onQRCodeFound = function onQRCodeFound(nativeEvent) {
if (constants.SUCCEEDED === nativeEvent.nativeEvent.status) {
2026-07-29 08:29:29 +00:00
if (undefined !== onScanSuccess) {
tmp2(nativeEvent.nativeEvent.result);
} else {
let url = URLUtilsDefault.toURLSafe(nativeEvent.nativeEvent.result);
2026-07-29 08:29:29 +00:00
if (url == null) {
url = {};
}
const result = QRLoginUtils.findRemoteAuthFingerprint(url.hostname, str);
2026-07-29 08:29:29 +00:00
if (null != result) {
tmp21(4839).pop();
const tmp21Result = tmp21(4839);
obj2 = { remoteAuthFingerprint: result };
tmp21(4839).pushLazy(tmp3(1896)(13952, tmp22.paths), obj2);
2026-07-29 08:29:29 +00:00
} else {
let match;
if (str != null) {
match = str.match(closure_7);
2026-07-29 08:29:29 +00:00
}
if (null != match) {
if (null != str) {
tmp21(4839).pop();
const tmp21Result5 = tmp21(4839);
const obj3 = { screen: UserSettingsSections.FAMILY_CENTER };
tmp3(7485).openUserSettings(obj3);
const tmp3Result = tmp3(7485);
const result1 = tmp3(12044).handleFamilyCenterQRCodeScan(str, "UserSettingsQRCodeScan");
2026-07-20 16:05:17 +00:00
}
}
tmp21(4331).openURL(nativeEvent.nativeEvent.result, undefined, false);
2026-07-29 08:29:29 +00:00
let tmp9 = tmp21;
const tmp21Result6 = tmp21(4331);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
} else {
const FAILED = tmp.FAILED;
const obj4 = { body: null, title: null };
const intl = util.intl;
obj4.body = intl.string(util.t.QOQlWa);
const intl2 = util.intl;
obj4.title = intl2.string(util.t["6S318H"]);
actions_AlertActionCreatorsDefault.show(obj4);
tmp9 = importDefault;
2026-07-29 08:29:29 +00:00
}
tmp9(4839).pop();
2026-07-20 16:05:17 +00:00
};
tmp10Result = tmp10(DCDQRScanner, obj3);
2026-07-29 08:29:29 +00:00
tmp14 = tmp10;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const items1 = [tmp10Result, , ];
let obj4 = { accessibilityRole: "button", accessibilityLabel: null, source: null, style: null, onPress: null };
2026-08-24 06:08:38 +00:00
const tmp7 = useSafeAreaInsetsDefault();
const tmp8 = closure_9;
let intl = onScanSuccess(1114).intl;
obj4.accessibilityLabel = intl.string(onScanSuccess(1114).t.cpT0Cq);
obj4.source = _modDef7192;
2026-07-29 08:29:29 +00:00
const items2 = [tmp12.closeButton, { marginTop: top }];
obj4.style = items2;
obj4.onPress = ModalActionCreatorsDefault.pop;
items1[1] = tmp14(TouchableHitBoxDefault, obj4);
2026-07-29 08:29:29 +00:00
let tmp14Result = null;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-29 08:29:29 +00:00
tmp14Result = null;
if (!tmp3) {
const obj5 = { style: null, children: null };
2026-07-29 08:29:29 +00:00
const items3 = [tmp12.showHelp, ];
const obj6 = { marginBottom: bottom + 8 };
items3[1] = obj6;
obj5.style = items3;
const obj7 = { style: tmp12.text, children: null };
let intl2 = tmp17(1114).intl;
obj7.children = intl2.string(tmp17(1114).t.dklV0G);
obj5.children = tmp14(tmp17(1176).LegacyText, obj7);
tmp14Result = tmp14(tmp9, obj5);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
items1[2] = tmp14Result;
obj.children = items1;
2026-07-29 08:29:29 +00:00
return tmp8(closure_5, obj);
2026-07-20 16:05:17 +00:00
};