Handle invalid service URLs (#3908)

This commit is contained in:
Eric Bailey 2024-05-07 21:09:02 -05:00 committed by GitHub
parent 165fdb7049
commit 31a8356aef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View file

@ -47,6 +47,7 @@ export function MessagesScreen({navigation}: Props) {
// TEMP
const {serviceUrl, setServiceUrl} = useDmServiceUrlStorage()
const [serviceUrlValue, setServiceUrlValue] = useState(serviceUrl)
const hasValidServiceUrl = useMemo(() => {
const hash = sha256(serviceUrl)
return (
@ -136,13 +137,21 @@ export function MessagesScreen({navigation}: Props) {
<TextField.LabelText>Service URL</TextField.LabelText>
<TextField.Root>
<TextField.Input
value={serviceUrl}
onChangeText={text => setServiceUrl(text)}
value={serviceUrlValue}
onChangeText={text => setServiceUrlValue(text)}
autoCapitalize="none"
keyboardType="url"
label="https://"
/>
</TextField.Root>
<Button
label="Set Service URL"
size="small"
variant="solid"
color="primary"
onPress={() => setServiceUrl(serviceUrlValue)}>
<ButtonText>Set</ButtonText>
</Button>
</View>
</ScrollView>
)