-
Notifications
You must be signed in to change notification settings - Fork 3.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
Support GZIP compressed JSON string as push notification payload #56154
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we perform compression of the payloadWithOnyxData
above instead of hard-coding this value?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Where does this
BUFFER_SIZE
value 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
🎀👀🎀
@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
.apns
file.Example:
Drag-n-drop the
.apns
file 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:
parsePushNotificationPayload
function 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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android_old.mp4
iOS: Native
ios_gzip.mp4
ios_old.mp4
MacOS: Chrome / Safari
MacOS: Desktop