diff --git a/src/components/dms/MessageItemEmbed.tsx b/src/components/dms/MessageItemEmbed.tsx
index aefd62b9ac..3db00aece6 100644
--- a/src/components/dms/MessageItemEmbed.tsx
+++ b/src/components/dms/MessageItemEmbed.tsx
@@ -2,7 +2,7 @@ import React from 'react'
import {View} from 'react-native'
import {AppBskyEmbedRecord} from '@atproto/api'
-import {PostEmbeds} from '#/view/com/util/post-embeds'
+import {PostEmbeds, PostEmbedViewContext} from '#/view/com/util/post-embeds'
import {atoms as a, native, useTheme} from '#/alf'
let MessageItemEmbed = ({
@@ -14,7 +14,11 @@ let MessageItemEmbed = ({
return (
-
+
)
}
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index daf7addf22..8cd6e70be2 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -43,7 +43,7 @@ import {ErrorMessage} from '../util/error/ErrorMessage'
import {Link, TextLink} from '../util/Link'
import {formatCount} from '../util/numeric/format'
import {PostCtrls} from '../util/post-ctrls/PostCtrls'
-import {PostEmbeds} from '../util/post-embeds'
+import {PostEmbeds, PostEmbedViewContext} from '../util/post-embeds'
import {PostMeta} from '../util/PostMeta'
import {Text} from '../util/text/Text'
import {PreviewableUserAvatar} from '../util/UserAvatar'
@@ -366,7 +366,7 @@ let PostThreadItemLoaded = ({
)}
@@ -595,7 +595,11 @@ let PostThreadItemLoaded = ({
) : undefined}
{post.embed && (
-
+
)}
) : undefined}
{post.embed ? (
-
+
) : null}
) : null}
diff --git a/src/view/com/util/images/AutoSizedImage.tsx b/src/view/com/util/images/AutoSizedImage.tsx
index c047228d3e..be4b1490ab 100644
--- a/src/view/com/util/images/AutoSizedImage.tsx
+++ b/src/view/com/util/images/AutoSizedImage.tsx
@@ -55,11 +55,13 @@ export function useImageAspectRatio({
}
}
-export function SquareFramedImage({
+export function ConstrainedImage({
aspectRatio,
+ fullBleed,
children,
}: {
aspectRatio: number
+ fullBleed?: boolean
children: React.ReactNode
}) {
const t = useTheme()
@@ -82,7 +84,7 @@ export function SquareFramedImage({
a.rounded_sm,
a.overflow_hidden,
t.atoms.bg_contrast_25,
- {aspectRatio},
+ {aspectRatio: fullBleed ? 1 : aspectRatio},
]}>
{children}
@@ -94,13 +96,13 @@ export function SquareFramedImage({
export function AutoSizedImage({
image,
- disableCrop,
+ crop = 'constrained',
onPress,
onLongPress,
onPressIn,
}: {
image: AppBskyEmbedImages.ViewImage
- disableCrop?: boolean
+ crop?: 'none' | 'square' | 'constrained'
onPress?: () => void
onLongPress?: () => void
onPressIn?: () => void
@@ -116,7 +118,8 @@ export function AutoSizedImage({
src: image.thumb,
dimensions: image.aspectRatio,
})
- const isCropped = rawIsCropped && !disableCrop
+ const cropDisabled = crop === 'none'
+ const isCropped = rawIsCropped && !cropDisabled
const hasAlt = !!image.alt
const contents = (
@@ -169,7 +172,7 @@ export function AutoSizedImage({
>
)
- if (disableCrop) {
+ if (cropDisabled) {
return (
+
{contents}
-
+
)
}
}
diff --git a/src/view/com/util/post-embeds/QuoteEmbed.tsx b/src/view/com/util/post-embeds/QuoteEmbed.tsx
index c61cda68c1..2e012a2ed3 100644
--- a/src/view/com/util/post-embeds/QuoteEmbed.tsx
+++ b/src/view/com/util/post-embeds/QuoteEmbed.tsx
@@ -41,17 +41,20 @@ import {Link} from '../Link'
import {PostMeta} from '../PostMeta'
import {Text} from '../text/Text'
import {PostEmbeds} from '.'
+import {PostEmbedViewContext, QuoteEmbedViewContext} from './types'
export function MaybeQuoteEmbed({
embed,
onOpen,
style,
allowNestedQuotes,
+ viewContext,
}: {
embed: AppBskyEmbedRecord.View
onOpen?: () => void
style?: StyleProp
allowNestedQuotes?: boolean
+ viewContext?: QuoteEmbedViewContext
}) {
const pal = usePalette('default')
const {currentAccount} = useSession()
@@ -67,6 +70,7 @@ export function MaybeQuoteEmbed({
onOpen={onOpen}
style={style}
allowNestedQuotes={allowNestedQuotes}
+ viewContext={viewContext}
/>
)
} else if (AppBskyEmbedRecord.isViewBlocked(embed.record)) {
@@ -113,12 +117,14 @@ function QuoteEmbedModerated({
onOpen,
style,
allowNestedQuotes,
+ viewContext,
}: {
viewRecord: AppBskyEmbedRecord.ViewRecord
postRecord: AppBskyFeedPost.Record
onOpen?: () => void
style?: StyleProp
allowNestedQuotes?: boolean
+ viewContext?: QuoteEmbedViewContext
}) {
const moderationOpts = useModerationOpts()
const moderation = React.useMemo(() => {
@@ -144,6 +150,7 @@ function QuoteEmbedModerated({
onOpen={onOpen}
style={style}
allowNestedQuotes={allowNestedQuotes}
+ viewContext={viewContext}
/>
)
}
@@ -154,12 +161,14 @@ export function QuoteEmbed({
onOpen,
style,
allowNestedQuotes,
+ viewContext,
}: {
quote: ComposerOptsQuote
moderation?: ModerationDecision
onOpen?: () => void
style?: StyleProp
allowNestedQuotes?: boolean
+ viewContext?: QuoteEmbedViewContext
}) {
const queryClient = useQueryClient()
const pal = usePalette('default')
@@ -226,15 +235,40 @@ export function QuoteEmbed({
{moderation ? (
) : null}
- {richText ? (
-
- ) : null}
- {embed && }
+
+ {viewContext === QuoteEmbedViewContext.FeedEmbedRecordWithMedia ? (
+
+ {embed && (
+
+
+
+ )}
+ {richText ? (
+
+ ) : null}
+
+ ) : (
+ <>
+ {richText ? (
+
+ ) : null}
+ {embed && }
+ >
+ )}
)
diff --git a/src/view/com/util/post-embeds/index.tsx b/src/view/com/util/post-embeds/index.tsx
index 9f3506d888..1bca262390 100644
--- a/src/view/com/util/post-embeds/index.tsx
+++ b/src/view/com/util/post-embeds/index.tsx
@@ -32,8 +32,11 @@ import {AutoSizedImage} from '../images/AutoSizedImage'
import {ImageLayoutGrid} from '../images/ImageLayoutGrid'
import {ExternalLinkEmbed} from './ExternalLinkEmbed'
import {MaybeQuoteEmbed} from './QuoteEmbed'
+import {PostEmbedViewContext, QuoteEmbedViewContext} from './types'
import {VideoEmbed} from './VideoEmbed'
+export * from './types'
+
type Embed =
| AppBskyEmbedRecord.View
| AppBskyEmbedImages.View
@@ -55,7 +58,7 @@ export function PostEmbeds({
onOpen?: () => void
style?: StyleProp
allowNestedQuotes?: boolean
- viewContext?: 'thread-highlighted'
+ viewContext?: PostEmbedViewContext
}) {
const {openLightbox} = useLightboxControls()
@@ -70,7 +73,15 @@ export function PostEmbeds({
onOpen={onOpen}
viewContext={viewContext}
/>
-
+
)
}
@@ -129,7 +140,14 @@ export function PostEmbeds({
_openLightbox(0)}
onPressIn={() => onPressIn(0)}
diff --git a/src/view/com/util/post-embeds/types.ts b/src/view/com/util/post-embeds/types.ts
new file mode 100644
index 0000000000..08e9032768
--- /dev/null
+++ b/src/view/com/util/post-embeds/types.ts
@@ -0,0 +1,9 @@
+export enum PostEmbedViewContext {
+ ThreadHighlighted = 'ThreadHighlighted',
+ Feed = 'Feed',
+ FeedEmbedRecordWithMedia = 'FeedEmbedRecordWithMedia',
+}
+
+export enum QuoteEmbedViewContext {
+ FeedEmbedRecordWithMedia = PostEmbedViewContext.FeedEmbedRecordWithMedia,
+}