diff options
author | Hailey <me@haileyok.com> | 2024-11-12 11:18:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 11:18:53 -0800 |
commit | 427f3a8bd7f21f14aef32af2f7ccf1f4b2731c29 (patch) | |
tree | 4b365327a7438a5d24f880c6cc38bf1a9033fe0c /src/screens/Messages/components | |
parent | dd8d14e133f5f705a4056d95a76542aeea26db28 (diff) | |
download | voidsky-427f3a8bd7f21f14aef32af2f7ccf1f4b2731c29.tar.zst |
Add email verification prompts throughout the app (#6174)
Diffstat (limited to 'src/screens/Messages/components')
-rw-r--r-- | src/screens/Messages/components/MessageInput.tsx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/screens/Messages/components/MessageInput.tsx b/src/screens/Messages/components/MessageInput.tsx index 21d6e574e..8edad6272 100644 --- a/src/screens/Messages/components/MessageInput.tsx +++ b/src/screens/Messages/components/MessageInput.tsx @@ -18,6 +18,7 @@ import Graphemer from 'graphemer' import {HITSLOP_10, MAX_DM_GRAPHEME_LENGTH} from '#/lib/constants' import {useHaptics} from '#/lib/haptics' +import {useEmail} from '#/lib/hooks/useEmail' import {isIOS} from '#/platform/detection' import { useMessageDraft, @@ -61,10 +62,15 @@ export function MessageInput({ const [message, setMessage] = React.useState(getDraft) const inputRef = useAnimatedRef<TextInput>() + const {needsEmailVerification} = useEmail() + useSaveMessageDraft(message) useExtractEmbedFromFacets(message, setEmbed) const onSubmit = React.useCallback(() => { + if (needsEmailVerification) { + return + } if (!hasEmbed && message.trim() === '') { return } @@ -84,6 +90,7 @@ export function MessageInput({ inputRef.current?.focus() }, 100) }, [ + needsEmailVerification, hasEmbed, message, clearDraft, @@ -159,6 +166,7 @@ export function MessageInput({ ref={inputRef} hitSlop={HITSLOP_10} animatedProps={animatedProps} + editable={!needsEmailVerification} /> <Pressable accessibilityRole="button" @@ -171,7 +179,8 @@ export function MessageInput({ a.justify_center, {height: 30, width: 30, backgroundColor: t.palette.primary_500}, ]} - onPress={onSubmit}> + onPress={onSubmit} + disabled={needsEmailVerification}> <PaperPlane fill={t.palette.white} style={[a.relative, {left: 1}]} /> </Pressable> </View> |