-
Notifications
You must be signed in to change notification settings - Fork 231
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
Method to check native auth availability for provider in the device #104
Conversation
Auth0/AuthProvider.swift
Outdated
/** | ||
Extension to provide default(s) | ||
*/ | ||
public extension AuthProvider { |
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.
It's a bit bad to use protocol extensions for default implementations
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.
Originally I didn't have a default as felt it's important for developers implementing to understand what it did. Then I thought the most common use case (based on our use case) would be true
so perhaps this is a convenience. So i'll go back to original thoughts 👍
Auth0/AuthProvider.swift
Outdated
|
||
- returns: Bool | ||
*/ | ||
func canUseNative() -> Bool |
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.
why not something more common like isAvailable()
or available
prop both static. Also the comment is a bit misleading since we are dealing Auth providers so something like
Determine if the Auth method used by the Provider is available in the device. e.g. if using a Twitter Auth provider it should check the presence of a Twitter account in the device.
If a Auth is performed on a provider that returns `false` the transaction will fail with an error
- returns: Bool if the AuthProvider is available on the device
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.
Thx, amusingly I did call it isAvailable()
originally then got conflicted looking at naming in v1 twitter. Should have stuck with original name 👍
cc1f362
to
55370b9
Compare
Update for deprecation in SwiftLint config and added exclusion for Public enum naming
@hzalaz SwiftLint now at 0.17, I've updated in this PR as was failing on Circle CI. Only area of question here is https://github.com/auth0/Auth0.swift/blob/added-nativeauth-available/Auth0/Authentication.swift#L437 Not sure why SwiftLint is only mentioning this now that enum should be lower case, although the enum is actually mixed case as we have |
This is required to ensure the correct auth method can be selected for Native Plugins in situations where the native pathway becomes unavailable.