Add debug feedContext label (#4598)

zio/stable
dan 2024-06-22 02:11:39 +03:00 committed by GitHub
parent 707ea5bf06
commit 7db8dd8980
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 0 deletions

View File

@ -1,5 +1,6 @@
export type Gate = export type Gate =
// Keep this alphabetic please. // Keep this alphabetic please.
| 'debug_show_feedcontext'
| 'native_pwi_disabled' | 'native_pwi_disabled'
| 'request_notifications_permission_after_onboarding_v2' | 'request_notifications_permission_after_onboarding_v2'
| 'show_avi_follow_button' | 'show_avi_follow_button'

View File

@ -6,6 +6,7 @@ import {
View, View,
type ViewStyle, type ViewStyle,
} from 'react-native' } from 'react-native'
import * as Clipboard from 'expo-clipboard'
import { import {
AppBskyFeedDefs, AppBskyFeedDefs,
AppBskyFeedPost, AppBskyFeedPost,
@ -19,6 +20,7 @@ import {POST_CTRL_HITSLOP} from '#/lib/constants'
import {useHaptics} from '#/lib/haptics' import {useHaptics} from '#/lib/haptics'
import {makeProfileLink} from '#/lib/routes/links' import {makeProfileLink} from '#/lib/routes/links'
import {shareUrl} from '#/lib/sharing' import {shareUrl} from '#/lib/sharing'
import {useGate} from '#/lib/statsig/statsig'
import {toShareUrl} from '#/lib/strings/url-helpers' import {toShareUrl} from '#/lib/strings/url-helpers'
import {s} from '#/lib/styles' import {s} from '#/lib/styles'
import {Shadow} from '#/state/cache/types' import {Shadow} from '#/state/cache/types'
@ -41,6 +43,7 @@ import * as Prompt from '#/components/Prompt'
import {PostDropdownBtn} from '../forms/PostDropdownBtn' import {PostDropdownBtn} from '../forms/PostDropdownBtn'
import {formatCount} from '../numeric/format' import {formatCount} from '../numeric/format'
import {Text} from '../text/Text' import {Text} from '../text/Text'
import * as Toast from '../Toast'
import {RepostButton} from './RepostButton' import {RepostButton} from './RepostButton'
let PostCtrls = ({ let PostCtrls = ({
@ -75,6 +78,7 @@ let PostCtrls = ({
const loggedOutWarningPromptControl = useDialogControl() const loggedOutWarningPromptControl = useDialogControl()
const {sendInteraction} = useFeedFeedbackContext() const {sendInteraction} = useFeedFeedbackContext()
const playHaptic = useHaptics() const playHaptic = useHaptics()
const gate = useGate()
const shouldShowLoggedOutWarning = React.useMemo(() => { const shouldShowLoggedOutWarning = React.useMemo(() => {
return ( return (
@ -329,6 +333,31 @@ let PostCtrls = ({
timestamp={post.indexedAt} timestamp={post.indexedAt}
/> />
</View> </View>
{gate('debug_show_feedcontext') && feedContext && (
<Pressable
accessible={false}
style={{
position: 'absolute',
top: 0,
bottom: 0,
right: 0,
display: 'flex',
justifyContent: 'center',
}}
onPress={e => {
e.stopPropagation()
Clipboard.setStringAsync(feedContext)
Toast.show(_(msg`Copied to clipboard`))
}}>
<Text
style={{
color: t.palette.contrast_400,
fontSize: 7,
}}>
{feedContext}
</Text>
</Pressable>
)}
</View> </View>
) )
} }