-
Notifications
You must be signed in to change notification settings - Fork 473
Update to Application Services v73.0.1 #9731
Conversation
@@ -173,7 +173,7 @@ val accountEventsObserver = object : AccountEventsObserver { | |||
override fun onEvents(event: List<AccountEvent>) { | |||
// device received some commands; for example, here's how you can process incoming Send Tab commands: | |||
commands | |||
.filter { it is AccountEvent.IncomingDeviceCommand } | |||
.filter { it is AccountEvent.CommandReceived } |
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.
I had to change the name of this variant for dumb code-gen-related reasons, but I also prefer "command received" because it maps more directly to the of the push notification.
@@ -7,28 +7,28 @@ package mozilla.components.service.fxa | |||
/** | |||
* High-level exception class for the exceptions thrown in the Rust library. | |||
*/ | |||
typealias FxaException = mozilla.appservices.fxaclient.FxaException | |||
typealias FxaException = mozilla.appservices.fxaclient.FxaErrorException |
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.
Name change due to current limitations of bindings generator, which has strong opinions about the name of exception classes.
@@ -104,25 +107,25 @@ fun Profile.into(): mozilla.components.concept.sync.Profile { | |||
) | |||
} | |||
|
|||
internal fun Device.Type.into(): DeviceType { |
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 bindings generated doesn't support these nested namespace things yet, so e.g. Device.Type
is now DeviceType
.
from = this.from?.into(), | ||
entries = this.entries.map { it.into() } | ||
from = this.sender?.into(), | ||
entries = this.payload.entries.map { it.into() } |
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 field names here were different between the Rust code and the hand-written Kotlin wrapper, and now that things are autogenerated they're the same.
ASAccountEvent.IncomingDeviceCommand( | ||
command = IncomingDeviceCommand.TabReceived(testDevice1, arrayOf(testTab1)) | ||
ASAccountEvent.CommandReceived( | ||
command = IncomingDeviceCommand.TabReceived(testDevice1, SendTabPayload(listOf(testTab1), "flowid", "streamid")) |
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 bindings generator uses lists, the a-c code here seems to prefer arrays. I'm not familiar enough with the differences in Kotlin to know under which circumstances the different types should be preferred. Should we invest in making the generated bindings accept an array rather than a list here?
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.
A list should be fine.
Codecov Report
@@ Coverage Diff @@
## master #9731 +/- ##
============================================
- Coverage 74.04% 74.04% -0.01%
Complexity 5655 5655
============================================
Files 773 773
Lines 28766 28764 -2
Branches 4738 4737 -1
============================================
- Hits 21301 21299 -2
Misses 4986 4986
Partials 2479 2479
Continue to review full report at Codecov.
|
84295e5
to
15b1513
Compare
15b1513
to
ff93f47
Compare
ff93f47
to
aebe39c
Compare
@@ -130,7 +130,7 @@ | |||
style="?android:attr/listSeparatorTextViewStyle" | |||
android:text="@string/devices" /> | |||
|
|||
<FragmentContainerView android:name="org.mozilla.samples.sync.DeviceFragment" | |||
<androidx.fragment.app.FragmentContainerView android:name="org.mozilla.samples.sync.DeviceFragment" |
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.
I was getting weird unrelated crashes when trying to build and run the sample app, and Google told me to change this, and it worked. Does this seem familiar to anyone else, and maybe indicate a problem with my local build env?
(I don't think it's related to the changes from this PR, because I was getting the same build issues on a clean checkout of a-c).
aebe39c
to
1f4362d
Compare
@@ -30,7 +30,7 @@ object Versions { | |||
const val disklrucache = "2.0.2" | |||
const val leakcanary = "2.4" | |||
|
|||
const val mozilla_appservices = "72.1.0" | |||
const val mozilla_appservices = "73.0.1" |
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.
One unrelated warning about this release: we have some weird build issues going on with Windows Desktop builds at the moment, ref mozilla/application-services#3917. The -forUnitTests
variant of appservices 73.0.1 does not include a Windows dll, which IIUC means that a-c developers would not be able to run unittests that use appservices code on a Windows host.
It's not clear to me how much of a dealbreaker that is for y'all. I opted to disable Windows builds for this release in order to get something out the door that we can play with, and on the appservices side we're happy to ship a release without them. But, if it's important for a-c or Fenix developers to have this capability, we'll try to followup with a 73.0.2
release that restores them.
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.
Thanks for flagging this, Ryan! Perhaps we can mention this in the changelog as part of this PR, as a temporary (I'm assuming) condition?
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.
I've added an entry to the changelog, with a link to the underlying appservices issue for followup 👍
@@ -29,7 +29,7 @@ import org.mozilla.experiments.nimbus.AvailableRandomizationUnits | |||
import org.mozilla.experiments.nimbus.EnrolledExperiment | |||
import org.mozilla.experiments.nimbus.EnrollmentChangeEvent | |||
import org.mozilla.experiments.nimbus.EnrollmentChangeEventType | |||
import org.mozilla.experiments.nimbus.ErrorException | |||
import org.mozilla.experiments.nimbus.NimbusErrorException |
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.
Oh yeah, you're also getting a new Nimbus release, which had to rename this error class because the name Error
was causing problems with the Swift bindings.
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.
Aside from the detekt lint about UndocumentedPublicFunction
in the Types.kt file, this looks good to me.
They were like that when I got here, I swear! 😅 Seriously though, I don't really understand why my changes triggered this lint, but I'll add some docs for completeness. |
1f4362d
to
459c4b6
Compare
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.
Thank you!
@@ -30,7 +30,7 @@ object Versions { | |||
const val disklrucache = "2.0.2" | |||
const val leakcanary = "2.4" | |||
|
|||
const val mozilla_appservices = "72.1.0" | |||
const val mozilla_appservices = "73.0.1" |
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.
Thanks for flagging this, Ryan! Perhaps we can mention this in the changelog as part of this PR, as a temporary (I'm assuming) condition?
@@ -144,7 +144,7 @@ class FirefoxAccount internal constructor( | |||
accessType: AccessType | |||
) = withContext(scope.coroutineContext) { | |||
handleFxaExceptions(logger, "authorizeOAuthCode", { null }) { | |||
val params = AuthorizationParams(clientId, scopes, state, accessType.msg) | |||
val params = AuthorizationParameters(clientId, scopes.toList(), state, accessType.msg, null, null, null) |
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.
slightly offtopic for this PR, and we already discussed this in slack: it took me a bit of clicking around to figure out that the missing params here are for the PKCE code exchange. I think it's only documented at https://github.com/mozilla/application-services/blob/d77600e32c19cbeebaf1045a1b9b49476530e770/components/fxa-client/src/internal/oauth.rs#L194
Also, filed #9863 to remove this from the API surface for now.
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.
I guess we could use named argument syntax here to make things bit clearer, e.g. AuthorizationParameters(..., pkceParams=null, keysJwk=null)
.
I also expect a future release to support default values for these arguments which might help clean it up a bit more.
459c4b6
to
bb8544e
Compare
This pull request has conflicts when rebasing. Could you fix it @rfk? 🙏 |
This release includes new auto-generated Kotlin bindings for the FxA Client component, which come with a few breaking API changes. There should be no changes in functionality though.
bb8544e
to
afa1a71
Compare
Update: The new version of Application Services has been released and it includes auto-generated bindings for the fxaclient component. This PR updates the appservices version and provides the necessary tweaks for API changes.
I've tested this manually in a local build of Fenix and account- and send-tab-related functionality seems to be working well.
--
Over in mozilla/application-services#3876 I'm working on a significant restructure of the
fxa-client
Rust component, aiming to use our new bindings-generation tool to replace a bunch of hand-written code. This PR captures the corresponding a-c changes to adapt to the minor API differences between authgenerated and hand-written code.It's not appropriate to merge yet, but I wanted to push it for early visible and feedback, particularly if any of the changes here seem like the sort of thing we should not be doing. /cc @grigoryk @jonalmeida