about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/PolicyUpdateOverlay/context.tsx4
-rw-r--r--src/env/common.ts2
-rw-r--r--src/lib/constants.ts6
-rw-r--r--src/view/com/testing/TestCtrls.e2e.tsx18
4 files changed, 24 insertions, 6 deletions
diff --git a/src/components/PolicyUpdateOverlay/context.tsx b/src/components/PolicyUpdateOverlay/context.tsx
index abb058d3c..3c65ae375 100644
--- a/src/components/PolicyUpdateOverlay/context.tsx
+++ b/src/components/PolicyUpdateOverlay/context.tsx
@@ -12,6 +12,7 @@ import {
   type PolicyUpdateState,
   usePolicyUpdateState,
 } from '#/components/PolicyUpdateOverlay/usePolicyUpdateState'
+import {ENV} from '#/env'
 
 const Context = createContext<{
   state: PolicyUpdateState
@@ -45,8 +46,7 @@ export function Provider({children}: {children?: ReactNode}) {
   const [isReadyToShowOverlay, setIsReadyToShowOverlay] = useState(false)
   const state = usePolicyUpdateState({
     // only enable the policy update overlay in non-test environments
-    enabled:
-      isReadyToShowOverlay && hasSession && process.env.NODE_ENV !== 'test',
+    enabled: isReadyToShowOverlay && hasSession && ENV !== 'e2e',
   })
 
   const ctx = useMemo(
diff --git a/src/env/common.ts b/src/env/common.ts
index 69451fd7e..7b64c35a6 100644
--- a/src/env/common.ts
+++ b/src/env/common.ts
@@ -11,7 +11,7 @@ export const RELEASE_VERSION: string =
   process.env.EXPO_PUBLIC_RELEASE_VERSION || packageJson.version
 
 /**
- * The env the app is running in e.g. development, testflight, production
+ * The env the app is running in e.g. development, testflight, production, e2e
  */
 export const ENV: string = process.env.EXPO_PUBLIC_ENV
 
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 727d4b052..b6b06ee7f 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -214,7 +214,11 @@ export const PUBLIC_STAGING_APPVIEW_DID = 'did:web:api.staging.bsky.dev'
 
 export const DEV_ENV_APPVIEW = `http://localhost:2584` // always the same
 
-export const BLUESKY_PROXY_HEADER: ProxyHeaderValue = `${BLUESKY_PROXY_DID}#bsky_appview`
+// temp hack for e2e - esb
+export let BLUESKY_PROXY_HEADER: ProxyHeaderValue = `${BLUESKY_PROXY_DID}#bsky_appview`
+export function setBlueskyProxyHeader(header: ProxyHeaderValue) {
+  BLUESKY_PROXY_HEADER = header
+}
 
 export const BLUESKY_SERVICE_HEADERS = {
   'atproto-proxy': BLUESKY_PROXY_HEADER,
diff --git a/src/view/com/testing/TestCtrls.e2e.tsx b/src/view/com/testing/TestCtrls.e2e.tsx
index 3273cf195..8e39e28c0 100644
--- a/src/view/com/testing/TestCtrls.e2e.tsx
+++ b/src/view/com/testing/TestCtrls.e2e.tsx
@@ -1,8 +1,10 @@
-import {LogBox, Pressable, View} from 'react-native'
+import {useState} from 'react'
+import {LogBox, Pressable, View, TextInput} from 'react-native'
 import {useQueryClient} from '@tanstack/react-query'
 
+import {setBlueskyProxyHeader} from '#/lib/constants'
 import {useModalControls} from '#/state/modals'
-import {useSessionApi} from '#/state/session'
+import {useSessionApi, useAgent} from '#/state/session'
 import {useLoggedOutViewControls} from '#/state/shell/logged-out'
 import {useOnboardingDispatch} from '#/state/shell/onboarding'
 import {navigate} from '../../../Navigation'
@@ -18,6 +20,7 @@ LogBox.ignoreAllLogs()
 const BTN = {height: 1, width: 1, backgroundColor: 'red'}
 
 export function TestCtrls() {
+  const agent = useAgent()
   const queryClient = useQueryClient()
   const {logoutEveryAccount, login} = useSessionApi()
   const {openModal} = useModalControls()
@@ -45,8 +48,19 @@ export function TestCtrls() {
     )
     setShowLoggedOut(false)
   }
+  const [proxyHeader, setProxyHeader] = useState('')
   return (
     <View style={{position: 'absolute', top: 100, right: 0, zIndex: 100}}>
+      <TextInput
+        testID="e2eProxyHeaderInput"
+        onChangeText={val => setProxyHeader(val as any)}
+        onSubmitEditing={() => {
+          const header = `${proxyHeader}#bsky_appview`
+          setBlueskyProxyHeader(header as any)
+          agent.configureProxy(header as any)
+        }}
+        style={BTN}
+      />
       <Pressable
         testID="e2eSignInAlice"
         onPress={onPressSignInAlice}