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

Check black flagged websites on app launch #12792

Merged

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Oct 16, 2024

Closes: #12789 Closes: #12790

Depends on #12788

Description

This PR adds logic to fetch the site status from the WCPom endpoint on app launch to determine if the site is suspended or not, and then update the corresponding flags, this will ensure two cases:

  1. If a suspended site gets approved later, we'll show them the Jeptack upsells from inside.
  2. If a site gets suspended, then we'll hide the Jetpack installation upsells.

Steps to reproduce

  1. DM me to share with a suspended website (or the steps to create one)
  2. Open the app and sign in to the site.
  3. DM me to share steps to mark the site as not suspended.
  4. Open the app.

Testing information

  • At step 4, confirm that the Jetpack upsells are shown again in the app.

Important: the Jetpack upsells might not show exactly on first launch if the fetch took a little bit long, but they will appear when changing the screen and going back, I think that this is fine for this use case and that listening to the preference to update the UI would be an overkill, a site being suspended or unsuspended wouldn't be a frequent change anyway, let me know what you think.

The tests that have been performed

^

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@hichamboushaba hichamboushaba added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Oct 16, 2024
@dangermattic
Copy link
Collaborator

dangermattic commented Oct 16, 2024

1 Warning
⚠️ This PR is assigned to the milestone 20.8. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.
1 Message
📖

This PR contains changes to Tracks-related logic. Please ensure (author and reviewer) the following are completed:

  • The tracks events must be validated in the Tracks system.
  • Verify the internal Tracks spreadsheet has also been updated.
  • Please consider registering any new events.
  • The PR must be assigned the category: tracks label.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 16, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit05655fc
Direct Downloadwoocommerce-wear-prototype-build-pr12792-05655fc.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 16, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit05655fc
Direct Downloadwoocommerce-prototype-build-pr12792-05655fc.apk

@hichamboushaba hichamboushaba force-pushed the issue/12789-check-black-flagged-websites-on-launch branch from 9abd300 to 670d998 Compare October 16, 2024 17:49
@hichamboushaba hichamboushaba added type: enhancement A request for an enhancement. feature: login Related to any part of the log in or sign in flow, or authentication. labels Oct 16, 2024
@hichamboushaba hichamboushaba force-pushed the issue/12782-hide-jetpack-for-black-flagged-websites branch from e667523 to 8a8d8fd Compare October 17, 2024 08:26
@hichamboushaba hichamboushaba force-pushed the issue/12789-check-black-flagged-websites-on-launch branch from 670d998 to 1513857 Compare October 17, 2024 08:37
@hichamboushaba hichamboushaba added this to the 20.8 milestone Oct 17, 2024
@hichamboushaba hichamboushaba marked this pull request as ready for review October 17, 2024 11:53
@JorgeMucientes JorgeMucientes self-assigned this Oct 17, 2024
Copy link
Contributor

@JorgeMucientes JorgeMucientes left a comment

Choose a reason for hiding this comment

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

Nicely done @hichamboushaba.

The code changes look good and black-flagging and un-black-flagging the site worked great!

@JorgeMucientes JorgeMucientes added the category: tracks Related to analytics, including Tracks Events. label Oct 18, 2024
@JorgeMucientes JorgeMucientes modified the milestones: 20.8, 20.9 Oct 18, 2024
@hichamboushaba hichamboushaba modified the milestones: 20.9, 20.8 Oct 18, 2024
Base automatically changed from issue/12782-hide-jetpack-for-black-flagged-websites to trunk October 18, 2024 09:46
@hichamboushaba hichamboushaba removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Oct 18, 2024
@hichamboushaba hichamboushaba merged commit 5d90ea4 into trunk Oct 18, 2024
15 of 16 checks passed
@hichamboushaba hichamboushaba deleted the issue/12789-check-black-flagged-websites-on-launch branch October 18, 2024 09:49
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 77.77778% with 6 lines in your changes missing coverage. Please review.

Project coverage is 40.86%. Comparing base (c0d7adb) to head (05655fc).
Report is 10 commits behind head on trunk.

Files with missing lines Patch % Lines
...erce/android/ui/sitepicker/SitePickerRepository.kt 0.00% 5 Missing ⚠️
...ain/kotlin/com/woocommerce/android/SiteObserver.kt 95.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #12792      +/-   ##
============================================
+ Coverage     40.80%   40.86%   +0.05%     
- Complexity     5753     5765      +12     
============================================
  Files          1237     1237              
  Lines         69833    69852      +19     
  Branches       9699     9706       +7     
============================================
+ Hits          28498    28545      +47     
+ Misses        38706    38672      -34     
- Partials       2629     2635       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tracks Related to analytics, including Tracks Events. feature: login Related to any part of the log in or sign in flow, or authentication. type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Black-flagged websites] Tracking Check if site is black-flagged on app launch
5 participants