Android push notifications with PassWallet#40
Open
mandyJ wants to merge 12 commits intocoorasse:mainfrom
Open
Conversation
added 2 commits
April 22, 2025 15:33
annaswims
reviewed
Apr 23, 2025
| end | ||
|
|
||
| def register_device | ||
| device = Passkit::Device.find_or_create_by!(identifier: params[:device_id]) { |d| d.push_token = push_token } |
Contributor
There was a problem hiding this comment.
In the previous version, no changes are made to the db a device is found. Now, the device is being updated every time.
Maybe like this to back fill missing push_service_url?
device = Passkit::Device.find_or_create_by!(identifier: params[:device_id]) do |d|
d.push_service_url = push_service_url
d.push_token = push_token
end
device.update(push_service_url: push_service_url) if device.push_service_url.blank?
annaswims
reviewed
Apr 23, 2025
| def push_service_url | ||
| return unless request&.body | ||
|
|
||
| request.body.rewind |
Contributor
There was a problem hiding this comment.
This looks fairly atypical. Can you not acccess it with params["pushServiceUrl"]?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for Android push notifications using PassWallet.
It adds the registration endpoint called by PassWallet;
Adds a migration to add a
pushServiceUrlcolumn to the Devices table;Registers an Android device with its
pushServiceUrl. The presence of a pushServiceUrl indicates if the device is Android vs iOS.If iOS, a library like apnotic can be used to send an Apple Push Notification, as demonstrated here
if Android, a POST request can be made to the pushServiceUrl as laid out by PassWallet documentation.
Why PassWallet?
While coorasse/passkit defaults to WalletPasses to open the Apple wallet format (.pkpass) on Android, I have found that WalletPasses does not support the multiple pass format (.pkpasses), but PassWallet does.
PassWallet supports adding passes by adding from file storage on the mobile device, which has made development a lot easier; PassWallet appears to be more feature rich in general compared to WalletPasses.
I also found the PassWallet developer documentation to be more descriptive: https://github.com/Kwiket/passwallet
compared to WalletPasses: https://walletpasses.io/developer/