Feature gate this puppy
This commit is contained in:
@@ -13,6 +13,7 @@ export enum Features {
|
|||||||
ImageUploadsBlobSize2mbEnabled = 'image_uploads:blob_size_2mb:enabled',
|
ImageUploadsBlobSize2mbEnabled = 'image_uploads:blob_size_2mb:enabled',
|
||||||
GroupChatsEnable = 'group_chats:enable',
|
GroupChatsEnable = 'group_chats:enable',
|
||||||
DmsNewMessageComposerEnable = 'dms:new_message_composer:enable',
|
DmsNewMessageComposerEnable = 'dms:new_message_composer:enable',
|
||||||
|
PostGalleryEmbedEnable = 'post_gallery_embed:enable',
|
||||||
|
|
||||||
AATest = 'aa-test',
|
AATest = 'aa-test',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ import {useLightboxControls} from '#/state/lightbox'
|
|||||||
import {type Dimensions} from '#/view/com/lightbox/ImageViewing/@types'
|
import {type Dimensions} from '#/view/com/lightbox/ImageViewing/@types'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {AutoSizedImage} from '#/components/images/AutoSizedImage'
|
import {AutoSizedImage} from '#/components/images/AutoSizedImage'
|
||||||
|
import {Gallery} from '#/components/images/Gallery'
|
||||||
import {ImageLayoutGrid} from '#/components/images/ImageLayoutGrid'
|
import {ImageLayoutGrid} from '#/components/images/ImageLayoutGrid'
|
||||||
import {PostEmbedViewContext} from '#/components/Post/Embed/types'
|
import {PostEmbedViewContext} from '#/components/Post/Embed/types'
|
||||||
|
import {useAnalytics} from '#/analytics'
|
||||||
import {type EmbedType} from '#/types/bsky/post'
|
import {type EmbedType} from '#/types/bsky/post'
|
||||||
import {type CommonProps} from './types'
|
import {type CommonProps} from './types'
|
||||||
|
|
||||||
@@ -23,8 +25,10 @@ export function ImageEmbed({
|
|||||||
}: CommonProps & {
|
}: CommonProps & {
|
||||||
embed: EmbedType<'images'>
|
embed: EmbedType<'images'>
|
||||||
}) {
|
}) {
|
||||||
|
const ax = useAnalytics()
|
||||||
const {openLightbox} = useLightboxControls()
|
const {openLightbox} = useLightboxControls()
|
||||||
const {images} = embed.view
|
const {images} = embed.view
|
||||||
|
const galleryEnabled = ax.features.enabled(ax.features.PostGalleryEmbedEnable)
|
||||||
|
|
||||||
if (images.length > 0) {
|
if (images.length > 0) {
|
||||||
const items = images.map(img => ({
|
const items = images.map(img => ({
|
||||||
@@ -95,6 +99,19 @@ export function ImageEmbed({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (galleryEnabled) {
|
||||||
|
return (
|
||||||
|
<View style={[a.mt_sm, rest.style]}>
|
||||||
|
<Gallery
|
||||||
|
images={images}
|
||||||
|
onPress={onPress}
|
||||||
|
onPressIn={onPressIn}
|
||||||
|
viewContext={rest.viewContext}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.mt_sm, rest.style]}>
|
<View style={[a.mt_sm, rest.style]}>
|
||||||
<ImageLayoutGrid
|
<ImageLayoutGrid
|
||||||
|
|||||||
Reference in New Issue
Block a user