Skip to content

Conversation

@0nko
Copy link
Contributor

@0nko 0nko commented May 24, 2023

Fixes #9101, a subtask of #8999.

This PR schedules a notification 1 day before 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 13 days :)

  1. Start the store creation flow and create a new store
  2. Wait for 13 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
@peril-woocommerce
Copy link

peril-woocommerce bot commented May 24, 2023

Fails
🚫

Danger failed to run /app/danger-0.tzxyvalhqkg.ts.

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

Error TypeError

Cannot read property 'diffForFile' of undefined
TypeError: Cannot read property 'diffForFile' of undefined
    at Object.exports.default (/app/danger-0.tzxyvalhqkg.ts:27:46)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Dangerfile

22|     // Calculate the changes to Test files because we don't want to limit those
23|     // Note that linesOfCode() function in the latest GitDSL can solve this problem in a more elegant way,
24|     // but the version of Danger currently used by Peril doesn't have it yet.
25|     const testFiles = [...modifiedFiles, ...createdFiles, ...deletedFiles].filter((path: string) => path.includes("/src/test"));
26|     let changesToTests = 0;
------------------------------------------------^
27|     for (let file of testFiles) {        
28|         const stringDiffs = await danger.git.diffForFile(file)
29|         const addedLines = stringDiffs.added.split("\n").filter(x => x.startsWith("+")).length;
30|         const removedLines = stringDiffs.removed.split("\n").filter(x => x.startsWith("-")).length;

Generated by 🚫 dangerJS

Base automatically changed from issue/9088-store-creation-incomplete to trunk May 24, 2023 20:00
@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:

Copy link
Contributor

@hafizrahman hafizrahman left a comment

Choose a reason for hiding this comment

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

👍🏼 This looks good to me, thanks for working on this! Let's get this merged.

@hafizrahman hafizrahman merged commit e45c73a into trunk May 25, 2023
@hafizrahman hafizrahman deleted the issue/9101-one-day-before-notification branch May 25, 2023 10:01
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 one day before their free trial expires.

4 participants