Support GZIP compressed JSON string as push notification payload#56154
Conversation
|
@dominictb Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Verify HybridApp build check is failing in this PR with the next error: It doesn't look like it's related to this PR, I saw something similar in others as well. |
|
Can you merge main please? We've fixed this |
|
Looks like it's not fixed 😄 - I will now |
|
Any updates on this PR? |
|
@dominictb It's ready for your review! Besides that, we are waiting for @arosiclair to test it over BE changes, more info here. |
Yup you can code review and test normal uncompressed push notifications to ensure those are still handled correctly. I'll update when I can start testing with backend changes. |
|
Cool. Can you merge main please @VickyStash? |
|
@dominictb Done! |
| app: 'new', | ||
| }; | ||
| // gzip compressed json string | ||
| const compressedPayloadWithOnyxData = |
There was a problem hiding this comment.
Can we perform compression of the payloadWithOnyxData above instead of hard-coding this value?
There was a problem hiding this comment.
The app doesn't do gzip compression. I'm not sure we should add this functionality just for the mocked data.
| import java.util.zip.GZIPInputStream | ||
|
|
||
| class PayloadHandler { | ||
| private val BUFFER_SIZE = 4096 |
There was a problem hiding this comment.
- Where does this
BUFFER_SIZEvalue come from? Is it the 4KB notification limit constraint? - What if the input stream size exceeds 4KB? I know we're trying to not let that happen in the BE but just "what if".
There was a problem hiding this comment.
Yeah, in this case 4KB is a notification payload size limit.
What if the input stream size exceeds 4KB?
Hm, I'm not sure if it's possible since it's the limitation on the Apple Push Notification service (APNs) / Android's Firebase Cloud Messaging (FCM) level
Reviewer Checklist
Screenshots/VideosAndroid: mWeb ChromeiOS: NativeScreen.Recording.2025-02-20.at.00.22.30-compressed.moviOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2025-02-19.at.21.48.59-compressed.mov |
|
@VickyStash can you pull main please? I pushed some changes that fix iOS build issues recently. |
|
|
# Conflicts: # package-lock.json # package.json
|
|
Done! |
|
Great work on this, @VickyStash and @adhorodyski! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/arosiclair in version: 9.1.4-0 🚀
|
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 9.1.4-4 🚀
|





Explanation of Change
This PR updates push notifications payload processing to support GZIP compressed JSON string.
Fixed Issues
$ #54820
PROPOSAL: N/A
MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/13406
Tests
iOS
.apnsfile.Example:
Drag-n-drop the
.apnsfile into simulator to simulate a push notification. Check the xcode logs - you should see that the push notification was received and the app tried to apply the onyx data provided in the payload.Example:
Android:
After the updates are done - rebuild the app.
Once it’s running you should see the log with processed payload in the Logcat in Android studio.
Web/Desktop:
parsePushNotificationPayloadfunction are covered by unit tests.Offline tests
N/A
QA Steps
Make sure push notifications are working the same way as before.
You can trigger push notifications by:
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android_old.mp4
iOS: Native
ios_gzip.mp4
ios_old.mp4
MacOS: Chrome / Safari
MacOS: Desktop