Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yllfejziu committed May 10, 2024
1 parent 1681911 commit fe280ce
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,13 @@ let manager = SocialAuthenticationManager(authenticators: [AppleAuthenticator(),

// signIn user with Apple
let appleAuthenticator = manager.authenticator(for: AppleAuthenticator.self)
appleAuthenticator?
let result = try await appleAuthenticator?
.signIn(from: <view-controller-instance>, with: .random(length: 32))
.finally {
// handle result
}

// signIn user with Facebook
let facebookAuthenticator = manager.authenticator(for: FacebookAuthenticator.self)
facebookAuthenticator?
let result = try await facebookAuthenticator?
.signIn(from: <view-controller-instance>, with: [.email])
.finally {
// handle result
}

// return currently authenticated authenticator
let authenticated: Authenticator? = manager.authenticator
Expand Down Expand Up @@ -123,19 +117,19 @@ You can easily add new authenticator that is not built-in with PovioKitAuth pack

```swift
final class SnapchatAuthenticator: Authenticator {
public func signIn(from presentingViewController: UIViewController) -> Promise<Response> {
Promise { seal in
public func signIn(from presentingViewController: UIViewController) async throws -> Response {
try await withCheckedThrowingContinuation { continuation in
SCSDKLoginClient.login(from: presentingViewController) { [weak self] success, error in
guard success, error == nil else {
seal.reject(with: error)
continuation.resume(throwing: error)
return
}

let query = "{me{displayName, bitmoji{avatar}}}"
let variables = ["page": "bitmoji"]
SCSDKLoginClient.fetchUserData(withQuery: query, variables: variables) { resources in
...
seal.resolve(with: response)
continuation.resume(returning: response)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Apple/AppleAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ public final class AppleAuthenticator: NSObject {
extension AppleAuthenticator: Authenticator {
/// SignIn user
///
/// Will asynchronously return the `Response` object on success or with `Error` on error.
/// Will asynchronously return the `Response` object on success or `Error` on error.
public func signIn(from presentingViewController: UIViewController) async throws -> Response {
try await appleSignIn(on: presentingViewController, with: nil)
}

/// SignIn user with `nonce` value
///
/// Nonce is usually needed when doing auth with an external auth provider (e.g. firebase).
/// Will asynchronously return the `Response` object on success or with `Error` on error.
/// Will asynchronously return the `Response` object on success or `Error` on error.
public func signIn(from presentingViewController: UIViewController, with nonce: Nonce) async throws -> Response {
try await appleSignIn(on: presentingViewController, with: nonce)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Facebook/FacebookAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension FacebookAuthenticator: Authenticator {
/// SignIn user.
///
/// The `permissions` to use when doing a sign in.
/// Will asynchronously return the `Response` object on success or with `Error` on error.
/// Will asynchronously return the `Response` object on success or `Error` on error.
public func signIn(
from presentingViewController: UIViewController,
with permissions: [Permission] = [.email, .publicProfile]) async throws -> Response
Expand Down
2 changes: 1 addition & 1 deletion Sources/Google/GoogleAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public final class GoogleAuthenticator {
extension GoogleAuthenticator: Authenticator {
/// SignIn user.
///
/// Will asynchronously return the `Response` object on success or with `Error` on error.
/// Will asynchronously return the `Response` object on success or `Error` on error.
public func signIn(from presentingViewController: UIViewController,
hint: String? = .none,
additionalScopes: [String]? = .none) async throws -> Response {
Expand Down
2 changes: 1 addition & 1 deletion Sources/LinkedIn/LinkedInAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public final class LinkedInAuthenticator {
extension LinkedInAuthenticator: Authenticator {
/// SignIn user.
///
/// Will return promise with the `Response` object on success or with `Error` on error.
/// Will asynchronously return the `Response` object on success or `Error` on error.
public func signIn(authCode: String, configuration: Configuration) async throws -> Response {
let authRequest: LinkedInAPI.LinkedInAuthRequest = .init(
code: authCode,
Expand Down

0 comments on commit fe280ce

Please sign in to comment.