-
Notifications
You must be signed in to change notification settings - Fork 135
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
Issue/12539 blaze push notification navigation #12564
Issue/12539 blaze push notification navigation #12564
Conversation
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
import com.woocommerce.android.extensions.compactNumberCompat as compactNumberCompatExt | ||
|
||
class NumberExtensionsWrapper @Inject constructor() { | ||
fun compactNumberCompat( | ||
number: Long, | ||
locale: Locale = Locale.getDefault() | ||
): String = compactNumberCompat(number, locale) | ||
): String = compactNumberCompatExt(number, locale) | ||
} |
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.
Unrelated to the PR sorry. Had to manually update this so I could prevent the app from crashing due to this: #12554
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 hope that merging trunk
later will get rid of this, it would be better to keep a clean Git history.
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.
Nice work @JorgeMucientes.
I left a comment about a minor concern, but it's not a blocking one, so I'm pre-approving.
val isBlazeNotification = noteType == WooNotificationType.BLAZE_APPROVED_NOTE || | ||
noteType == WooNotificationType.BLAZE_REJECTED_NOTE || | ||
noteType == WooNotificationType.BLAZE_CANCELLED_NOTE || | ||
noteType == WooNotificationType.BLAZE_PERFORMED_NOTE |
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.
Just a suggestion for a future improvement: can't we improve the API a bit if we convert WooNotificationType
to be a sealed interface instead of an enum
? I think if we do so we'll have a common parent for Blaze notification types.
loadCampaigns(offset = 0) | ||
if (navArgs.campaignId != null) { | ||
onCampaignClicked(navArgs.campaignId!!) | ||
} |
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 have two minor concerns with this:
- We won't show the campaign details until
loadCampaigns
finish, which could take a while depending on the internet speed. onCampaignClicked
will trackblaze_campaign_detail_selected
, and I'm not sure this is valid for this case, as the event is coming from the notification.
For both of these issues, I suggest:
- Move the logic outside of the
launch
to trigger instantly without waiting for the campaigns to load. - (1) alone will cause an issue, because
navigateSafely
will skip the event due to the throttle logic we have, so we'll need another change: update theShowCampaignDetails
event to differentiate push events and for them passskipThrottling
astrue
in thenavigateSafely
call.
I experimented with this, and the result is an instant display of the details:
Before | After |
---|---|
before.mp4 |
after.mp4 |
WDYT?
import com.woocommerce.android.extensions.compactNumberCompat as compactNumberCompatExt | ||
|
||
class NumberExtensionsWrapper @Inject constructor() { | ||
fun compactNumberCompat( | ||
number: Long, | ||
locale: Locale = Locale.getDefault() | ||
): String = compactNumberCompat(number, locale) | ||
): String = compactNumberCompatExt(number, locale) | ||
} |
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 hope that merging trunk
later will get rid of this, it would be better to keep a clean Git history.
…ion-navigation # Conflicts: # build.gradle
Found 1 violations: The PR caused the following dependency changes:expand
-+--- org.wordpress:fluxc:2.95.0
-| +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.25
-| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 (*)
-| | \--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.9.25
-| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 (*)
-| +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.6
-| | \--- androidx.annotation:annotation:1.2.0 -> 1.8.0 (*)
-| +--- androidx.security:security-crypto:1.0.0 -> 1.1.0-alpha03
-| | +--- androidx.annotation:annotation:1.1.0 -> 1.8.0 (*)
-| | +--- com.google.crypto.tink:tink-android:1.5.0
-| | \--- androidx.collection:collection:1.1.0 -> 1.4.0 (*)
-| +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0
-| | +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
-| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.9.10 (*)
-| +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
-| +--- org.apache.commons:commons-text:1.10.0 (*)
-| +--- androidx.room:room-runtime:2.6.1 (*)
-| +--- androidx.room:room-ktx:2.6.1
-| | +--- androidx.room:room-common:2.6.1 (*)
-| | +--- androidx.room:room-runtime:2.6.1 (*)
-| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.25 (*)
-| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.8.1 (*)
-| | +--- androidx.room:room-common:2.6.1 (c)
-| | \--- androidx.room:room-runtime:2.6.1 (c)
-| +--- com.google.dagger:dagger:2.51.1
-| | \--- javax.inject:javax.inject:1
-| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
-| +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 (*)
-| +--- org.wordpress:wellsql:2.0.0
-| | +--- androidx.annotation:annotation:1.2.0 -> 1.8.0 (*)
-| | \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
-| +--- org.wordpress.fluxc:fluxc-annotations:2.95.0
-| +--- org.greenrobot:eventbus-java:3.3.1
-| +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
-| +--- com.android.volley:volley:1.1.1 -> 1.2.0
-| +--- androidx.paging:paging-runtime:2.1.2
-| | +--- androidx.paging:paging-common:2.1.2
-| | | +--- androidx.annotation:annotation:1.0.0 -> 1.8.0 (*)
-| | | \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
-| | +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
-| | +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.7.0 (*)
-| | +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.7.0 (*)
-| | \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.2 (*)
-| +--- com.goterl:lazysodium-android:5.0.2
-| +--- net.java.dev.jna:jna:5.5.0
-| \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 (*)
++--- org.wordpress:fluxc:trunk-884fbb8e16259765bb490127476813962e92a113
+| +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.25
+| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 (*)
+| | \--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.9.25
+| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 (*)
+| +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.6
+| | \--- androidx.annotation:annotation:1.2.0 -> 1.8.0 (*)
+| +--- androidx.security:security-crypto:1.0.0 -> 1.1.0-alpha03
+| | +--- androidx.annotation:annotation:1.1.0 -> 1.8.0 (*)
+| | +--- com.google.crypto.tink:tink-android:1.5.0
+| | \--- androidx.collection:collection:1.1.0 -> 1.4.0 (*)
+| +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0
+| | +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
+| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.9.10 (*)
+| +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+| +--- org.apache.commons:commons-text:1.10.0 (*)
+| +--- androidx.room:room-runtime:2.6.1 (*)
+| +--- androidx.room:room-ktx:2.6.1
+| | +--- androidx.room:room-common:2.6.1 (*)
+| | +--- androidx.room:room-runtime:2.6.1 (*)
+| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.25 (*)
+| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.8.1 (*)
+| | +--- androidx.room:room-common:2.6.1 (c)
+| | \--- androidx.room:room-runtime:2.6.1 (c)
+| +--- com.google.dagger:dagger:2.51.1
+| | \--- javax.inject:javax.inject:1
+| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
+| +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 (*)
+| +--- org.wordpress:wellsql:2.0.0
+| | +--- androidx.annotation:annotation:1.2.0 -> 1.8.0 (*)
+| | \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
+| +--- org.wordpress.fluxc:fluxc-annotations:trunk-884fbb8e16259765bb490127476813962e92a113
+| +--- org.greenrobot:eventbus-java:3.3.1
+| +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.12.0 (*)
+| +--- com.android.volley:volley:1.1.1 -> 1.2.0
+| +--- androidx.paging:paging-runtime:2.1.2
+| | +--- androidx.paging:paging-common:2.1.2
+| | | +--- androidx.annotation:annotation:1.0.0 -> 1.8.0 (*)
+| | | \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
+| | +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
+| | +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.7.0 (*)
+| | +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.7.0 (*)
+| | \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.3.2 (*)
+| +--- com.goterl:lazysodium-android:5.0.2
+| +--- net.java.dev.jna:jna:5.5.0
+| \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 (*)
-\--- org.wordpress.fluxc.plugins:woocommerce:2.95.0
- +--- org.wordpress:fluxc:2.95.0 (*)
- +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
- +--- com.google.dagger:dagger:2.51.1 (*)
- +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
- +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 (*)
- +--- androidx.room:room-runtime:2.6.1 (*)
- +--- org.wordpress:wellsql:2.0.0 (*)
- +--- org.wordpress.fluxc:fluxc-annotations:2.95.0
- +--- androidx.room:room-ktx:2.6.1 (*)
- \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 (*)
+\--- org.wordpress.fluxc.plugins:woocommerce:trunk-884fbb8e16259765bb490127476813962e92a113
+ +--- org.wordpress:fluxc:trunk-884fbb8e16259765bb490127476813962e92a113 (*)
+ +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+ +--- com.google.dagger:dagger:2.51.1 (*)
+ +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1 (*)
+ +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1 (*)
+ +--- androidx.room:room-runtime:2.6.1 (*)
+ +--- org.wordpress:wellsql:2.0.0 (*)
+ +--- org.wordpress.fluxc:fluxc-annotations:trunk-884fbb8e16259765bb490127476813962e92a113
+ +--- androidx.room:room-ktx:2.6.1 (*)
+ \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.25 (*)
Please review and act accordingly
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #12564 +/- ##
============================================
+ Coverage 40.61% 40.62% +0.01%
- Complexity 5665 5669 +4
============================================
Files 1228 1228
Lines 68917 68944 +27
Branches 9544 9549 +5
============================================
+ Hits 27991 28010 +19
- Misses 38354 38357 +3
- Partials 2572 2577 +5 ☔ View full report in Codecov by Sentry. |
Thanks for the feedback @hichamboushaba, I've addressed the main concerns. About the possible API improvement of converting the Will proceed to merge this now. |
Closes: #12539
Description
When a Blaze campaign status update push notification is received upon tapping on it:
Testing information
20.2
version of the app and Blaze push notifications are enabled)Repeat the steps above to generate at least 2 Blaze push notifications (tip:cancelling/Stopping the campaign from the detail screen webview will also trigger a push notification)
Finally, the smoke test will be done to ensure that new order notifications and product review notifications work as expected.
The tests that have been performed
Images/gif
OpenBlazeCampaignDetail.mp4
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.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: