Skip to content
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

[Auth] Add default values for decoding nil properties in UserInfoImpl #14185

Merged
merged 6 commits into from
Nov 28, 2024

Conversation

ncooke3
Copy link
Member

@ncooke3 ncooke3 commented Nov 28, 2024

Address #14011 (comment)

If a UserInfoImpl instance fails to decode, the entire [String: UserInfoImpl] collection (below snippet) will fail to decode, which will make the user.providerData property nil.

let providerData = coder.decodeObject(of: classes, forKey: kProviderDataKey)
as? [String: UserInfoImpl]

The below snippet is the GetAccountInfoResponseProviderUserInfo response object for an account with email and phone providers enabled. The phone provider does not have a federatedID and therefore its corresponding UserInfoImpl instance does not have a uid. It's possible a more useful default could be given, but will have to further investigate this. cc: @Xiaoshouzi-gh

Screenshot 2024-11-27 at 7 09 59 PM

Falling back to "" is slightly safer than the ObjC implementation, that would bridge to an implicit nil because of UserInfo's non-null uid interface (UserInfoImpl conforms to UserInfo).

Copy link
Member

@paulb777 paulb777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Would you update the release note to say this part of the fix will be in the 11.6.0 source distros and 11.7.0 binary distros

FirebaseAuth/CHANGELOG.md Outdated Show resolved Hide resolved
FirebaseAuth/CHANGELOG.md Outdated Show resolved Hide resolved
FirebaseAuth/CHANGELOG.md Outdated Show resolved Hide resolved
FirebaseAuth/CHANGELOG.md Outdated Show resolved Hide resolved
@ncooke3 ncooke3 enabled auto-merge (squash) November 28, 2024 00:24
@ncooke3 ncooke3 merged commit 2e02253 into main Nov 28, 2024
66 of 67 checks passed
@ncooke3 ncooke3 deleted the nc/fix-userimpl-2 branch November 28, 2024 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants