Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
firefox-android
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
The Tor Project
Applications
firefox-android
Commits
068e68e8
Verified
Commit
068e68e8
authored
Dec 4, 2023
by
Tarik Eshaq
Committed by
ma1
Dec 14, 2023
Browse files
Options
Downloads
Patches
Plain Diff
Bug 1865488: Adds server parameter to push subscription
(cherry picked from commit
f66bc9d4
)
parent
af11e480
Branches
Branches containing commit
Tags
firefox-android-115.2.1-13.5-1-build3
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
fenix/app/src/main/java/org/mozilla/fenix/push/WebPushEngineIntegration.kt
+5
-10
5 additions, 10 deletions
...n/java/org/mozilla/fenix/push/WebPushEngineIntegration.kt
with
5 additions
and
10 deletions
fenix/app/src/main/java/org/mozilla/fenix/push/WebPushEngineIntegration.kt
+
5
−
10
View file @
068e68e8
...
...
@@ -58,8 +58,6 @@ internal class WebPushEngineDelegate(
private
val
logger
=
Logger
(
"WebPushEngineDelegate"
)
override
fun
onGetSubscription
(
scope
:
String
,
onSubscription
:
(
WebPushSubscription
?)
->
Unit
)
{
// We don't have the appServerKey unless an app is creating a new subscription so we
// allow the key to be null since it won't be overridden from a previous subscription.
pushFeature
.
getSubscription
(
scope
)
{
onSubscription
(
it
?.
toEnginePushSubscription
())
}
...
...
@@ -72,9 +70,7 @@ internal class WebPushEngineDelegate(
)
{
pushFeature
.
subscribe
(
scope
=
scope
,
// See the full note at the implementation of `toEnginePushSubscription`.
// Issue: https://github.com/mozilla/application-services/issues/2698
appServerKey
=
null
,
appServerKey
=
serverKey
?.
toEncodedBase64String
(),
onSubscribeError
=
{
logger
.
error
(
"Error on push onSubscribe."
)
onSubscribe
(
null
)
...
...
@@ -104,13 +100,12 @@ internal fun AutoPushSubscription.toEnginePushSubscription() = WebPushSubscripti
publicKey
=
this
.
publicKey
.
toDecodedByteArray
(),
endpoint
=
this
.
endpoint
,
authSecret
=
this
.
authKey
.
toDecodedByteArray
(),
// We don't send the `serverKey` because the code path from that will query
// the push database for this key, which leads to an exception thrown.
// Our workaround for now is to not put the server key in to begin with (which
// will probably break a lot of sites).
// See: https://github.com/mozilla/application-services/issues/2698
// We don't have the appServerKey unless an app is creating a new subscription so we
// allow the key to be null since it won't be overridden from a previous subscription.
appServerKey
=
null
,
)
private
fun
String
.
toDecodedByteArray
()
=
Base64
.
decode
(
this
.
toByteArray
(),
Base64
.
URL_SAFE
or
Base64
.
NO_PADDING
or
Base64
.
NO_WRAP
)
private
fun
ByteArray
.
toEncodedBase64String
()
=
Base64
.
encodeToString
(
this
,
Base64
.
URL_SAFE
or
Base64
.
NO_PADDING
or
Base64
.
NO_WRAP
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment