diff options
author | dan <dan.abramov@gmail.com> | 2024-06-22 02:11:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-22 02:11:39 +0300 |
commit | 7db8dd8980c71e189315d89289196820db8b7875 (patch) | |
tree | 4728018a04bce1aa416263eff0f9c4a9d2483022 /src | |
parent | 707ea5bf062755d4fd3a9476a4457cdc9d4991b7 (diff) | |
download | voidsky-7db8dd8980c71e189315d89289196820db8b7875.tar.zst |
Add debug feedContext label (#4598)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/statsig/gates.ts | 1 | ||||
-rw-r--r-- | src/view/com/util/post-ctrls/PostCtrls.tsx | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts index 6e460dc60..46ef934ef 100644 --- a/src/lib/statsig/gates.ts +++ b/src/lib/statsig/gates.ts @@ -1,5 +1,6 @@ export type Gate = // Keep this alphabetic please. + | 'debug_show_feedcontext' | 'native_pwi_disabled' | 'request_notifications_permission_after_onboarding_v2' | 'show_avi_follow_button' diff --git a/src/view/com/util/post-ctrls/PostCtrls.tsx b/src/view/com/util/post-ctrls/PostCtrls.tsx index 472ce4043..231808bf2 100644 --- a/src/view/com/util/post-ctrls/PostCtrls.tsx +++ b/src/view/com/util/post-ctrls/PostCtrls.tsx @@ -6,6 +6,7 @@ import { View, type ViewStyle, } from 'react-native' +import * as Clipboard from 'expo-clipboard' import { AppBskyFeedDefs, AppBskyFeedPost, @@ -19,6 +20,7 @@ import {POST_CTRL_HITSLOP} from '#/lib/constants' import {useHaptics} from '#/lib/haptics' import {makeProfileLink} from '#/lib/routes/links' import {shareUrl} from '#/lib/sharing' +import {useGate} from '#/lib/statsig/statsig' import {toShareUrl} from '#/lib/strings/url-helpers' import {s} from '#/lib/styles' import {Shadow} from '#/state/cache/types' @@ -41,6 +43,7 @@ import * as Prompt from '#/components/Prompt' import {PostDropdownBtn} from '../forms/PostDropdownBtn' import {formatCount} from '../numeric/format' import {Text} from '../text/Text' +import * as Toast from '../Toast' import {RepostButton} from './RepostButton' let PostCtrls = ({ @@ -75,6 +78,7 @@ let PostCtrls = ({ const loggedOutWarningPromptControl = useDialogControl() const {sendInteraction} = useFeedFeedbackContext() const playHaptic = useHaptics() + const gate = useGate() const shouldShowLoggedOutWarning = React.useMemo(() => { return ( @@ -329,6 +333,31 @@ let PostCtrls = ({ timestamp={post.indexedAt} /> </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> ) } |