Files
discord-decomp/sources/modules/parent_tools/native/FamilyCenterBannerButton.tsx
T
2026-07-28 01:06:53 +03:00

161 lines
9.4 KiB
TypeScript

/* Metro module 13393; source: modules/parent_tools/native/FamilyCenterBannerButton.tsx; dependencies: [31, 27, 5117, 661, 4661, 33, 8170, 1244, 2224, 5080, 13394, 1962, 683, 1471, 12620, 1581, 4662, 12642, 4501, 4578, 13395, 2] */
import AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import FamilyCenterMessages from '../FamilyCenter.messages.js'; /* Metro dependency 2224 */
import ModalActionCreators from '../../../actions/ModalActionCreators.tsx'; /* Metro dependency 5080 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as NativePermissionConstantsModule from '../../native_permissions/NativePermissionConstants.tsx'; /* Metro dependency 4661 */
import * as FamilyCenterConstantsModule from '../FamilyCenterConstants.tsx'; /* Metro dependency 5117 */
import * as UseUserLinksModule from '../hooks/useUserLinks.tsx'; /* Metro dependency 8170 */
import * as QrCodeIconModule from '../../../design/components/Icon/native/redesign/generated/QrCodeIcon.tsx'; /* Metro dependency 13395 */
function _fun101960(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101960, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13583:6, offset: 0x0222558e, size: 331 bytes, params: 8, frame: 20
const env0_0 = require;
const FamilyCenterBannerButton2 = FamilyCenterBannerButton;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
ReactModule;
const env0_9 = (CreateStylesModule).createStyles({button: {'height': 50,
'width': '100%', 'marginTop': 16}, art: {'width': 18, 'height': 18, 'marginRight': 6}});
(FileImportTrackerModule).fileFinishedImporting('modules/parent_tools/native/FamilyCenterBannerButton.tsx');
exports.default = FamilyCenterBannerButton2;
exports.FamilyCenterTeenQRCodeButton = FamilyCenterTeenQRCodeButton;
exports.FamilyCenterParentQRCodeButton = FamilyCenterParentQRCodeButton;
function FamilyCenterBannerButton({onPress, text, loading}) { // fn#101961, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13583:375, offset: 0x022256d9, size: 193 bytes, params: 2, frame: 23
const styles = useStyles();
const Button = (ButtonNativeModule).Button;
const QrCodeIcon = (QrCodeIconModule).QrCodeIcon;
return (
<View style={styles.button}>
<Button
grow
shrink
size="md"
variant="primary"
text={text}
onPress={onPress}
loading={loading}
icon={<QrCodeIcon
style={styles.art}
size="custom"
color="white"
/>}
iconPosition="start"
/>
</View>
);
}
function FamilyCenterTeenQRCodeButton() { // fn#101962, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13583:829, offset: 0x0222579a, size: 126 bytes, params: 1, frame: 17
const value2 = (UseUserLinksModule).useHasMaxConnections();
const intl = (IndexNativeModule).intl;
return (
value2
? null
: (
<FamilyCenterBannerButton
text={intl.string((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['8SLtqb'])}
onPress={function() {
importDefault(dependencyMap[9]).pushLazy(require(dependencyMap[11])(dependencyMap[10], dependencyMap.paths));
importDefault(dependencyMap[12]).track(AnalyticEvents.FAMILY_CENTER_ACTION,
{action: FamilyCenterAction.ShowQRCodeModal});
}}
/>
)
);
}
function FamilyCenterParentQRCodeButton() { // fn#101964, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13583:1154, offset: 0x02225891, size: 147 bytes, params: 1, frame: 19
const useHasMaxConnections = UseUserLinksModule.useHasMaxConnections;
if (Reflect.apply(useHasMaxConnections, UseUserLinksModule, [])) {
return null;
}
const intl = (IndexNativeModule).intl;
return (
<FamilyCenterBannerButton
text={intl.string((FamilyCenterMessages).z4a9HP)}
onPress={onPress_101966}
/>
);
function handleQrCodeScanSucess(a0) { // fn#101965, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13583:1269, owner: FamilyCenterParentQRCodeButton.handleQrCodeScanSucess, offset: 0x02225924, size: 198 bytes, params: 2, frame: 18
var r1;
var defaultImport3;
const value = environment.__proto__;
const value2 = undefined;
(ModalActionCreators).pop();
const value3 = (importDefault(1471) /* metro dependency 1471: URLUtils */).toURLSafe(a0);
const value4 = null;
let r0 = value4 != value3 ? value3 : {};
const hostname = r0.hostname;
const pathname = r0.pathname;
if (value4 != hostname) {
if (value4 != pathname) {
defaultImport3 = importDefault(1471) /* metro dependency 1471: URLUtils */;
if (defaultImport3.isDiscordHostname(hostname)) {
if (value4 === pathname.match(FAMILY_CENTER_LINK_REQUEST_REGEX)) {
r1 = value4;
} else {
(require(12620) /* metro dependency 12620: FamilyCenterNativeUtils */).handleFamilyCenterQRCodeScan(pathname,
'FamilyCenterQRCodeScan');
r1 = value2;
}
r0 = r1;
} else {
r0 = value4;
}
} else {
r0 = value4;
}
} else {
r0 = value4;
}
return r0;
}
function FamilyCenterParentQRCodeButtonOnPress() { // fn#101966, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13583:1601, owner: FamilyCenterParentQRCodeButton.onPress, offset: 0x022259ea, size: 161 bytes, params: 1, frame: 17
var environment;
let value = environment.__proto__;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const FAMILY_CENTER_ACTION = AnalyticEvents.FAMILY_CENTER_ACTION;
const ScanQRCodeButton = FamilyCenterAction.ScanQRCodeButton;
Reflect.apply(track, defaultImport, [FAMILY_CENTER_ACTION, {action: ScanQRCodeButton}]);
const r3 = (require(1581) /* metro dependency 1581: MetaQuestUtilsAndroid */).isMetaQuest() ? NativePermissionTypes.HEADSET_CAMERA : NativePermissionTypes.CAMERA;
value = importDefault(4662) /* metro dependency 4662: NativePermissionUtils */;
value = value.requestPermission(r3);
value.then(_fun101967);
function _fun101967(a0) { // fn#101967, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13583:1764, offset: 0x02225a8b, size: 102 bytes, params: 2, frame: 15
var value;
var defaultImport;
var pushLazy;
var value2;
if (a0) {
value = environment.__proto__.__proto__;
defaultImport = importDefault(dependencyMap[9]);
pushLazy = defaultImport.pushLazy;
value = require(dependencyMap[11]);
value = value(dependencyMap[17], dependencyMap.paths);
value2 = environment.__proto__;
Reflect.apply(pushLazy, defaultImport, [value, {showHelp: false, onScanSuccess: handleQrCodeScanSucess}]);
}
}
}
}
}
global.__d(_fun101960, 13393, [31, 27, 5117, 661, 4661, 33, 8170, 1244, 2224, 5080, 13394, 1962, 683, 1471, 12620,
1581, 4662, 12642, 4501, 4578, 13395,
2]) /* metro module 13393, dependencies: [31, 27, 5117, 661, 4661, 33, 8170, 1244, 2224, 5080, 13394, 1962, 683, 1471, 12620, 1581, 4662, 12642, 4501, 4578, 13395, 2] */;