From 62ed6edcce2af1b64c27fa3d27087c1f4fc1a3a0 Mon Sep 17 00:00:00 2001 From: Hailey Date: Wed, 30 Jul 2025 09:23:16 -0700 Subject: [PATCH] a few starting changes --- package.json | 1 + src/env.ts | 2 ++ src/screens/Signup/StepCaptcha/index.tsx | 5 ++++- src/screens/Signup/index.tsx | 11 +++++++++++ yarn.lock | 5 +++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 77908a1615..9dcfae4d87 100644 --- a/package.json +++ b/package.json @@ -186,6 +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.1", "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.ts b/src/env.ts index 32ce70670b..8027cd2a06 100644 --- a/src/env.ts +++ b/src/env.ts @@ -4,3 +4,5 @@ export const LOG_LEVEL = (process.env.EXPO_PUBLIC_LOG_LEVEL || 'info') as | 'info' | 'warn' | 'error' + +export const GCP_PROJECT_ID = Number(process.env.EXPO_PUBLIC_GCP_PROJECT_ID) diff --git a/src/screens/Signup/StepCaptcha/index.tsx b/src/screens/Signup/StepCaptcha/index.tsx index 388deecaff..c5d1a60e26 100644 --- a/src/screens/Signup/StepCaptcha/index.tsx +++ b/src/screens/Signup/StepCaptcha/index.tsx @@ -6,6 +6,7 @@ import {nanoid} from 'nanoid/non-secure' import {createFullHandle} from '#/lib/strings/handles' import {logger} from '#/logger' +import {isWeb} from '#/platform/detection' import {ScreenTransition} from '#/screens/Login/ScreenTransition' import {useSignupContext} from '#/screens/Signup/state' import {CaptchaWebView} from '#/screens/Signup/StepCaptcha/CaptchaWebView' @@ -13,7 +14,9 @@ import {atoms as a, useTheme} from '#/alf' import {FormError} from '#/components/forms/FormError' import {BackNextButtons} from '../BackNextButtons' -const CAPTCHA_PATH = '/gate/signup' +const CAPTCHA_PATH = isWeb ? '/gate/signup' : '/gate/signup/attempt-attest' + +type export function StepCaptcha() { const {_} = useLingui() diff --git a/src/screens/Signup/index.tsx b/src/screens/Signup/index.tsx index 03f4e2cdd2..3ce08cfefb 100644 --- a/src/screens/Signup/index.tsx +++ b/src/screens/Signup/index.tsx @@ -1,11 +1,13 @@ import {useEffect, useReducer, useState} from 'react' import {AppState, type AppStateStatus, View} from 'react-native' +import ReactNativeDeviceAttest from 'react-native-device-attest' import Animated, {FadeIn, LayoutAnimationConfig} from 'react-native-reanimated' import {AppBskyGraphStarterpack} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {FEEDBACK_FORM_URL} from '#/lib/constants' +import {isAndroid} from '#/platform/detection' import {useServiceQuery} from '#/state/queries/service' import {useStarterPackQuery} from '#/state/queries/starter-packs' import {useActiveStarterPack} from '#/state/shell/starter-pack' @@ -26,6 +28,7 @@ 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' export function Signup({onPressBack}: {onPressBack: () => void}) { @@ -101,6 +104,14 @@ export function Signup({onPressBack}: {onPressBack: () => void}) { return () => subscription.remove() }, []) + // 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(() => { + if (!isAndroid) { + return + } + ReactNativeDeviceAttest.warumpIntegrity(GCP_PROJECT_ID) + }, []) + return (