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

Add Tenor support #11587

Merged

Conversation

ThomazFB
Copy link
Contributor

@ThomazFB ThomazFB commented Apr 4, 2020

Summary

This pull request proposes a solution that brings a complete integration for the Tenor API within the pre-existent GIF selection code inside the WordPress application, solving the issue 11456.

This is an aggregation branch for four different branches:

Pull Request Link
Tenor API integrated with GIF Picker ThomazFB#1
GIF selection fully restored with Tenor API improvements ThomazFB#2
Replace UI and internal Giphy references ThomazFB#3
Add Tenor feature flag through selected build type ThomazFB#4

Changelog

Tenor integration changes

  • A GifProvider interface is now the only coupling between all code for the GIF picker and the Tenor implementation, avoiding any reference to the Tenor library and making it easy to replace the Provider as we're doing now.
  • The TenorProvider implements the GifProvider interface and is injected within the DataSource via Dagger, this way only the AppplicationModule knows about the TenorProvider. Also, the TenorProvider is covered by unit tests in the TenorProviderTest class.
  • The already implemented pagination feature and list actions are all kept and integrated to work smoothly with the GifProvider, this integration happens through the available PositionalDataSource, The Tenor implementation makes sure that positioning tracking is respected.
  • The original integration with the MediaBrowserActivity was restored, making GIF selection available again.
  • The original integration with the EditPostActivity was restored, making GIF selection available again when writing or editing posts.
  • Analytics tracking restored.

UI changes

  • The Giphy attribution icon was removed and replaced by the Tenor attribution icon.
  • Every UI string with Giphy information was replaced with Tenor.

Refactoring and improvements changes

  • Test suite class added to GiphyPickerDataSource in order to better enforce the business logic when consuming any GifProvider implementation.
  • The giphy packages inside ui and viewmodel were both renamed to only gif.
  • All classes with the Giphy naming convention were renamed to only Gif to better fit the agnostic gif provider implementation strategy.
  • All comments and documentation with references to Giphy or the Giphy SDK were readapted to better fit the GifProvider structure.

Build configuration changes

  • The BuildConfig now receive the declaration of the boolean TENOR_AVAILABLE field directly from the build.gradle.
  • The button availability to select the Tenor GIF picker follows the TENOR_AVAILABLE value, if the value is false, the button doesn't get configured and should never appear on the screen.
  • The TENOR_AVAILABLE is set as true for the Wasabi and Zalpha builds and false for the Vanilla build.
  • Removed the Giphy SDK reference at maven repository in build.gradle.

Testing

Before doing any tests, make sure that to create a Tenor API key and paste it associated with the wp.tenor.api_key as the value inside your gradle.properties

GIF picking from Media Browser

screencapture-1585095917110 2020-03-24 23_04_23

How to test

  1. Go to the Media Browser
  2. Click on the Add button at the top right. Select the Choose from Tenor option
  3. Type in the search bar to query GIFs
  4. Once inside the Gif Picker, make sure that selection, preview and add are all working as expected

GIF picking from the Editor

screencapture-1585276984938 2020-03-26 23_46_37

How to test

  1. Click to create a new post
  2. Click on the overflow button at the top right end of the screen
  3. select the Switch to classic editor
  4. Click on the plus (+) button at the bottom left end of the screen
  5. Select the Choose from Tenor option
  6. Type in the search bar to query GIFs
  7. Once inside the Gif Picker, make sure that selection, preview and add are all working as expected

Tenor GIF picker feature flag - Post Editor

Wasabi and Zalpha Vanilla
screenshot-1585788446924 screenshot-1585788432154

How to test with Wasabi and Zalpha build

  1. Click to create a new post
  2. Click on the overflow button at the top right end of the screen
  3. select the Switch to classic editor
  4. Click on the plus (+) button at the bottom left end of the screen
  5. Verify that the Choose from Tenor option is available
  6. Type in the search bar to query GIFs
  7. Once inside the Gif Picker, make sure that selection, preview and add are all working as expected

How to test with Vanilla build

  1. Click to create a new post
  2. Click on the overflow button at the top right end of the screen
  3. select the Switch to classic editor
  4. Click on the plus (+) button at the bottom left end of the screen
  5. Verify that the Choose from Tenor option isn't there

Tenor GIF picker feature flag - Media Browser

Wasabi and Zalpha Vanilla
screenshot-1585788487864 screenshot-1585788395658

How to test with Wasabi and Zalpha build

  1. Go to the Media Browser
  2. Click on the Add button at the top right
  3. Verify that the Choose from Tenor option is available
  4. Type in the search bar to query GIFs
  5. Once inside the Gif Picker, make sure that selection, preview and add are all working as expected

How to test with Vanilla build

  1. Go to the Media Browser
  2. Click on the Add button at the top right.
  3. Verify that the Choose from Tenor option isn't there

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.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Apr 4, 2020

Warnings
⚠️ PR is not assigned to a milestone.
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@ThomazFB ThomazFB force-pushed the issue/11456-add-tenor-support branch from e0ce4cf to 009684b Compare April 4, 2020 03:07
@ThomazFB
Copy link
Contributor Author

ThomazFB commented Apr 4, 2020

Hello @planarvoid! Just for your information, I've added four additional commits directly to this branch.

The c604372736bfb3366aab5ee46cdee3222bd73ebb to adjust the licenses.html file as we talked before.

The 74082b99a8612d026dcea26a65ea1520a17e67a7, e163ac84c6b444e2e1744750d4b67c89fc0296db and 009684b9e1e1e034aa4fd3af37a1c4933cefab6e to fix the checkstyle and lint reports.

Also, I've done some rebases with the develop branch to fix some conflicts.

What do you think?

@ThomazFB ThomazFB force-pushed the issue/11456-add-tenor-support branch 4 times, most recently from 50086ea to 3b9a13d Compare April 4, 2020 23:00
@planarvoid planarvoid self-requested a review April 6, 2020 14:29
@planarvoid
Copy link
Contributor

planarvoid commented Apr 6, 2020

Hey @ThomazFB, thanks for the PR! I was wondering about why you moved the error string from the strings.xml into a constant? This way it can't be translated. I actually quite liked the previous approach. Is it the Unused resource lint warning? We usually suppress these when the strings are used just in the code.

@ThomazFB
Copy link
Contributor Author

ThomazFB commented Apr 6, 2020

Hey @ThomazFB, thanks for the PR! I was wondering about why you moved the error string from the strings.xml into a constant? This way it can't be translated. I actually quite liked the previous approach. Is it the Unused resource lint warning? We usually suppress these when the strings are used just in the code.

Hello @planarvoid! It was exactly because of the lint warning! The report was pointing out about the unused strings. And so I thought that the project was restricted about using strings for Exception messages instead of UI ones, should we suppress those errors then?

@ThomazFB ThomazFB force-pushed the issue/11456-add-tenor-support branch from 3b9a13d to ceac897 Compare April 7, 2020 02:35
@ThomazFB
Copy link
Contributor Author

ThomazFB commented Apr 7, 2020

Hey @planarvoid! Thank you for your feedback! Just letting you know that I committed a fix with your proposed string suppression for unused warnings and reverted the translatable string usage. Here's the commit: 0c09c88. What do you think?

edit: I've also done another rebase because of a new conflict with the develop branch.

@planarvoid
Copy link
Contributor

thanks for the changes @ThomazFB, we usually do git merge develop instead of rebases here but rebase works just as well :-).
I'd recommend doing something like this to ignore the exception:

<string name="stats_site_not_loaded_yet" tools:ignore="UnusedResources">Site not loaded yet</string>

@ThomazFB
Copy link
Contributor Author

ThomazFB commented Apr 7, 2020

Thank you for the suggestions @planarvoid! I'll prioritize merges instead of rebases then! Also, I've just modified the suppression declaration right here: 13e88ec. Let me know what you think.

Copy link
Contributor

@planarvoid planarvoid left a comment

Choose a reason for hiding this comment

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

Thanks for all the changes and the great PR description. It works nicely 👍

@planarvoid planarvoid merged commit 80cc5c3 into wordpress-mobile:develop Apr 8, 2020
ParaskP7 added a commit that referenced this pull request Dec 5, 2022
This dependency seems that was lastly used only for the no longer
existing 'TenorProviderTest' test class
(see 47ac89a), which was added as part
of this #11587 PR.

However, as part of this #14727 PR, this 'TenorProviderTest' test class
got removed (see f29f6d0).

As such, this leftover from back then can be now safely removed.

PS: And with this change, the corresponding 'androidxTestCoreVersion'
version is no longer necessary for unit test. As such, it is being moved
from the more inclusive 'test' section to the more specific
'android test' section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants