From 1329ef0257b53c1ce3a08530625c98e730485889 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Sat, 16 Dec 2023 13:32:32 +0500 Subject: [PATCH] sharing/copying shortened wave link --- .../postOptionsModal/container/postOptionsModal.tsx | 9 ++++++--- src/screens/post/screen/postScreen.tsx | 2 +- src/screens/waves/screen/wavesScreen.tsx | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/postOptionsModal/container/postOptionsModal.tsx b/src/components/postOptionsModal/container/postOptionsModal.tsx index 1c10261a12..6c973e1ab8 100644 --- a/src/components/postOptionsModal/container/postOptionsModal.tsx +++ b/src/components/postOptionsModal/container/postOptionsModal.tsx @@ -37,9 +37,10 @@ import styles from '../styles/postOptionsModal.styles'; interface Props { pageType?: string; + isWave?: boolean; } -const PostOptionsModal = ({ pageType }: Props, ref) => { +const PostOptionsModal = ({ pageType, isWave }: Props, ref) => { const intl = useIntl(); const dispatch = useAppDispatch(); const navigation = useNavigation(); @@ -191,7 +192,8 @@ const PostOptionsModal = ({ pageType }: Props, ref) => { }; const _share = () => { - const postUrl = getPostUrl(get(content, 'url')); + const _url = isWave ? `/@${content.author}/${content.permlink}` : content.url; + const postUrl = getPostUrl(_url); Share.share({ message: `${get(content, 'title')} ${postUrl}`, @@ -405,7 +407,8 @@ const PostOptionsModal = ({ pageType }: Props, ref) => { switch (options[index]) { case 'copy': - await writeToClipboard(getPostUrl(get(content, 'url'))); + const _url = isWave ? `/@${content.author}/${content.permlink}` : content.url; + await writeToClipboard(getPostUrl(_url)); alertTimer.current = setTimeout(() => { dispatch( toastNotification( diff --git a/src/screens/post/screen/postScreen.tsx b/src/screens/post/screen/postScreen.tsx index 0e47dad855..93a81436ef 100644 --- a/src/screens/post/screen/postScreen.tsx +++ b/src/screens/post/screen/postScreen.tsx @@ -94,7 +94,7 @@ const PostScreen = ({ route }) => { post={getPostQuery.data} isWavePost={isWavePost} /> - + ); }; diff --git a/src/screens/waves/screen/wavesScreen.tsx b/src/screens/waves/screen/wavesScreen.tsx index a78e0b6432..42b32909ac 100644 --- a/src/screens/waves/screen/wavesScreen.tsx +++ b/src/screens/waves/screen/wavesScreen.tsx @@ -168,7 +168,7 @@ const WavesScreen = ({ route }) => { /> - + ); };