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

Tenor integration #13949

Merged
merged 105 commits into from
May 12, 2020
Merged

Tenor integration #13949

merged 105 commits into from
May 12, 2020

Conversation

ScoutHarris
Copy link
Contributor

Ref #13803

This PR is to merge the Tenor feature branch into develop. It encompasses @ngoctr 's PRs for the tasks marked as complete on #13803 .

Accessing the Free GIF Library from any of the following paths presents the same Tenor picker, and should all look/behave the same:

Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-20 at 18 35 06 Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-20 at 18 36 33

To test:


Media Library:

  • Go to Site Details > Media.
  • Select + on the nav bar.
  • Verify Free GIF Library is an option. Select it.
  • Search for a GIF.
  • Select GIFs.
  • Verify they are added to the Media Library.

Block Editor:

  • Edit a post.
  • Ensure you're using the block editor.
  • Add an Image or Gallery block.
  • Select Add Image (Image block) / Add Media (Gallery block).
  • Verify Free GIF Library is an option. Select it.
  • Search for a GIF.
  • Select GIFs.
  • Verify they are added to the block.

NOTE: there is a known issue where Previewing a post before media finishes uploading breaks the media. This applies to any media type, in both editors.


Classic Editor:

  • Edit a post.
  • Ensure you're using the classic editor.
  • Tap the ellipsis button on the media toolbar.
  • Verify Free GIF Library is an option. Select it.
  • Search for a GIF.
  • Select GIFs.
  • Verify they are added to the post.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • 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.

ngoctr and others added 30 commits April 6, 2020 14:38
Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

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

Code looks good to me, just a few comments there and then the functional issues I mentioned before.

I've also seen the Couldn't decode API response from Tenor error logged out a few times while testing this, but I'm not sure why yet.

return origin.eventForMediaType(mediaType)
}

// Old tracking events via WPShared
// Ref: https://iosp2.wordpress.com/2020/03/16/adding-tracks-forget-wordpress-shared/
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably shouldn't include a p2 reference here

Copy link
Contributor

Choose a reason for hiding this comment

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

Two more of these below too

Copy link
Contributor

Choose a reason for hiding this comment

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

Done thanks @frosty

func eventForMediaType(_ mediaType: MediaType) -> WPAnalyticsStat? {
// All new media tracking events will be added into WPAnalyticsEvent
// Ref: https://iosp2.wordpress.com/2020/03/16/adding-tracks-forget-wordpress-shared/
func eventForMediaType(_ mediaType: MediaType) -> WPAnalyticsEvent? {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not entirely sure why these definitions need to be split out from the existing definitions below?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @frosty because the old tracking method uses WPAnalyticsStat from WPShared pod while the new method uses a new enum WPAnalyticsEvent

@@ -159,4 +186,5 @@ enum MediaSource {
case camera
case giphy
Copy link
Contributor

Choose a reason for hiding this comment

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

Note for a future PR: we should remove all the existing Giphy references

Copy link
Contributor

Choose a reason for hiding this comment

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

There is already a task for this #13803 ;-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, thanks!

@@ -64,6 +76,10 @@ final class AztecMediaPickingCoordinator {
giphy.presentPicker(origin: origin, blog: blog)
}

private func showTenor(origin: UIViewController, blog: Blog) {
tenor.presentPicker(origin: origin, blog: blog)
Copy link
Contributor

Choose a reason for hiding this comment

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

The media library and Gutenberg both create a new Tenor picker each time one needs to be presented. Should we do the same here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume it should be a YES answer. I believe the Gutenberg editor is the future of editor (69% uses have used it) so o I will make a change for this to make it consistent to Aztec/Media.

static func configureAsIntro(_ viewController: NoResultsViewController) {
viewController.configure(title: .tenorPlaceholderTitle,
image: Constants.imageName,
subtitleImage: "tenor-attribution")
Copy link
Contributor

Choose a reason for hiding this comment

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

This could probably go in the Constants enum too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done. Thanks @frosty

}

func numberOfAssets(of mediaType: WPMediaType, completionHandler: WPMediaCountBlock? = nil) -> Int {
return 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know why this is set to 10?

Copy link
Contributor

Choose a reason for hiding this comment

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

The TenorMediaGroup is created just to make the TenorDataSource conformed to the WPMediaCollectionDataSource protocol. Since we haven't supported media groups (e.g group by categories) in all media sources (StockPhotos, Giphy, Tenor). So 10 or any doesn't matter. StockPhotos uses 10, Giphy uses 10, Tenor (is a Giphy clone), has 10 too. :d

@ngoctr
Copy link
Contributor

ngoctr commented Apr 24, 2020

@frosty thanks for the review. I will try to address your comments as much as I can. Some of them were not entirely belong to the Tenor Picker itself, it's part of the app's existing and (inconsistent) behaviour so they should be tracked separately ;-)

@ngoctr
Copy link
Contributor

ngoctr commented Apr 25, 2020

  • There's an image with cell or overlay reuse in the table. If you already performed a search, and then you perform a new one, you first see the gif results from the original search and then they're gradually replaced with the new results. Video here: https://cloudup.com/cC823L9QA3B

To support animating GIF, the implementation of Tenor Picker injected an Overlay view for WPMediaCollectionViewCell and with the current design of the WPMediaPicker it's not possible to clear/reset the overlay view (from where the overlay is injected (WPiOS app)) when preparing to reuse a cell. So we will need to consider a bit more improvement on the WPMediaPicker itself in order to handle this situation.

@ScoutHarris ScoutHarris removed this from the 14.8 milestone Apr 30, 2020
Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

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

I think let's get this merged, but keep it feature flagged and ensure we have any remaining items captured in the master issue (I just added all of my issues there).

@ScoutHarris
Copy link
Contributor Author

Thanks @frosty !

@ScoutHarris ScoutHarris added this to the 14.9 milestone May 12, 2020
@ScoutHarris ScoutHarris merged commit bdf30ae into develop May 12, 2020
@ScoutHarris ScoutHarris deleted the feature/13803-tenor_integration branch May 12, 2020 20:02
@ScoutHarris ScoutHarris restored the feature/13803-tenor_integration branch May 13, 2020 01:26
@ScoutHarris ScoutHarris deleted the feature/13803-tenor_integration branch June 1, 2020 17:57
@ScoutHarris ScoutHarris mentioned this pull request Jul 23, 2020
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants