diff --git a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
index f683c39c6..dcf2479df 100644
--- a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
+++ b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
@@ -5,6 +5,7 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useNavigation} from '@react-navigation/native'
+import {useOpenLink} from '#/lib/hooks/useOpenLink'
import {makeProfileLink} from '#/lib/routes/links'
import {type NavigationProp} from '#/lib/routes/types'
import {shareText, shareUrl} from '#/lib/sharing'
@@ -13,6 +14,7 @@ import {logger} from '#/logger'
import {isIOS} from '#/platform/detection'
import {useAgeAssurance} from '#/state/ageAssurance/useAgeAssurance'
import {useProfileShadow} from '#/state/cache/profile-shadow'
+import {useShowExternalShareButtons} from '#/state/preferences/external-share-buttons'
import {useSession} from '#/state/session'
import * as Toast from '#/view/com/util/Toast'
import {atoms as a} from '#/alf'
@@ -23,6 +25,7 @@ import {ArrowOutOfBoxModified_Stroke2_Corner2_Rounded as ArrowOutOfBoxIcon} from
import {ChainLink_Stroke2_Corner0_Rounded as ChainLinkIcon} from '#/components/icons/ChainLink'
import {Clipboard_Stroke2_Corner2_Rounded as ClipboardIcon} from '#/components/icons/Clipboard'
import {PaperPlane_Stroke2_Corner0_Rounded as PaperPlaneIcon} from '#/components/icons/PaperPlane'
+import {SquareArrowTopRight_Stroke2_Corner0_Rounded as ExternalIcon} from '#/components/icons/SquareArrowTopRight'
import * as Menu from '#/components/Menu'
import {useDevMode} from '#/storage/hooks/dev-mode'
import {RecentChats} from './RecentChats'
@@ -38,6 +41,7 @@ let ShareMenuItems = ({
const sendViaChatControl = useDialogControl()
const [devModeEnabled] = useDevMode()
const {isAgeRestricted} = useAgeAssurance()
+ const openLink = useOpenLink()
const postUri = post.uri
const postAuthor = useProfileShadow(post.author)
@@ -108,6 +112,18 @@ let ShareMenuItems = ({
shareText(postAuthor.did)
}
+ const showExternalShareButtons = useShowExternalShareButtons()
+ const isBridgyPost = !!post.record.bridgyOriginalUrl
+ const bridgyOriginalUrl = post.record.bridgyOriginalUrl as string | undefined
+
+ const onOpenOriginalPost = () => {
+ bridgyOriginalUrl && openLink(bridgyOriginalUrl, true)
+ }
+
+ const onOpenPostInPdsls = () => {
+ openLink(`https://pdsls.dev/${post.uri}`, true)
+ }
+
return (
<>
@@ -131,6 +147,32 @@ let ShareMenuItems = ({
)}
+ {showExternalShareButtons && (
+
+ {isBridgyPost && (
+
+
+ Open original post
+
+
+
+ )}
+
+
+
+ Open post in pdsls
+
+
+
+
+ )}
+
{
+ bridgyOriginalUrl && openLink(bridgyOriginalUrl, true)
+ }
+
+ const onOpenPostInPdsls = () => {
+ openLink(`https://pdsls.dev/${post.uri}`, true)
+ }
+
const copyLinkItem = (
{copyLinkItem}
+ {showExternalShareButtons && isBridgyPost && (
+
+
+ Open original post
+
+
+
+ )}
+
+ {showExternalShareButtons && (
+
+
+ Open post in pdsls
+
+
+
+ )}
+
{hasSession && !isAgeRestricted && (
+
+
+
+ Bridging and Fediverse
+
+ setShowExternalShareButtons(value)}
+ style={[a.w_full]}>
+
+
+ Show "Open original post" and "Open post in pdsls" buttons
+
+
+
+
+
+
diff --git a/src/state/persisted/schema.ts b/src/state/persisted/schema.ts
index 79e2d0185..79b5ce7b8 100644
--- a/src/state/persisted/schema.ts
+++ b/src/state/persisted/schema.ts
@@ -149,6 +149,8 @@ const schema = z.object({
.optional(),
highQualityImages: z.boolean().optional(),
+ showExternalShareButtons: z.boolean().optional(),
+
/** @deprecated */
mutedThreads: z.array(z.string()),
trendingDisabled: z.boolean().optional(),
@@ -240,6 +242,7 @@ export const defaults: Schema = {
],
},
highQualityImages: false,
+ showExternalShareButtons: false,
}
export function tryParse(rawData: string): Schema | undefined {
diff --git a/src/state/preferences/external-share-buttons.tsx b/src/state/preferences/external-share-buttons.tsx
new file mode 100644
index 000000000..4bb8718ff
--- /dev/null
+++ b/src/state/preferences/external-share-buttons.tsx
@@ -0,0 +1,54 @@
+import React from 'react'
+
+import * as persisted from '#/state/persisted'
+
+type StateContext = persisted.Schema['showExternalShareButtons']
+type SetContext = (v: persisted.Schema['showExternalShareButtons']) => void
+
+const stateContext = React.createContext(
+ persisted.defaults.showExternalShareButtons,
+)
+const setContext = React.createContext(
+ (_: persisted.Schema['showExternalShareButtons']) => {},
+)
+
+export function Provider({children}: React.PropsWithChildren<{}>) {
+ const [state, setState] = React.useState(
+ persisted.get('showExternalShareButtons'),
+ )
+
+ const setStateWrapped = React.useCallback(
+ (
+ showExternalShareButtons: persisted.Schema['showExternalShareButtons'],
+ ) => {
+ setState(showExternalShareButtons)
+ persisted.write('showExternalShareButtons', showExternalShareButtons)
+ },
+ [setState],
+ )
+
+ React.useEffect(() => {
+ return persisted.onUpdate(
+ 'showExternalShareButtons',
+ nextShowExternalShareButtons => {
+ setState(nextShowExternalShareButtons)
+ },
+ )
+ }, [setStateWrapped])
+
+ return (
+
+
+ {children}
+
+
+ )
+}
+
+export function useShowExternalShareButtons() {
+ return React.useContext(stateContext)
+}
+
+export function useSetShowExternalShareButtons() {
+ return React.useContext(setContext)
+}
diff --git a/src/state/preferences/index.tsx b/src/state/preferences/index.tsx
index 83fd5acd4..a4ab04eee 100644
--- a/src/state/preferences/index.tsx
+++ b/src/state/preferences/index.tsx
@@ -14,6 +14,7 @@ import {Provider as DisableRepostsMetricsProvider} from './disable-reposts-metri
import {Provider as DisableSavesMetricsProvider} from './disable-saves-metrics'
import {Provider as DisableViaRepostNotificationProvider} from './disable-via-repost-notification'
import {Provider as ExternalEmbedsProvider} from './external-embeds-prefs'
+import {Provider as ExternalShareButtonsProvider} from './external-share-buttons'
import {Provider as GoLinksProvider} from './go-links-enabled'
import {Provider as HiddenPostsProvider} from './hidden-posts'
import {Provider as HideFeedsPromoTabProvider} from './hide-feeds-promo-tab'
@@ -55,25 +56,26 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
return (
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -94,24 +96,25 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
-
+
+
-
+
+
)
--
2.51.2
From 1885a2f134f856af19c778bd67a1f88abe83db01 Mon Sep 17 00:00:00 2001
From: maelstrom
Date: Thu, 31 Jul 2025 00:38:19 +0200
Subject: [PATCH 2/3] feat: also support wafrn in new buttons
Source:
https://github.com/m-doescode/antlers-social/commit/55171d640e59a5424ec8865273562af01bcefd64
---
.../PostControls/ShareMenu/ShareMenuItems.tsx | 10 ++++++----
.../PostControls/ShareMenu/ShareMenuItems.web.tsx | 10 ++++++----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
index dcf2479df..5610708bc 100644
--- a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
+++ b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
@@ -113,11 +113,13 @@ let ShareMenuItems = ({
}
const showExternalShareButtons = useShowExternalShareButtons()
- const isBridgyPost = !!post.record.bridgyOriginalUrl
- const bridgyOriginalUrl = post.record.bridgyOriginalUrl as string | undefined
+ const isBridgedPost =
+ !!post.record.bridgyOriginalUrl || !!post.record.fediverseId
+ const originalPostUrl = (post.record.bridgyOriginalUrl ||
+ post.record.fediverseId) as string | undefined
const onOpenOriginalPost = () => {
- bridgyOriginalUrl && openLink(bridgyOriginalUrl, true)
+ originalPostUrl && openLink(originalPostUrl, true)
}
const onOpenPostInPdsls = () => {
@@ -149,7 +151,7 @@ let ShareMenuItems = ({
{showExternalShareButtons && (
- {isBridgyPost && (
+ {isBridgedPost && (
{
- bridgyOriginalUrl && openLink(bridgyOriginalUrl, true)
+ originalPostUrl && openLink(originalPostUrl, true)
}
const onOpenPostInPdsls = () => {
@@ -131,7 +133,7 @@ let ShareMenuItems = ({
{copyLinkItem}
- {showExternalShareButtons && isBridgyPost && (
+ {showExternalShareButtons && isBridgedPost && (
Date: Fri, 1 Aug 2025 21:23:08 +0200
Subject: [PATCH 3/3] fix: pdsls => PDSls
---
src/components/PostControls/ShareMenu/ShareMenuItems.tsx | 4 ++--
src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx | 4 ++--
src/screens/Settings/DeerSettings.tsx | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
index 5610708bc..7c7bbef17 100644
--- a/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
+++ b/src/components/PostControls/ShareMenu/ShareMenuItems.tsx
@@ -165,10 +165,10 @@ let ShareMenuItems = ({
- Open post in pdsls
+ Open post in PDSls
diff --git a/src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx b/src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx
index 5d27e8a44..dee4aa4ee 100644
--- a/src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx
+++ b/src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx
@@ -148,10 +148,10 @@ let ShareMenuItems = ({
{showExternalShareButtons && (
- Open post in pdsls
+ Open post in PDSls
diff --git a/src/screens/Settings/DeerSettings.tsx b/src/screens/Settings/DeerSettings.tsx
index cd0b26ea3..2bdc04683 100644
--- a/src/screens/Settings/DeerSettings.tsx
+++ b/src/screens/Settings/DeerSettings.tsx
@@ -370,14 +370,14 @@ export function DeerSettingsScreen({}: Props) {
setShowExternalShareButtons(value)}
style={[a.w_full]}>
- Show "Open original post" and "Open post in pdsls" buttons
+ Show "Open original post" and "Open post in PDSls" buttons