| | |
| | | import AuthenticationServices |
| | | |
| | | |
| | | let LoginSuccess_Noti = Notification.Name.init("LoginSuccess_Noti") |
| | | |
| | | class LoginViewModel{ |
| | | var loginType = BehaviorRelay<LoginType>(value:.pwd) |
| | | var loginPhone = BehaviorRelay<String>(value:"") |
| | |
| | | if let credential = authorization.credential as? ASAuthorizationAppleIDCredential{ |
| | | |
| | | Services.loginByApple(appleId: credential.user).subscribe(onNext: {data in |
| | | if var m = data.data,m.bindStatus == 2{ |
| | | sceneDelegate?.loginSuccess() |
| | | m.loginByAppleToken = String(data: credential.identityToken!, encoding: .utf8) |
| | | m.appleId = credential.user |
| | | if var m = data.data{ |
| | | if m.bindStatus == 2{ |
| | | sceneDelegate?.loginSuccess() |
| | | m.loginByAppleToken = String(data: credential.identityToken!, encoding: .utf8) |
| | | m.appleId = credential.user |
| | | |
| | | self.dismiss(animated: true) |
| | | self.dismiss(animated: true) |
| | | |
| | | UserViewModel.saveLoginInfo(m) |
| | | UserViewModel.saveLoginInfo(m) |
| | | |
| | | Services.getUserInfo().subscribe(onNext: {data in |
| | | if let model = data.data{ |
| | | UserViewModel.saveAvatarInfo(model) |
| | | } |
| | | }).disposed(by: self.disposeBag) |
| | | }else{ |
| | | let vc = UpdatePhoneVC(credential: credential) |
| | | self.jq_push(vc: vc) |
| | | Services.getUserInfo().subscribe(onNext: {data in |
| | | if let model = data.data{ |
| | | UserViewModel.saveAvatarInfo(model) |
| | | } |
| | | }).disposed(by: self.disposeBag) |
| | | }else{ |
| | | let vc = UpdatePhoneVC(credential: credential,firstAccessToken: m.accessToken) |
| | | self.jq_push(vc: vc) |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | |
| | | |
| | | // print(credential.user) |
| | | // print(credential.state) |
| | | // print(credential.email) |
| | | // print(credential.fullName?.familyName) |
| | | // print(credential.fullName?.givenName) |
| | | // print(credential.fullName?.middleName) |
| | | // print(String(data: credential.identityToken!, encoding: .utf8)) |
| | | |
| | | |
| | | } |
| | | } |
| | | |