Skip to content

Commit

Permalink
Exposing additional swift calls to objective c (#342)
Browse files Browse the repository at this point in the history
* Exposed additional swift calls to objective c
  • Loading branch information
npalethorpe authored and Widcket committed Jan 23, 2020
1 parent ce6311c commit d70e857
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Auth0/_ObjectiveAuthenticationAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ public class _ObjectiveAuthenticationAPI: NSObject {
.start(handleResult(callback: callback))
}

@objc(loginWithUsernameOrEmail:password:realm:audience:scope:parameters:callback:)
// swiftlint:disable:next function_parameter_count
public func login(withUsernameOrEmail username: String, password: String, realm: String, audience: String, scope: String, parameters: [String: Any]?, callback: @escaping (NSError?, Credentials?) -> Void) {
self.authentication
.login(usernameOrEmail: username, password: password, realm: realm, audience: audience, scope: scope, parameters: parameters ?? [:])
.start(handleResult(callback: callback))
}

@objc(createUserWithEmail:username:password:connection:userMetadata:callback:)
// swiftlint:disable:next function_parameter_count
public func createUser(withEmail email: String, username: String?, password: String, connection: String, userMetadata: [String: Any]?, callback: @escaping (NSError?, [String: Any]?) -> Void) {
Expand All @@ -70,6 +78,20 @@ public class _ObjectiveAuthenticationAPI: NSObject {
}
}

#if canImport(UIKit)
@objc(resumeAuthWithURL:options:)
public static func resume(_ url: URL, options: [A0URLOptionsKey: Any]) -> Bool {
return resumeAuth(url, options: options)
}
#endif

@objc(renewWithRefreshToken:scope:callback:)
public func renew(WithRefreshToken refreshToken: String, scope: String, callback: @escaping (NSError?, Credentials?) -> Void) {
self.authentication
.renew(withRefreshToken: refreshToken, scope: scope)
.start(handleResult(callback: callback))
}

@objc(resetPasswordWithEmail:connection:callback:)
public func resetPassword(withEmail email: String, connection: String, callback: @escaping (NSError?) -> Void) {
self.authentication
Expand Down

0 comments on commit d70e857

Please sign in to comment.