Skip to content

Conversation

@joshheald
Copy link
Contributor

@joshheald joshheald commented Nov 2, 2022

Part of: #7916

Description

JITMs were previously only loaded when the Dashboard was first loaded. This could mean that the latest message is not shown, especially if the app has stayed in memory for some time.

The dashboard has data which benefits from regular refreshing, so in this PR we refresh the JITMs whenever that data is refreshed.

Additionally, when the user takes action in a webview, they may make themselves ineligible for a JITM, by completing the action it's informing them of. This PR resyncs the announcements when the webview is closed, so that JITMs will be automatically dismissed in that case

Testing instructions

N.B. see pdfdoF-1uc-p2#comment-2581 for details of setting up your store to be eligible for the test JITM

With a US store that is eligible for the test JITM, on a debug/alpha build of the app

Pull to refresh:

  1. Set up Proxyman or Charles to observe network requests
  2. Open the app
  3. Observe that the message is shown, after a network request to https://public-api.wordpress.com/rest/v1.1/jetpack-blogs/{SITEID}/rest-api/?json=true&path=/jetpack/v4/jitm%26_method%3Dget&query=%7B%22message_path%22%3A%22woomobile%3Amy_store%3Aadmin_notices%22%7D
  4. Dismiss the JITM
  5. Pull to Refresh
  6. Observe that the JITM doesn't show, but that there's been another network request (with {data: []} as the response)
  7. Wait 30 seconds, then Pull to Refresh again
  8. Observe that the JITM shows again

Refresh after webview dismissal

  1. Set up Proxyman or Charles to observe network requests, setting a breakpoint on the response to https://public-api.wordpress.com/rest/v1.1/jetpack-blogs/*/rest-api/?json=true&path=/jetpack/v4/jitm*
  2. Open the app
  3. Observe that the message is shown
  4. Tap the CTA
  5. Tap Done or swipe the webview away
  6. At the breakpoint, edit the response body to {"data": []}
  7. Observe that the JITMs are dismissed. (Since this is simulated, they will return when pulling to refresh unless you edit the response again!)

N.B. there's nothing you can do in this webview to become ineligible for the JITM, which is the expected use case. With potential future backend changes, e.g. to target only people who've not bought a card reader, this refresh behaviour could automatically remove a JITM without need for them to dismiss it.

Screenshots

jitm-refresh-on-webview-close.mp4

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Syncing announcements after the webview is closed will allow the JITM to be automatically removed in response to user action, if the user no longer fits the profile to recieve the message after they have taken the action in the webview.
@joshheald joshheald added type: task An internally driven task. feature: jitm Related to Just In Time Messages labels Nov 2, 2022
@joshheald joshheald added this to the 11.1 milestone Nov 2, 2022
@joshheald
Copy link
Contributor Author

@rachelmcr optional review again. FYI I moved the code that prevents JITM sync when there's a product announcement showing, because it was stopping us from clearing the JITMs on refresh, if the user had become ineligible for the message.

Let me know if you have any concerns but it has the same effect on priority of announcements.

@joshheald joshheald requested a review from rachelmcr November 2, 2022 15:03
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 2, 2022

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8012-3eb1f86 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

Syncing announcements after the webview is closed will allow the JITM to be automatically removed in response to user action, if the user no longer fits the profile to recieve the message after they have taken the action in the webview.
@joshheald joshheald marked this pull request as ready for review November 2, 2022 16:27
@joshheald joshheald requested review from koke and pachlava November 2, 2022 16:27
@joshheald joshheald changed the title [Just In Time Messages] [Just In Time Messages] Refresh JITMs Nov 2, 2022
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@rachelmcr
Copy link
Contributor

Thanks, these changes make sense! No issues from the products onboarding perspective 👍

@koke koke self-assigned this Nov 3, 2022
Copy link
Member

@koke koke left a comment

Choose a reason for hiding this comment

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

I tested the first part and it worked fine. However, when I tap on the CTA and then dismiss the web view, the JITM is still there

@koke koke removed their assignment Nov 3, 2022
@joshheald
Copy link
Contributor Author

I tested the first part and it worked fine.

Thanks for the speedy review @koke!

However, when I tap on the CTA and then dismiss the web view, the JITM is still there

Yes, this is expected with this JITM.

Ideally, if you tapped on the CTA, and bought a card reader, the JITM would be removed on refresh when you dismiss the webview. However, even if you do that it won't actually be dismissed with this test JITM: there's no targeting rule for "hasn't bought a card reader on woocommerce.com" at the moment.

The code here merely gives us the ability to remove the JITM after some backend changes:

N.B. there's nothing you can do in this webview to become ineligible for the JITM, which is the expected use case. With potential future backend changes, e.g. to target only people who've not bought a card reader, this refresh behaviour could automatically remove a JITM without need for them to dismiss it.
– testing instructions

Copy link
Member

@koke koke left a comment

Choose a reason for hiding this comment

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

I was confused by the 6. Observe that the JITMs are dismissed. If this is the expected behavior then it's good to go 🚀

@joshheald
Copy link
Contributor Author

I was confused by the 6. Observe that the JITMs are dismissed. If this is the expected behavior then it's good to go 🚀

Ah sorry that is confusing. I missed out the step in those testing instructions where you should edit the response to {"data": []}, to simulate the user becoming ineligible for the JITM after that action, which I think I did in the video... Sorry about that, and thanks again!

Adding that in now to avoid confusing @pachlava as well 😬

Base automatically changed from issue/7853-retrieval-and-view-jitm-analytics to trunk November 4, 2022 11:24
@joshheald joshheald merged commit 4b2accc into trunk Nov 4, 2022
@joshheald joshheald deleted the issue/7916-refresh-jitms branch November 4, 2022 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: jitm Related to Just In Time Messages type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants