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

Blaze: Navigate to campaign creation after tapping on local notifications #13968

Merged
merged 14 commits into from
Sep 17, 2024

Conversation

itsmeichigo
Copy link
Contributor

@itsmeichigo itsmeichigo commented Sep 16, 2024

Closes: #13935

Description

This PR handles the navigation to campaign creation upon tapping on local notifications for no Blaze campaign reminders. The site ID was restored for the user info of the notifications and is used to handle store switching and checking for eligibility.

Changes compared to the original PR #13944:

  • Switching stores was added to ensure that Blaze eligibility check is done for the correct site.
  • scheduleLocalNotificationIfNeeded was renamed to clarify the notification type.

Thanks to the change in #13950, the handle of taps on local notification should now work even when the app is not running.

Steps to reproduce

  • Build the app to a physical device to test notifications.
  • If you tested Blaze local notifications before, log out and log in again to a test store eligible for Blaze to ensure that local notifications can be scheduled again.
  • Schedule a few non-evergreen campaigns (from web or mobile app). Note down the start time and duration of the latest campaign. i.e. The campaign that ends the last based on start_time and duration_days values.
  • Send the app to background or kill the app
  • Add 30 days to the start time and duration of the latest campaign.
  • Change the device time to one or two minutes before the above calculated time.
  • Wait for the notification to arrive.
  • Tap on the notification and the app should be opened and navigate to the hub menu tab > Blaze > campaign creation.

Testing information

Tested on iPhone 12 Pro iOS 17.6.1 and confirmed that tapping on both no campaign reminders and abandoned campaign creation navigate to the campaign creation flow.

Screenshots

RPReplay_Final1726541423.mov

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

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 all devices (phone/tablet) and no regressions are added.

@itsmeichigo itsmeichigo added type: task An internally driven task. feature: Blaze Related to the integration of the Blaze ads platform labels Sep 16, 2024
@itsmeichigo itsmeichigo added this to the 20.5 milestone Sep 16, 2024
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 16, 2024

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

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr13968-107eb31
Version20.4
Bundle IDcom.automattic.alpha.woocommerce
Commit107eb31
App Center BuildWooCommerce - Prototype Builds #10895
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@selanthiraiyan selanthiraiyan self-assigned this Sep 16, 2024
Copy link
Contributor

@selanthiraiyan selanthiraiyan left a comment

Choose a reason for hiding this comment

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

This works as expected. 🚀

@@ -20,6 +20,7 @@ final class DefaultBlazeLocalNotificationScheduler: BlazeLocalNotificationSchedu
private let pushNotesManager: PushNotesManager
private var subscriptions: Set<AnyCancellable> = []
private let blazeEligibilityChecker: BlazeEligibilityCheckerProtocol
private var switchStoreUseCase: SwitchStoreUseCaseProtocol?
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: It might be worth injecting this in init to unit test that the store switch happens before navigating to campaign creation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@selanthiraiyan I injected the use case and added a unit test in 44af79d. Let me know if this matches your expectations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great. Thanks, Huong!

@itsmeichigo itsmeichigo merged commit 7ac5077 into trunk Sep 17, 2024
12 of 14 checks passed
@itsmeichigo itsmeichigo deleted the task/13935-tap-blaze-local-notifications branch September 17, 2024 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: Blaze Related to the integration of the Blaze ads platform type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open the campaign creation flow upon tapping on the local notifications.
4 participants