mirror of https://github.com/tooot-app/app
Fix crashes
This commit is contained in:
parent
bd49caa52a
commit
60f0a838cc
File diff suppressed because one or more lines are too long
|
@ -72,7 +72,7 @@ const Timeline: React.FC<Props> = ({
|
|||
})
|
||||
|
||||
const flattenData = data?.pages
|
||||
? data.pages.flatMap(page => [...page.body])
|
||||
? data.pages?.flatMap(page => [...page.body])
|
||||
: []
|
||||
|
||||
const ItemSeparatorComponent = useCallback(
|
||||
|
|
|
@ -108,10 +108,10 @@ const TimelineAttachment = React.memo(
|
|||
)
|
||||
default:
|
||||
if (
|
||||
attachment.preview_url.endsWith('.jpg') ||
|
||||
attachment.preview_url.endsWith('.jpeg') ||
|
||||
attachment.preview_url.endsWith('.png') ||
|
||||
attachment.preview_url.endsWith('.gif') ||
|
||||
attachment.preview_url?.endsWith('.jpg') ||
|
||||
attachment.preview_url?.endsWith('.jpeg') ||
|
||||
attachment.preview_url?.endsWith('.png') ||
|
||||
attachment.preview_url?.endsWith('.gif') ||
|
||||
attachment.remote_url?.endsWith('.jpg') ||
|
||||
attachment.remote_url?.endsWith('.jpeg') ||
|
||||
attachment.remote_url?.endsWith('.png') ||
|
||||
|
|
|
@ -333,7 +333,7 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
|
|||
]
|
||||
)
|
||||
} else {
|
||||
Sentry.Native.captureException(error)
|
||||
Sentry.Native.captureMessage('Compose posting', error)
|
||||
haptics('Error')
|
||||
composeDispatch({ type: 'posting', payload: false })
|
||||
Alert.alert(t('heading.right.alert.default.title'), undefined, [
|
||||
|
|
|
@ -42,34 +42,38 @@ const ComposeEditAttachmentSubmit: React.FC<Props> = ({ index }) => {
|
|||
) {
|
||||
formData.append(
|
||||
'focus',
|
||||
`${theAttachment.meta?.focus?.x || 0},${-theAttachment.meta?.focus
|
||||
?.y || 0}`
|
||||
`${theAttachment.meta?.focus?.x || 0},${
|
||||
-theAttachment.meta?.focus?.y || 0
|
||||
}`
|
||||
)
|
||||
}
|
||||
|
||||
apiInstance<Mastodon.Attachment>({
|
||||
method: 'put',
|
||||
url: `media/${theAttachment.id}`,
|
||||
body: formData
|
||||
})
|
||||
.then(() => {
|
||||
haptics('Success')
|
||||
navigation.goBack()
|
||||
})
|
||||
.catch(() => {
|
||||
setIsSubmitting(false)
|
||||
haptics('Error')
|
||||
Alert.alert(
|
||||
t('content.editAttachment.header.right.failed.title'),
|
||||
undefined,
|
||||
[
|
||||
{
|
||||
text: t('content.editAttachment.header.right.failed.button'),
|
||||
style: 'cancel'
|
||||
}
|
||||
]
|
||||
)
|
||||
theAttachment?.id &&
|
||||
apiInstance<Mastodon.Attachment>({
|
||||
method: 'put',
|
||||
url: `media/${theAttachment.id}`,
|
||||
body: formData
|
||||
})
|
||||
.then(() => {
|
||||
haptics('Success')
|
||||
navigation.goBack()
|
||||
})
|
||||
.catch(() => {
|
||||
setIsSubmitting(false)
|
||||
haptics('Error')
|
||||
Alert.alert(
|
||||
t('content.editAttachment.header.right.failed.title'),
|
||||
undefined,
|
||||
[
|
||||
{
|
||||
text: t(
|
||||
'content.editAttachment.header.right.failed.button'
|
||||
),
|
||||
style: 'cancel'
|
||||
}
|
||||
]
|
||||
)
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue