+10
src/lib/strings/url-helpers.ts
+10
src/lib/strings/url-helpers.ts
···
88
88
return url
89
89
}
90
90
91
+
// separate one for bluesky, im fully aware i could just have it in one function but im more worried about code conflicts from this
92
+
export function toShareUrlBsky(url: string): string {
93
+
if (!url.startsWith('https')) {
94
+
const urlp = new URL('https://bsky.app')
95
+
urlp.pathname = url
96
+
url = urlp.toString()
97
+
}
98
+
return url
99
+
}
100
+
91
101
export function toBskyAppUrl(url: string): string {
92
102
return new URL(url, BSKY_APP_HOST).toString()
93
103
}
+24
-1
src/view/com/profile/ProfileMenu.tsx
+24
-1
src/view/com/profile/ProfileMenu.tsx
···
10
10
import {makeProfileLink} from '#/lib/routes/links'
11
11
import {type NavigationProp} from '#/lib/routes/types'
12
12
import {shareText, shareUrl} from '#/lib/sharing'
13
-
import {toShareUrl} from '#/lib/strings/url-helpers'
13
+
import {toShareUrl, toShareUrlBsky} from '#/lib/strings/url-helpers'
14
14
import {logger} from '#/logger'
15
15
import {isWeb} from '#/platform/detection'
16
16
import {type Shadow} from '#/state/cache/types'
···
116
116
117
117
const onPressShare = React.useCallback(() => {
118
118
shareUrl(toShareUrl(makeProfileLink(profile)))
119
+
}, [profile])
120
+
121
+
const onPressShareBsky = React.useCallback(() => {
122
+
shareUrl(toShareUrlBsky(makeProfileLink(profile)))
119
123
}, [profile])
120
124
121
125
const onPressAddRemoveLists = React.useCallback(() => {
···
264
268
<Menu.ItemText>
265
269
{isWeb ? (
266
270
<Trans>Copy link to profile</Trans>
271
+
) : (
272
+
<Trans>Share via...</Trans>
273
+
)}
274
+
</Menu.ItemText>
275
+
<Menu.ItemIcon icon={isWeb ? ChainLinkIcon : ArrowOutOfBoxIcon} />
276
+
</Menu.Item>
277
+
<Menu.Item
278
+
testID="profileHeaderDropdownShareBtn"
279
+
label={isWeb ? _(msg`Copy via bsky.app`) : _(msg`Share via...`)}
280
+
onPress={() => {
281
+
if (showLoggedOutWarning) {
282
+
loggedOutWarningPromptControl.open()
283
+
} else {
284
+
onPressShareBsky()
285
+
}
286
+
}}>
287
+
<Menu.ItemText>
288
+
{isWeb ? (
289
+
<Trans>Copy via bsky.app</Trans>
267
290
) : (
268
291
<Trans>Share via...</Trans>
269
292
)}
+24
-6
src/view/screens/ProfileList.tsx
+24
-6
src/view/screens/ProfileList.tsx
···
29
29
import {type NavigationProp} from '#/lib/routes/types'
30
30
import {shareUrl} from '#/lib/sharing'
31
31
import {cleanError} from '#/lib/strings/errors'
32
-
import {toShareUrl} from '#/lib/strings/url-helpers'
32
+
import {toShareUrl, toShareUrlBsky} from '#/lib/strings/url-helpers'
33
33
import {s} from '#/lib/styles'
34
34
import {logger} from '#/logger'
35
35
import {isNative, isWeb} from '#/platform/detection'
···
506
506
shareUrl(url)
507
507
}, [list, rkey])
508
508
509
+
const onPressShareBsky = useCallback(() => {
510
+
const url = toShareUrlBsky(`/profile/${list.creator.did}/lists/${rkey}`)
511
+
shareUrl(url)
512
+
}, [list, rkey])
513
+
509
514
const dropdownItems: DropdownItem[] = useMemo(() => {
510
515
let items: DropdownItem[] = [
511
516
{
512
517
testID: 'listHeaderDropdownShareBtn',
513
518
label: isWeb ? _(msg`Copy link to list`) : _(msg`Share`),
514
519
onPress: onPressShare,
520
+
icon: {
521
+
ios: {
522
+
name: 'square.and.arrow.up',
523
+
},
524
+
android: '',
525
+
web: 'share',
526
+
},
527
+
},
528
+
{
529
+
testID: 'listHeaderDropdownShareBtn',
530
+
label: isWeb ? _(msg`Copy via bsky.app`) : _(msg`Share`),
531
+
onPress: onPressShareBsky,
515
532
icon: {
516
533
ios: {
517
534
name: 'square.and.arrow.up',
···
633
650
}, [
634
651
_,
635
652
onPressShare,
653
+
onPressShareBsky,
654
+
savedFeedConfig,
636
655
isOwner,
637
656
isModList,
638
657
isPinned,
639
658
isCurateList,
659
+
isBlocking,
660
+
isMuting,
661
+
onRemoveFromSavedFeeds,
640
662
onPressEdit,
641
663
deleteListPromptControl.open,
642
664
onPressReport,
643
665
isPending,
644
-
isBlocking,
645
-
isMuting,
666
+
removeSavedFeed,
646
667
onUnsubscribeMute,
647
668
onUnsubscribeBlock,
648
-
removeSavedFeed,
649
-
savedFeedConfig,
650
-
onRemoveFromSavedFeeds,
651
669
])
652
670
653
671
const subscribeDropdownItems: DropdownItem[] = useMemo(() => {