-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 push notifications for WP #17371
Jetpack focus: Disable push notifications for WP #17371
Conversation
If an instance of JP is detected then disable push notifications for WP to prevent double notifications
📲 You can test these changes on WordPress by downloading wordpress-installable-build-pr17371-2626fc0.apk
|
📲 You can test these changes on Jetpack by downloading jetpack-installable-build-pr17371-2626fc0.apk
|
apply feature flag jetpack_powered_bottom_sheet_remote_field
if (mJetpackBrandingUtils.shouldShowJetpackPoweredBottomSheet() | ||
&& !mBuildConfigWrapper.isJetpackApp() | ||
&& isJetpackInstalled()) { | ||
mGCMMessageHandler.removeAllNotifications(this); |
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.
Once this disables notifications on WordPress
app, does it get reflected in the Notification Settings
view, showing disabled On
flag?
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.
Good point. this PR is only aimed at testing the disabling notifications actually works for now.
Turn off switch on Notifications Settings screen
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.
Thanks, Ravi! This only removed received notifications when the WordPress app is launched. We will prevent receiving new WP notifications. But there is a case that users can install the Jetpack app when they already have received WP notifications. This PR handles only this case, right?
The function works on my test. 👍🏻 I just commented for some code changes.
WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java
Outdated
Show resolved
Hide resolved
Updating implementation to use BroadcastReceiver to disable notifications
Remove initial implementation in favour of BroadcastReceiver
@irfano - I've updated the implementation to use a BroadcastReceiver to trigger this from Jetpack app, after install, login, and when in the welcome flow. wdyt? This approach has advantage of removing the need for detecting Jetpack app install, login, and inform steps. Welcome flow is still in the works, till then we can hook this somewhere on the Jetpack app side temporarily to test it out. Updated instructions in the description |
Remove unnecessary injected class
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.
Looks great! This is a clever solution. 👏🏻
I tested sending broadcast, and it worked. The notification switch was turned off successfully. But while testing, I couldn't receive push notifications for WP, even when the switch was on. I'll test it again.
...ress/src/main/java/org/wordpress/android/ui/mysite/jetpackbadge/JetpackAppInstallReceiver.kt
Outdated
Show resolved
Hide resolved
...ress/src/main/java/org/wordpress/android/ui/mysite/jetpackbadge/JetpackAppInstallReceiver.kt
Outdated
Show resolved
Hide resolved
Great news! iOS and Android solutions could pretty much match then. We can even align on conditions when to trigger this from Jetpack app 👍 |
removed TODO for detekt
This receiver will be used only in WordPress app.
…on-JP-Install # Conflicts: # WordPress/src/wordpress/AndroidManifest.xml
|
I tried something like this earlier
|
If an instance of JP is detected then disable push notifications for WP to prevent double notifications
signature
, otherwisenormal
in a separate PRTo test:
Test 1:
Test 2:
adb shell am broadcast -p org.wordpress.android.prealpha -a org.wordpress.android.broadcast.DISABLE_NOTIFICATIONS
command (Welcome flow is still in the works, till then use command line to test it on WP side)Action: org.wordpress.android.broadcast.DISABLE_NOTIFICATIONS
is displayed in a toast message on the app. The same can be seen in the Logcat in ASNOTE: this doesn't cover any local notifications e.g. WeeklyRoundup
Regression Notes
Potential unintended areas of impact
None
What I did to test those areas of impact (or what existing automated tests I relied on)
Tested manually
What automated tests I added (or what prevented me from doing so)
Existing tests
PR submission checklist:
RELEASE-NOTES.txt
if necessary.