Skip to content

Commit

Permalink
Merge pull request #2801 from ecency/nt/short-wave-link
Browse files Browse the repository at this point in the history
sharing/copying shortened wave link
  • Loading branch information
feruzm authored Dec 16, 2023
2 parents a442baa + 1329ef0 commit c083ce1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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}`,
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/screens/post/screen/postScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const PostScreen = ({ route }) => {
post={getPostQuery.data}
isWavePost={isWavePost}
/>
<PostOptionsModal ref={postOptionsModalRef} />
<PostOptionsModal ref={postOptionsModalRef} isWave={isWavePost} />
</View>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/screens/waves/screen/wavesScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const WavesScreen = ({ route }) => {
/>
</View>

<PostOptionsModal ref={postOptionsModalRef} />
<PostOptionsModal ref={postOptionsModalRef} isWave={true} />
</View>
);
};
Expand Down

0 comments on commit c083ce1

Please sign in to comment.