Bluesky app fork with some witchin' additions 💫

copy via bsky.app button in a couple places

Changed files
+86 -17
src
components
PostControls
lib
strings
view
com
profile
screens
+28 -10
src/components/PostControls/ShareMenu/ShareMenuItems.web.tsx
··· 8 8 import {makeProfileLink} from '#/lib/routes/links' 9 9 import {type NavigationProp} from '#/lib/routes/types' 10 10 import {shareText, shareUrl} from '#/lib/sharing' 11 - import {toShareUrl} from '#/lib/strings/url-helpers' 11 + import {toShareUrl, toShareUrlBsky} from '#/lib/strings/url-helpers' 12 12 import {logger} from '#/logger' 13 13 import {isWeb} from '#/platform/detection' 14 14 import {useAgeAssurance} from '#/state/ageAssurance/useAgeAssurance' ··· 63 63 onShareProp() 64 64 } 65 65 66 + const onCopyLinkBsky = () => { 67 + logger.metric('share:press:copyLink', {}, {statsig: true}) 68 + const url = toShareUrlBsky(href) 69 + shareUrl(url) 70 + onShareProp() 71 + } 72 + 66 73 const onSelectChatToShareTo = (conversation: string) => { 67 74 logger.metric('share:press:dmSelected', {}, {statsig: true}) 68 75 navigation.navigate('MessagesConversation', { ··· 82 89 } 83 90 84 91 const copyLinkItem = ( 85 - <Menu.Item 86 - testID="postDropdownShareBtn" 87 - label={_(msg`Copy link to post`)} 88 - onPress={onCopyLink}> 89 - <Menu.ItemText> 90 - <Trans>Copy link to post</Trans> 91 - </Menu.ItemText> 92 - <Menu.ItemIcon icon={ChainLinkIcon} position="right" /> 93 - </Menu.Item> 92 + <Menu.Group> 93 + <Menu.Item 94 + testID="postDropdownShareBtn" 95 + label={_(msg`Copy link to post`)} 96 + onPress={onCopyLink}> 97 + <Menu.ItemText> 98 + <Trans>Copy link to post</Trans> 99 + </Menu.ItemText> 100 + <Menu.ItemIcon icon={ChainLinkIcon} position="right" /> 101 + </Menu.Item> 102 + <Menu.Item 103 + testID="postDropdownShareBtn" 104 + label={_(msg`Copy link to post`)} 105 + onPress={onCopyLinkBsky}> 106 + <Menu.ItemText> 107 + <Trans>Copy via bsky.app</Trans> 108 + </Menu.ItemText> 109 + <Menu.ItemIcon icon={ChainLinkIcon} position="right" /> 110 + </Menu.Item> 111 + </Menu.Group> 94 112 ) 95 113 96 114 return (
+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
··· 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
··· 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(() => {