Skip to content

Commit 754e555

Browse files
committed
Refactor DeveloperOptions component to add authentication token input
1 parent 95f2aac commit 754e555

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

src/screens/DeveloperOptions/DeveloperOptions.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
import authStore from '@/zustand/authStore'
12
import { devOptStore } from '@/zustand/devOptStore'
2-
import { CleanSolidIcon, CodeSolidIcon, ComputerSolidIcon, Timer02SolidIcon } from '@assets/icons/icons'
3+
import {
4+
CleanSolidIcon,
5+
CodeSolidIcon,
6+
ComputerSolidIcon,
7+
LockPasswordSolidIcon,
8+
Timer02SolidIcon,
9+
} from '@assets/icons/icons'
310
import { Gap12 } from '@components/Gap'
411
import { Input } from '@components/Input'
512
import RoundedIcon from '@components/RoundedIcon'
@@ -20,6 +27,7 @@ export default function DeveloperOptions({ navigation }: NavProp) {
2027
const clearDevOptions = devOptStore((state) => state.clearDevOptions)
2128
const isFabEnabled = devOptStore((state) => state.isFabEnabled)
2229
const setFabEnabled = devOptStore((state) => state.setFabEnabled)
30+
const { token, setToken } = authStore((state) => ({ token: state.token, setToken: state.setToken }))
2331

2432
const setAnim = useCallback((duration: string) => {
2533
let dur = parseInt(duration, 10)
@@ -110,6 +118,19 @@ export default function DeveloperOptions({ navigation }: NavProp) {
110118
Reset to default.
111119
</Text>
112120
</SettText>
121+
<SettGroup title='Auth Token'>
122+
<Input
123+
Icon={<RoundedIcon Icon={LockPasswordSolidIcon} className='bg-gray-500' />}
124+
placeholder='Enter auth token'
125+
onChangeText={setToken}
126+
defaultValue={token}
127+
keyboardType='default'
128+
multiline
129+
/>
130+
</SettGroup>
131+
<SettText>
132+
This will set the auth token for the app. You may need to restart the app for the changes to take effect.
133+
</SettText>
113134
</Gap12>
114135
</>
115136
) : (

src/screens/DeveloperOptions/MMKVDataEditor.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import { Gap12 } from '@components/Gap'
55
import { Input } from '@components/Input'
66
import RoundedIcon from '@components/RoundedIcon'
77
import { SettGroup, SettOption, SettText, SettWrapper } from '@components/Settings'
8-
import { Txt, TxtAcc } from '@components/Text'
8+
import { TxtAcc } from '@components/Text'
99
import type { RouteProp } from '@react-navigation/native'
1010
import { Colors } from '@utils/colors'
11-
import { Medium } from '@utils/fonts'
1211
import S, { ls, type StorageKeys } from '@utils/storage'
1312
import type { StackNav } from '@utils/types'
1413
import { toReadableSize } from '@utils/utils'

src/screens/DeveloperOptions/MMKVDataList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function MMKVDataList({ navigation }: NavProp) {
2222
const [searchResults, setSearchResults] = React.useState<string[]>([])
2323

2424
useEffect(() => {
25-
if (state) screenDelay(() => setInitStorage([...ls.getAllKeys(), ...secureLs.getAllKeys()]), 700)
25+
if (state) screenDelay(() => setInitStorage(ls.getAllKeys()), 700)
2626
// setInitStorage([])
2727
}, [state])
2828

0 commit comments

Comments
 (0)