Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posts List: Add Copy link functionality for posts #15570

Merged
merged 35 commits into from Nov 24, 2021
Merged

Posts List: Add Copy link functionality for posts #15570

merged 35 commits into from Nov 24, 2021

Conversation

ovitrif
Copy link
Contributor

@ovitrif ovitrif commented Nov 13, 2021

Fixes #13292

Description

This PR implements the "Copy link" functionality for published posts (already exists on Calypso).

We've received a request in beta tester feedback to have an option to copy the URL for a post:

The app is utter waste without the option to copy the url of published post. Its completely useless.., there is share icon and copy option, but in some phones that copy option will not appear, so we need to share it to some person in whatsapp and copy it from there.

The proposed solution is inspired from the web version, where:

  • The option to copy the post link is right above the trash button
  • A notification is shown to the user after the link was copied
Preview web version
Copy link Button Notification
1_preview_web_version 2_preview_web_version_notification

To test

Published/Scheduled/Draft Posts

  1. From My Site press the Posts button or scroll down and select Blog Posts from the list
  2. In post cards mode press the More button / In post list mode press the dots at the right of the post
  3. Verify that the Copy link button is visible above the Trash button
  4. Press the Copy link button
  5. Verify that a toast message appears saying "Link copied to clipboard" (see screenshots below)
  6. Open a browsing app
  7. Long press and paste in the address bar and navigate to that address
  8. Verify that the link in the address bar is correct and the post is shown

Trashed Posts

  1. From My Site press the Posts button or scroll down and select Blog Posts from the list
  2. Select the Trashed (4th) tab
  3. Make sure you have a trashed post
  4. In post cards mode press the More button / In post list mode press the dots at the right of the post
  5. Verify that there is no Copy link button

Screenshots

Copy link Shown for Published Post Toast Notification No Copy link shown for draft, trashed or scheduled posts
copy_link_btn copy_link_toast scheduled_no_copy_link

Regression Notes

  1. Potential unintended areas of impact
    Buttons for non-published posts

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Manual testing
    Unit testing

  3. What automated tests I added (or what prevented me from doing so)
    n/a

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@ovitrif ovitrif marked this pull request as draft November 13, 2021 20:47
@ovitrif ovitrif changed the title Issue/13292 copy published post url Add Copy link functionality for published posts Nov 13, 2021
@ovitrif ovitrif changed the title Add Copy link functionality for published posts [DO NOT MERGE] Add Copy link functionality for published posts Nov 13, 2021
@antonis antonis self-requested a review November 14, 2021 12:22
@antonis antonis self-assigned this Nov 14, 2021
@antonis antonis added this to the 18.8 milestone Nov 15, 2021
Copy link
Member

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @ovitrif 👍
I've tested the modified functionality and it works great. The code and the tests also looks good 🎉
I've added a few comments/suggestions but nothing crucial :)

@antonis antonis added the [Status] Needs Design Review A designer needs to sign off on the implemented design. label Nov 15, 2021
@ovitrif
Copy link
Contributor Author

ovitrif commented Nov 16, 2021

Many thanks @antonis for your detailed and careful review, I'm making this pull-request ready for review and no longer a draft, and removing the [DO NOT MERGE] tag.

We still need a designer's point of view from @iamthomasbishop on the solution for the issue we're addressing here 🙇🏻‍♂️

Feedback is always welcome!

@ovitrif ovitrif changed the title [DO NOT MERGE] Add Copy link functionality for published posts Add Copy link functionality for published posts Nov 16, 2021
@ovitrif ovitrif changed the title Add Copy link functionality for published posts Post List: Add Copy link functionality for published posts Nov 16, 2021
@ovitrif ovitrif changed the title Post List: Add Copy link functionality for published posts Posts List: Add Copy link functionality for published posts Nov 16, 2021
@ovitrif ovitrif marked this pull request as ready for review November 16, 2021 18:13
@iamthomasbishop
Copy link

@ovitrif This looks great, I just have a couple of concerns:

Verify that there is no Copy link button

Maybe I'm missing context because I haven't seen all of the previous discussion—is there a reason we're not showing the copy link option on "Draft" and "Scheduled" posts/pages? I took a look at the web UI, which does show it on posts/pages in "Draft" and "Scheduled" (in addition to Published) states.

Verify that the Copy link button is visible above the Trash button

Would it be possible to add a divider above the "Trashed" menu option? (Note: This could be tackled separately because it's a pre-existing concern, not a result of the work here)

Toast Notification

I think we've moved away from using Toasts in favor of Snackbars for this type of notice, so that would be preferred here.

On a related note, I would also implement this as a Snackbar on iOS (which is a custom component IIRC; named either "Snackbar" or "Notice") if that's in scope—if not, would you mind creating a sibling implementation ticket over on the WPiOS repo and we can triage it in the near future?

@antonis
Copy link
Member

antonis commented Nov 18, 2021

Thank you for your feedback @iamthomasbishop 🙏

we're not showing the copy link option on "Draft" and "Scheduled" posts/pages? I took a look at the web UI, which does show it on posts/pages in "Draft" and "Scheduled" (in addition to Published) states.

I missed that Thomas. I think it would be good to align with the web on this if it is possible 👍

Would it be possible to add a divider above the "Trashed" menu option? (Note: This could be tackled separately because it's a pre-existing concern, not a result of the work here)

I agree that this can be tackled on a different PR later.

I think we've moved away from using Toasts in favor of Snackbars for this type of notice, so that would be preferred here.

Good catch 👍

On a related note, I would also implement this as a Snackbar on iOS (which is a custom component IIRC; named either "Snackbar" or "Notice") if that's in scope—if not, would you mind creating a sibling implementation ticket over on the WPiOS repo and we can triage it in the near future?

I'll take a note to create a ticket on this to tackle separately.

@ovitrif
Copy link
Contributor Author

ovitrif commented Nov 19, 2021

Hi @iamthomasbishop, thanks a lot for the feedback 🙇🏻‍♂️!
Also many thanks to @antonis for the follow up!

Maybe I'm missing context because I haven't seen all of the previous discussion—is there a reason we're not showing the copy link option on "Draft" and "Scheduled" posts/pages? I took a look at the web UI, which does show it on posts/pages in "Draft" and "Scheduled" (in addition to Published) states.

It is true that we show it also for posts/pages in "Draft" and "Scheduled" states on the web, we can definitely align the app in this regard!

Would it be possible to add a divider above the "Trashed" menu option? (Note: This could be tackled separately because it's a pre-existing concern, not a result of the work here)

Definitely a nice idea! I agree that we can handle the divider in a separate task.

I think we've moved away from using Toasts in favor of Snackbars for this type of notice, so that would be preferred here.

Thank you for the information, with that in mind indeed a snackbar should be the preferred solution here.

On a related note, I would also implement this as a Snackbar on iOS (which is a custom component IIRC; named either "Snackbar" or "Notice") if that's in scope—if not, would you mind creating a sibling implementation ticket over on the WPiOS repo and we can triage it in the near future?

Noted! @antonis will take care of creating the ticket for the WPiOS repo.

@ovitrif ovitrif changed the title Posts List: Add Copy link functionality for published posts Posts List: Add Copy link functionality for posts Nov 23, 2021
@antonis antonis self-requested a review November 24, 2021 05:42
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Nov 24, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@antonis antonis self-requested a review November 24, 2021 07:54
@peril-wordpress-mobile
Copy link

You can test the changes on this Pull Request by downloading the APKs:

Copy link
Member

@antonis antonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @ovitrif 👍
I retested the changes with the latest commits and everything works as expected 🎉
The code also LGTM 🚢

@antonis antonis merged commit bf3b212 into wordpress-mobile:develop Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Post List [Status] Needs Design Review A designer needs to sign off on the implemented design. [Type] Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Post List: consider adding an option to copy the post URL
4 participants