Indicate images in notifications

zio/stable
Paul Frazee 2023-01-03 13:14:10 -06:00
parent b9b0965000
commit 87a824429c
1 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import React, {useMemo} from 'react' import React, {useMemo} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {StyleSheet, View} from 'react-native' import {StyleSheet, View} from 'react-native'
import {AppBskyEmbedImages} from '@atproto/api'
import {AtUri} from '../../../third-party/uri' import {AtUri} from '../../../third-party/uri'
import {FontAwesomeIcon, Props} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon, Props} from '@fortawesome/react-native-fontawesome'
import {NotificationsViewItemModel} from '../../../state/models/notifications-view' import {NotificationsViewItemModel} from '../../../state/models/notifications-view'
@ -227,9 +228,17 @@ function AdditionalPostText({
if (additionalPost.error) { if (additionalPost.error) {
return <ErrorMessage message={additionalPost.error} /> return <ErrorMessage message={additionalPost.error} />
} }
return ( const record = additionalPost.thread?.postRecord
<Text style={pal.textLight}>{additionalPost.thread?.postRecord.text}</Text> let text = record.text
) if (
AppBskyEmbedImages.isMain(record.embed) &&
AppBskyEmbedImages.validateMain(record.embed).success
) {
for (let i = 0; i < record.embed.images.length; i++) {
text += ` [${record.embed.images[i].alt || `image${i + 1}`}]`
}
}
return <Text style={pal.textLight}>{text}</Text>
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({