1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Add haptics and analytics

This commit is contained in:
Zhiyuan Zheng
2020-12-30 14:33:33 +01:00
parent e765a8fd7c
commit 5473fcb770
27 changed files with 186 additions and 148 deletions

View File

@ -1,4 +1,5 @@
import { HeaderLeft, HeaderRight } from '@components/Header'
import haptics from '@root/components/haptics'
import { toast } from '@root/components/toast'
import { store } from '@root/store'
import layoutAnimation from '@root/utils/styles/layoutAnimation'
@ -114,19 +115,10 @@ const Compose: React.FC<Props> = ({ route: { params }, navigation }) => {
case 'reply':
const actualStatus =
params.incomingStatus.reblog || params.incomingStatus
const allMentions = actualStatus.mentions.map(
mention => `@${mention.acct}`
)
let replyPlaceholder = allMentions.join(' ')
if (replyPlaceholder.length === 0) {
replyPlaceholder = `@${actualStatus.account.acct} `
} else {
replyPlaceholder = replyPlaceholder + ' '
}
formatText({
textInput: 'text',
composeDispatch,
content: replyPlaceholder,
content: `@${actualStatus.account.acct} `,
disableDebounce: true
})
break
@ -195,11 +187,13 @@ const Compose: React.FC<Props> = ({ route: { params }, navigation }) => {
setIsSubmitting(true)
composeSend(params, composeState)
.then(() => {
haptics('Success')
queryClient.invalidateQueries(['Following'])
navigation.goBack()
toast({ type: 'success', content: '发布成功' })
})
.catch(() => {
haptics('Error')
setIsSubmitting(false)
Alert.alert('发布失败', '', [
{