123456789101112131415161718192021222324252627282930313233343536 |
- //
- // KMLoginManager.swift
- // PDF Reader Pro
- //
- // Created by lizhe on 2023/8/11.
- //
- import Foundation
- typealias KMLoginCompletion = (_ isSuccess: Bool, _ error: KMAppleLoginErrorType) -> Void
- enum KMLoginInputType: Int, CaseIterable {
- case apple = 0
- case google = 1
- }
- class KMLoginManager: NSObject {
- static let manager = KMLoginManager()
-
- private var loginCompletion: KMLoginCompletion?
- }
- extension KMLoginManager {
- func login(_ inputType: KMLoginInputType, _ completion: @escaping KMLoginCompletion) {
- self.loginCompletion = completion
-
- if inputType == .apple {
- KMAppleLoginManager.manager.login { [weak self] user, token, error in
- if token.count != 0 {
- guard let callBack = self?.loginCompletion else { return }
- callBack(true, .unknown)
- }
- }
- }
- }
- }
|