import {LogBox, Pressable, View} from 'react-native' import {useQueryClient} from '@tanstack/react-query' import {useModalControls} from '#/state/modals' import {useSessionApi} from '#/state/session' import {useLoggedOutViewControls} from '#/state/shell/logged-out' import {useOnboardingDispatch} from '#/state/shell/onboarding' import {navigate} from '../../../Navigation' LogBox.ignoreAllLogs() /** * This utility component is only included in the test simulator * build. It gives some quick triggers which help improve the pace * of the tests dramatically. */ const BTN = {height: 1, width: 1, backgroundColor: 'red'} export function TestCtrls() { const queryClient = useQueryClient() const {logoutEveryAccount, login} = useSessionApi() const {openModal} = useModalControls() const onboardingDispatch = useOnboardingDispatch() const {setShowLoggedOut} = useLoggedOutViewControls() const onPressSignInAlice = async () => { await login( { service: 'http://localhost:3000', identifier: 'alice.test', password: 'hunter2', }, 'LoginForm', ) setShowLoggedOut(false) } const onPressSignInBob = async () => { await login( { service: 'http://localhost:3000', identifier: 'bob.test', password: 'hunter2', }, 'LoginForm', ) setShowLoggedOut(false) } return ( logoutEveryAccount('Settings')} accessibilityRole="button" style={BTN} /> navigate('Home')} accessibilityRole="button" style={BTN} /> navigate('Settings')} accessibilityRole="button" style={BTN} /> navigate('Moderation')} accessibilityRole="button" style={BTN} /> navigate('Lists')} accessibilityRole="button" style={BTN} /> navigate('Feeds')} accessibilityRole="button" style={BTN} /> navigate('Debug')} accessibilityRole="button" style={BTN} /> queryClient.invalidateQueries({queryKey: ['post-feed']})} accessibilityRole="button" style={BTN} /> openModal({name: 'invite-codes'})} accessibilityRole="button" style={BTN} /> setShowLoggedOut(true)} accessibilityRole="button" style={BTN} /> { onboardingDispatch({type: 'start'}) }} accessibilityRole="button" style={BTN} /> {/* TODO remove this entire control when experiment is over */} { onboardingDispatch({type: 'start'}) }} accessibilityRole="button" style={BTN} /> ) }