Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

play haptics before closing modal (#4283)

authored by

Samuel Newman and committed by
GitHub
16925baf b077cbe3

+8 -12
-10
src/view/com/util/post-ctrls/PostCtrls.tsx
··· 23 23 import {s} from '#/lib/styles' 24 24 import {Shadow} from '#/state/cache/types' 25 25 import {useFeedFeedbackContext} from '#/state/feed-feedback' 26 - import {useModalControls} from '#/state/modals' 27 26 import { 28 27 usePostLikeMutationQueue, 29 28 usePostRepostMutationQueue, ··· 65 64 const t = useTheme() 66 65 const {_} = useLingui() 67 66 const {openComposer} = useComposerControls() 68 - const {closeModal} = useModalControls() 69 67 const [queueLike, queueUnlike] = usePostLikeMutationQueue(post, logContext) 70 68 const [queueRepost, queueUnrepost] = usePostRepostMutationQueue( 71 69 post, ··· 118 116 ]) 119 117 120 118 const onRepost = useCallback(async () => { 121 - closeModal() 122 119 try { 123 120 if (!post.viewer?.repost) { 124 - playHaptic() 125 121 sendInteraction({ 126 122 item: post.uri, 127 123 event: 'app.bsky.feed.defs#interactionRepost', ··· 137 133 } 138 134 } 139 135 }, [ 140 - closeModal, 141 136 post.uri, 142 137 post.viewer?.repost, 143 - playHaptic, 144 138 queueRepost, 145 139 queueUnrepost, 146 140 sendInteraction, ··· 148 142 ]) 149 143 150 144 const onQuote = useCallback(() => { 151 - closeModal() 152 145 sendInteraction({ 153 146 item: post.uri, 154 147 event: 'app.bsky.feed.defs#interactionQuote', ··· 163 156 indexedAt: post.indexedAt, 164 157 }, 165 158 }) 166 - playHaptic() 167 159 }, [ 168 - closeModal, 169 160 openComposer, 170 161 post.uri, 171 162 post.cid, 172 163 post.author, 173 164 post.indexedAt, 174 165 record.text, 175 - playHaptic, 176 166 sendInteraction, 177 167 feedContext, 178 168 ])
+8 -2
src/view/com/util/post-ctrls/RepostButton.tsx
··· 3 3 import {msg, plural} from '@lingui/macro' 4 4 import {useLingui} from '@lingui/react' 5 5 6 + import {useHaptics} from '#/lib/haptics' 6 7 import {useRequireAuth} from '#/state/session' 7 8 import {atoms as a, useTheme} from '#/alf' 8 9 import {Button, ButtonText} from '#/components/Button' ··· 30 31 const {_} = useLingui() 31 32 const requireAuth = useRequireAuth() 32 33 const dialogControl = Dialog.useDialogControl() 34 + const playHaptic = useHaptics() 33 35 34 36 const color = React.useMemo( 35 37 () => ({ ··· 89 91 : _(msg({message: `Repost`, context: 'action'})) 90 92 } 91 93 onPress={() => { 92 - dialogControl.close() 93 - onRepost() 94 + if (!isReposted) playHaptic() 95 + 96 + dialogControl.close(() => { 97 + onRepost() 98 + }) 94 99 }} 95 100 size="large" 96 101 variant="ghost" ··· 106 111 style={[a.justify_start, a.px_md]} 107 112 label={_(msg`Quote post`)} 108 113 onPress={() => { 114 + playHaptic() 109 115 dialogControl.close(() => { 110 116 onQuote() 111 117 })