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

Method to check native auth availability for provider in the device #104

Merged
merged 3 commits into from
Mar 27, 2017

Conversation

cocojoe
Copy link
Member

@cocojoe cocojoe commented Mar 22, 2017

This is required to ensure the correct auth method can be selected for Native Plugins in situations where the native pathway becomes unavailable.

/**
Extension to provide default(s)
*/
public extension AuthProvider {
Copy link
Member

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

Copy link
Member Author

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 👍


- returns: Bool
*/
func canUseNative() -> Bool
Copy link
Member

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

Copy link
Member Author

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 👍

@hzalaz hzalaz added this to the v1-Next milestone Mar 24, 2017
@hzalaz hzalaz changed the title Added protocol method to check native auth availability for provider Method to check native auth availability for provider in the device Mar 24, 2017
Update for deprecation in SwiftLint config and added exclusion for Public enum naming
@cocojoe
Copy link
Member Author

cocojoe commented Mar 27, 2017

@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.iOSLink. This should really be updated to all lower case however it's public API and hence a breaking change, albeit it a rather small one and compiler will suggest the fix.... Thoughts?

@hzalaz hzalaz merged commit fef779c into master Mar 27, 2017
@hzalaz hzalaz deleted the added-nativeauth-available branch March 27, 2017 18:27
@hzalaz hzalaz modified the milestones: v1-Next, 1.5.0 Mar 27, 2017
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.

None yet

2 participants