删除非必要代码
This commit is contained in:
parent
17068cb7e4
commit
24b57a88f6
@ -1,70 +0,0 @@
|
|||||||
//
|
|
||||||
// SPLoginManager+Apple.swift
|
|
||||||
// MoviaBox
|
|
||||||
//
|
|
||||||
// Created by 佳尔 on 2025/4/25.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import AuthenticationServices
|
|
||||||
|
|
||||||
|
|
||||||
extension SPLoginManager {
|
|
||||||
|
|
||||||
///苹果登录
|
|
||||||
func appleSignLogin(completer: ((_ model: SPThirdSignModel?) -> Void)?) {
|
|
||||||
// self.signAppleHandle = completer
|
|
||||||
|
|
||||||
let appleIDProvider = ASAuthorizationAppleIDProvider()
|
|
||||||
let request = appleIDProvider.createRequest()
|
|
||||||
request.requestedScopes = [.fullName, .email]
|
|
||||||
|
|
||||||
let authorizationController = ASAuthorizationController(authorizationRequests: [request])
|
|
||||||
authorizationController.delegate = self
|
|
||||||
authorizationController.presentationContextProvider = self
|
|
||||||
authorizationController.performRequests()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//MARK:-------------- ASAuthorizationControllerDelegate --------------
|
|
||||||
extension SPLoginManager: ASAuthorizationControllerDelegate {
|
|
||||||
|
|
||||||
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
|
|
||||||
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
|
|
||||||
|
|
||||||
let userIdentifier = appleIDCredential.user
|
|
||||||
let fullName = appleIDCredential.fullName
|
|
||||||
let email = appleIDCredential.email
|
|
||||||
|
|
||||||
let model = SPThirdSignModel()
|
|
||||||
model.userID = userIdentifier
|
|
||||||
model.givenName = fullName?.givenName
|
|
||||||
model.familyName = fullName?.familyName
|
|
||||||
model.name = fullName?.nickname
|
|
||||||
model.email = email
|
|
||||||
|
|
||||||
spLog(message: userIdentifier)
|
|
||||||
spLog(message: fullName)
|
|
||||||
spLog(message: email)
|
|
||||||
|
|
||||||
// if let signAppleHandle = signAppleHandle {
|
|
||||||
// signAppleHandle(model)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) {
|
|
||||||
// if let signAppleHandle = signAppleHandle {
|
|
||||||
// signAppleHandle(nil)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extension SPLoginManager: ASAuthorizationControllerPresentationContextProviding {
|
|
||||||
|
|
||||||
func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor {
|
|
||||||
return SPAPPTool.getKeyWindow()!
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// SPLoginManager+Facebook.swift
|
|
||||||
// MoviaBox
|
|
||||||
//
|
|
||||||
// Created by 佳尔 on 2025/4/25.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
//https://developers.facebook.com/docs/facebook-login/ios?checkpoint_src=any
|
|
||||||
extension SPLoginManager {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -36,14 +36,6 @@ class SPLoginManager: NSObject {
|
|||||||
///第三方登录
|
///第三方登录
|
||||||
func thirdLogin(type: LoginType, presentingViewController: UIViewController) {
|
func thirdLogin(type: LoginType, presentingViewController: UIViewController) {
|
||||||
|
|
||||||
switch type {
|
|
||||||
case .apple:
|
|
||||||
appleSignLogin { model in
|
|
||||||
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user