From 87a824429ce56e03d52b3aac5a1d526cdc2ad047 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 3 Jan 2023 13:14:10 -0600 Subject: [PATCH] Indicate images in notifications --- src/view/com/notifications/FeedItem.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index efb4d610..c578b712 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -1,6 +1,7 @@ import React, {useMemo} from 'react' import {observer} from 'mobx-react-lite' import {StyleSheet, View} from 'react-native' +import {AppBskyEmbedImages} from '@atproto/api' import {AtUri} from '../../../third-party/uri' import {FontAwesomeIcon, Props} from '@fortawesome/react-native-fontawesome' import {NotificationsViewItemModel} from '../../../state/models/notifications-view' @@ -227,9 +228,17 @@ function AdditionalPostText({ if (additionalPost.error) { return } - return ( - {additionalPost.thread?.postRecord.text} - ) + const record = additionalPost.thread?.postRecord + 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} } const styles = StyleSheet.create({