Skip to content

Conversation

@0nko
Copy link
Contributor

@0nko 0nko commented May 24, 2023

Fixes #9105, a subtask of #8999.

This PR schedules a notification 1 day after a trial expiration and when a user taps on it, the app's redirected to the plan upgrade webview. There is a precondition that's checked before a notification's displayed -- a site must be still in trial and the site ID must match the original site that was created.

To test:

To make the testing quicker, change the notification delay units to seconds here to see it sooner than after 15 days :)

  1. Start the store creation flow and create a new store
  2. Wait for 15 days (or seconds)
  3. Notice a notification is displayed
  4. Tap on the notification
  5. Notice the plan upgrade web view is displayed

@0nko 0nko added the feature: notifications Related to notifications or notifs. label May 24, 2023
@0nko 0nko added this to the 13.8 milestone May 24, 2023
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 24, 2023

You can test the changes on this Pull Request by downloading an installable build, or scanning this QR code:

@hafizrahman
Copy link
Contributor

The first 7 commits here seem to match the commits on #9104. Do you maybe want this to target that PR's branch instead of trunk?

@peril-woocommerce
Copy link

peril-woocommerce bot commented May 25, 2023

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

@0nko 0nko changed the base branch from trunk to issue/9101-one-day-before-notification May 25, 2023 09:30
@0nko
Copy link
Contributor Author

0nko commented May 25, 2023

@hafizrahman Yes! :)

Base automatically changed from issue/9101-one-day-before-notification to trunk May 25, 2023 10:01
@JorgeMucientes JorgeMucientes self-assigned this May 25, 2023
Comment on lines +43 to +51
private fun proceedIfFreeMatchingSite(siteId: Long?): Result {
val site = selectedSite.get()
return if (site.isFreeTrial && site.siteId == siteId) {
Result.success()
} else {
cancelWork("Store plan upgraded or a different site. Cancelling work.")
}
}

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 aware this is coming from another PR. And I don't think we need to change anything in this PR, but I still believe it would be useful to show this notifications even when the user has switched to a different site. As long as the original site is still free trial I think it's worth notifying the user they have expired free trial sites.

Anyway, is sort of a corner case and maybe the work involved to support this is not worth it. Just some food for thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I agree. Although we'd need to modify the message that would identify the other site and tapping on it would switch sites 🤷

@JorgeMucientes
Copy link
Contributor

Nicely done @0nko !! I came back from the future after 15 days and I can confirm notification is shown and works as expected! :shipit:

@JorgeMucientes JorgeMucientes merged commit f9645c6 into trunk May 25, 2023
@JorgeMucientes JorgeMucientes deleted the issue/9105-1-day-after-notification branch May 25, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: notifications Related to notifications or notifs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Send a scheduled notification to users on the one day after their free trial expires.

5 participants