From 2b38d5f0e0fe3d4b8b22b0a81a16a091144bc7b5 Mon Sep 17 00:00:00 2001 From: Hailey Date: Fri, 1 Aug 2025 11:34:52 -0700 Subject: [PATCH] cleanup, debug code --- package.json | 2 +- src/env/common.ts | 7 +++++++ .../Signup/StepCaptcha/CaptchaWebView.tsx | 16 +++++++++------- src/screens/Signup/index.tsx | 9 +++++++-- yarn.lock | 8 ++++---- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index cbd8d5437a..53526a49c8 100644 --- a/package.json +++ b/package.json @@ -186,7 +186,7 @@ "react-native": "^0.79.3", "react-native-compressor": "^1.11.0", "react-native-date-picker": "^5.0.12", - "react-native-device-attest": "^0.1.4", + "react-native-device-attest": "^0.1.5", "react-native-drawer-layout": "^4.1.8", "react-native-edge-to-edge": "^1.6.0", "react-native-gesture-handler": "2.25.0", diff --git a/src/env/common.ts b/src/env/common.ts index 5b902622bc..dd2df7b17a 100644 --- a/src/env/common.ts +++ b/src/env/common.ts @@ -78,3 +78,10 @@ export const SENTRY_DSN: string | undefined = process.env.EXPO_PUBLIC_SENTRY_DSN */ export const BITDRIFT_API_KEY: string | undefined = process.env.EXPO_PUBLIC_BITDRIFT_API_KEY + +/** + * GCP project ID which is required for device attestation + */ +export const GCP_PROJECT_ID: number = Number( + process.env.EXPO_PUBLIC_GCP_PROJECT_ID, +) diff --git a/src/screens/Signup/StepCaptcha/CaptchaWebView.tsx b/src/screens/Signup/StepCaptcha/CaptchaWebView.tsx index caa0aa28a4..5690676b0f 100644 --- a/src/screens/Signup/StepCaptcha/CaptchaWebView.tsx +++ b/src/screens/Signup/StepCaptcha/CaptchaWebView.tsx @@ -13,6 +13,7 @@ const ALLOWED_HOSTS = [ 'js.hcaptcha.com', 'newassets.hcaptcha.com', 'api2.hcaptcha.com', + 'e9755d3e012b.ngrok.app', ] export function CaptchaWebView({ @@ -29,12 +30,13 @@ export function CaptchaWebView({ onError: (error: unknown) => void }) { const redirectHost = React.useMemo(() => { - if (!state?.serviceUrl) return 'bsky.app' - - return state?.serviceUrl && - new URL(state?.serviceUrl).host === 'staging.bsky.dev' - ? 'staging.bsky.app' - : 'bsky.app' + return 'e9755d3e012b.ngrok.app' + // if (!state?.serviceUrl) return 'bsky.app' + // + // return state?.serviceUrl && + // new URL(state?.serviceUrl).host === 'staging.bsky.dev' + // ? 'staging.bsky.app' + // : 'bsky.app' }, [state?.serviceUrl]) const wasSuccessful = React.useRef(false) @@ -52,7 +54,7 @@ export function CaptchaWebView({ if (wasSuccessful.current) return const urlp = new URL(e.url) - if (urlp.host !== redirectHost) return + if (urlp.host !== redirectHost || urlp.pathname === '/gate/signup') return const code = urlp.searchParams.get('code') if (urlp.searchParams.get('state') !== stateParam || !code) { diff --git a/src/screens/Signup/index.tsx b/src/screens/Signup/index.tsx index 3ce08cfefb..5aebbc5231 100644 --- a/src/screens/Signup/index.tsx +++ b/src/screens/Signup/index.tsx @@ -28,8 +28,9 @@ import {Divider} from '#/components/Divider' import {LinearGradientBackground} from '#/components/LinearGradientBackground' import {InlineLinkText} from '#/components/Link' import {Text} from '#/components/Typography' -import {GCP_PROJECT_ID} from '#/env' import * as bsky from '#/types/bsky' +import {GCP_PROJECT_ID} from '#/env' +import {logger} from '#/logger' export function Signup({onPressBack}: {onPressBack: () => void}) { const {_} = useLingui() @@ -106,10 +107,14 @@ export function Signup({onPressBack}: {onPressBack: () => void}) { // On Android, warmup the Play Integrity API on the signup screen so it is ready by the time we get to the gate screen. useEffect(() => { + console.log('here...') if (!isAndroid) { return } - ReactNativeDeviceAttest.warumpIntegrity(GCP_PROJECT_ID) + console.log('TRYING TO WARMUP') + ReactNativeDeviceAttest.warmupIntegrity(GCP_PROJECT_ID).catch(err => + logger.error(err), + ) }, []) return ( diff --git a/yarn.lock b/yarn.lock index cfb327c48a..5d4c92d60b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16787,10 +16787,10 @@ react-native-date-picker@^5.0.12: resolved "https://registry.yarnpkg.com/react-native-date-picker/-/react-native-date-picker-5.0.12.tgz#12540b6a58500811ee7e4fc0244e3accc7cca9c1" integrity sha512-R/mUnCKhcuxbhKPFwYdBQCxQt9HHLqpM4ruRUqlcBjiUZ3N2wdnwOMyc888Ps8qp8e7v29PrDHtUlG8LPuFn9w== -react-native-device-attest@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/react-native-device-attest/-/react-native-device-attest-0.1.4.tgz#221860443765422f6dfebf4d868f367cda2a61b1" - integrity sha512-jFogWXXl3NBEAA3U+f1NQwdeIysCu6bGEmMGzz6gw4uipe6ELxZmovx64cJJHessZs1gjYDaUcbXGncirwykYg== +react-native-device-attest@^0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/react-native-device-attest/-/react-native-device-attest-0.1.5.tgz#437cb0ff955d7457f7e27cb41bfd8be89481b965" + integrity sha512-TNmsN00vUqmPB1rw1HlnefCwC7Sc4IYPkEwPjM0CRtHKnxS/mSfr3E+Swch9jRQlwoWPfSHNSvXB3w4aP0Rzfw== react-native-dotenv@^3.4.11: version "3.4.11"