1
4
Fork
You've already forked android-example
2

WIP: Add QR Code to Send Push Messages from an external device #2

Draft
maximiliangalanis wants to merge 5 commits from maximiliangalanis/android-example:add_qr_code into main
pull from: maximiliangalanis/android-example:add_qr_code
merge into: UnifiedPush:main
UnifiedPush:main
UnifiedPush:dev
First-time contributor
Copy link

This adds a button that shows a QR code containing the subscription information necessary to use the subscription: the URL endpoint and the vapid authorization header.

This adds a button that shows a QR code containing the subscription information necessary to use the subscription: the URL endpoint and the vapid authorization header.
maximiliangalanis changed title from (削除) Add QR Code to Send Push Messages from an external device (削除ここまで) to WIP: Add QR Code to Send Push Messages from an external device 2025年01月17日 14:42:19 +01:00
Author
First-time contributor
Copy link

It works already. I would appreciate feedback on the implementation :)

It works already. I would appreciate feedback on the implementation :)
Owner
Copy link

Thanks !

A few things about the implementation:

  • We don't need to store the vapid header in the shared prefs, we just call the getVapidHeader when we need it
  • We don't need to introduce a parameter to force a new header (createNew). I think you have done it to avoid getting the one in cache ? The VAPID header is valid for 12h, and cached for 5min, so it is not important if we get the cached one (it will still be valid for almost 12h)

Regarding the content of the QR code, maybe it can be an URL taking the required elements in the fragment part, for instance:
https://example.unifiedpush.org/#endpoint=http://endpoint&p256dh=aa&auth=aa&vapid=aaaa

Thanks ! A few things about the implementation: - We don't need to store the vapid header in the shared prefs, we just call the getVapidHeader when we need it - We don't need to introduce a parameter to force a new header (`createNew`). I think you have done it to avoid getting the one in cache ? The VAPID header is valid for 12h, and cached for 5min, so it is not important if we get the cached one (it will still be valid for almost 12h) Regarding the content of the QR code, maybe it can be an URL taking the required elements in the fragment part, for instance: https://example.unifiedpush.org/#endpoint=http://endpoint&p256dh=aa&auth=aa&vapid=aaaa
Owner
Copy link
@maximiliangalanis We can use https://unifiedpush.org/test_wp.html for the QR code ! https://unifiedpush.org/test_wp.html#endpoint=ENDPOINT&auth=AUTH&p256dh=PUBKEY and you can add &vapid=authorization header
Owner
Copy link

I've added the link to the app: c7e90ea5c5

I've added the link to the app: https://codeberg.org/UnifiedPush/android-example/commit/c7e90ea5c5a3cc64e34548b2be3bea4aa92904cc
Some checks failed
ci/woodpecker/pr/main Pipeline failed
This pull request has changes conflicting with the target branch.
  • app/build.gradle
  • app/src/main/java/org/unifiedpush/example/ApplicationServer.kt
  • app/src/main/java/org/unifiedpush/example/activities/ui/CheckUi.kt
  • app/src/main/java/org/unifiedpush/example/activities/ui/CheckUiState.kt
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u add_qr_code:maximiliangalanis-add_qr_code
git switch maximiliangalanis-add_qr_code

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff maximiliangalanis-add_qr_code
git switch maximiliangalanis-add_qr_code
git rebase main
git switch main
git merge --ff-only maximiliangalanis-add_qr_code
git switch maximiliangalanis-add_qr_code
git rebase main
git switch main
git merge --no-ff maximiliangalanis-add_qr_code
git switch main
git merge --squash maximiliangalanis-add_qr_code
git switch main
git merge --ff-only maximiliangalanis-add_qr_code
git switch main
git merge maximiliangalanis-add_qr_code
git push origin main
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
UnifiedPush/android-example!2
Reference in a new issue
UnifiedPush/android-example
No description provided.
Delete branch "maximiliangalanis/android-example:add_qr_code"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?