-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Jetpack Focus: Disable WordPress app notifications from Jetpack app by using URL schemes #19616
Jetpack Focus: Disable WordPress app notifications from Jetpack app by using URL schemes #19616
Conversation
Having a separate scheme allows to detect if WordPress and Jetpack apps are compatible with notification migration
- When Jetpack enables notifications, check if WordPress app exists and open it - On WordPress app, disable notifications, comeback to Jetpack app
FeatureFlags are imported in all targets and don't support all the features the NotificationMigrationService requires
You can test the changes in Jetpack from this Pull Request by:
|
You can test the changes in WordPress from this Pull Request by:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @staskus, I didn't have time to test the code but I reviewed the code and have some thoughts which I shared above. I'm getting up to speed with this approach (plan B) and I might not have the full picture yet.
Either way I sent an invite for pair programming tomorrow if you're available. Otherwise will continue reviewing and testing tomorrow.
WordPress/WordPressTest/NotificationFilteringServiceTests.swift
Outdated
Show resolved
Hide resolved
WordPress/WordPressTest/NotificationFilteringServiceTests.swift
Outdated
Show resolved
Hide resolved
WordPress/WordPressTest/NotificationFilteringServiceTests.swift
Outdated
Show resolved
Hide resolved
WordPress/WordPressTest/NotificationFilteringServiceTests.swift
Outdated
Show resolved
Hide resolved
WordPress/WordPressTest/NotificationFilteringServiceTests.swift
Outdated
Show resolved
Hide resolved
WordPress/Classes/Services/JetpackNotificationMigrationService.swift
Outdated
Show resolved
Hide resolved
WordPress/Classes/Services/JetpackNotificationMigrationService.swift
Outdated
Show resolved
Hide resolved
WordPress/Classes/Services/JetpackNotificationMigrationService.swift
Outdated
Show resolved
Hide resolved
...Classes/ViewRelated/Notifications/Controllers/NotificationSettingDetailsViewController.swift
Outdated
Show resolved
Hide resolved
WordPress/Classes/ViewRelated/Stats/Insights/SiteStatsPinnedItemStore.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guarani I fixed the issues we talked about, except for moving notification logic under FeatureFlags
. Either way, the solution could be tested if you have capacity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug build
- ✅ Case 1: WordPress + Receive Notifications
- ✅ Case 2: WordPress + Jetpack
- ✅ Case 3: WordPress + Reenable Notifications
⚠️ Case 4: WordPress + Jetpack migration flow- The flow itself seemed to work well except for the following issue
⚠️ To test, I was commenting on a site using a different account. I noticed that in this test, the comment itself (i.e. the body of the push notification) was no longer shown in the push notification (only the push notification title was visible). Do you see this?
- ✅ Case 5: Incompatible WordPress + Jetpack migration flow
@staskus, I haven't dug into the above issue, but perhaps the notification body is being removed when the feature flag is on.
Thanks for testing!
I assume the issue is as follows:
Expected:
I haven't noticed (or specifically looked for) such an issue, so I need to check. As you can see in the attached video, Jetpack shows comments in the notification. For now, it's hard to see how the Feature flag could be related, I'll check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the issue is as follows:
Yes, that description is accurate.
I can reproduce it again today 😕. It happens in "Case 4: WordPress + Jetpack migration flow" when I go through the migration flow. This points it to being an issue not coming from this PR.
I noticed that the body of the push notification should be fetched from the server when the notification arrives (see code). After going through the migration flow, this code isn't reached because it aborts when calling readExtensionToken()
(see code).
Since that code uses the keychain and app groups, I suspect something needs to be fixed there but I'm not sure yet what's wrong.
...WordPress-to-Jetpack Migration/Common/Views/Configuration/MigrationHeaderConfiguration.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that the above issue is present on trunk
so it isn't related to this PR.
I think this change looks good so I'm going ahead and approving based on my previous tests here and code review.
Thanks @staskus!
Generated by 🚫 dangerJS |
Part of: #19619
Description
This is a continuation of #19531 PR to allow disabling WordPress app notifications when notifications are enabled on the Jetpack app.
The original solution was built based on using Notification Filtering Entitlement but decided against it due to waiting times to approve this entitlement.
The alternative solution is to briefly jump to WordPress app, disable notifications, and comeback to the Jetpack app.
Solution
URLScheme
s for Jetpack and WordPress apps. New and separate URL schemes for migration ensures that we're not opening WordPress app unless it supports notification disablingNotificationFilteringService
toJetpackNotificationMigrationService
to represent the purpose better, also updated the descriptiondisableWordPressNotificationsFromJetpack
method that is called after Jetpack notifications are enabled and jumps from Jetpack to WordPress appWordPressAppDelegate
handleNotificationMigrationOnWordPress
to disable notifications on WordPress and come back to JetpackAdditionally:
FeatureFlag
and added separate service checksTesting instructions
Case 1: WordPress + Receive Notifications
Case 2: WordPress + Jetpack
Case 3: WordPress + Reenable Notifications
Case 4: WordPress + Jetpack migration flow
We’ll disable notifications for the WordPress app.
should be shownCase 5: Incompatible WordPress + Jetpack migration flow
We’ll disable notifications for the WordPress app.
should be visible, Jetpack app shouldn't open WordPress app, duplicate notification will appear† To turn on the feature flag, tap the profile pic, then App Settings, then Debug, and enable "Jetpack Migration prevent duplicate WordPress app notifications when Jetpack is installed"
Regression Notes
Affecting local notifications with some logic changes
Manual testing
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Images & Videos
Migration Flow
Migration.flow.MP4
Incompatible WordPress app + Migration Flow
Incompatible.WordPress.app.mov