|
@@ -106,11 +106,26 @@
|
|
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(nonnull ASAuthorization *)authorization API_AVAILABLE(ios(13.0)){
|
|
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(nonnull ASAuthorization *)authorization API_AVAILABLE(ios(13.0)){
|
|
if([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]){
|
|
if([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]){
|
|
ASAuthorizationAppleIDCredential *credential = (ASAuthorizationAppleIDCredential *)authorization.credential;
|
|
ASAuthorizationAppleIDCredential *credential = (ASAuthorizationAppleIDCredential *)authorization.credential;
|
|
- NSString *user = credential.user;
|
|
|
|
- NSString *email = credential.email;
|
|
|
|
|
|
|
|
- NSData *identityToken = credential.identityToken;
|
|
|
|
- NSLog(@"user - %@ --- %@--%@",user,email,identityToken);
|
|
|
|
|
|
+ NSString *identityToken = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding];
|
|
|
|
+
|
|
|
|
+ NSMutableDictionary *paramsDic= [NSMutableDictionary dictionary];
|
|
|
|
+ NSDictionary *userInfo = @{@"identifier":AS_String_NotNull(credential.user) ,
|
|
|
|
+ @"email":AS_String_NotNull(credential.email),
|
|
|
|
+ @"firstName":AS_String_NotNull(credential.fullName.familyName),
|
|
|
|
+ @"lastName":AS_String_NotNull(credential.fullName.givenName),
|
|
|
|
+ @"displayName":@""};
|
|
|
|
+
|
|
|
|
+ NSString *userInfoStr = [userInfo mj_JSONString];
|
|
|
|
+
|
|
|
|
+ [paramsDic setObject:userInfoStr forKey:@"userInfo"];
|
|
|
|
+ [paramsDic setObject:@"apple" forKey:@"hauth_done"];
|
|
|
|
+ [paramsDic setObject:identityToken forKey:@"token"];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ NSLog(@"paramsDic----%@",paramsDic);
|
|
|
|
+ [self generaltriggermethodType:ThirdTypeApple data:paramsDic];
|
|
|
|
+
|
|
}else if([authorization.credential isKindOfClass:[ASPasswordCredential class]]){
|
|
}else if([authorization.credential isKindOfClass:[ASPasswordCredential class]]){
|
|
ASPasswordCredential *psdCredential = (ASPasswordCredential *)authorization.credential;
|
|
ASPasswordCredential *psdCredential = (ASPasswordCredential *)authorization.credential;
|
|
// 密码凭证对象的用户标识 用户的唯一标识
|
|
// 密码凭证对象的用户标识 用户的唯一标识
|
|
@@ -189,14 +204,27 @@
|
|
NSLog(@"%@",result[@"name"]);
|
|
NSLog(@"%@",result[@"name"]);
|
|
if (error == nil) {
|
|
if (error == nil) {
|
|
NSMutableDictionary *paramsDic= [NSMutableDictionary dictionary];
|
|
NSMutableDictionary *paramsDic= [NSMutableDictionary dictionary];
|
|
- [paramsDic setObject:@(1) forKey:@"type"];
|
|
|
|
|
|
+// [paramsDic setObject:@(1) forKey:@"type"];
|
|
|
|
+// [paramsDic setObject:tmpToken forKey:@"token"];
|
|
|
|
+// [paramsDic setObject:MM_str(result[@"email"]) forKey:@"email"];
|
|
|
|
+// [paramsDic setObject:MM_str(result[@"id"]) forKey:@"uid"];
|
|
|
|
+// [paramsDic setObject:MM_str(result[@"first_name"]) forKey:@"firstName"];
|
|
|
|
+// [paramsDic setObject:MM_str(result[@"last_name"]) forKey:@"lastName"];
|
|
|
|
+// [paramsDic setObject:@"" forKey:@"birthday"];
|
|
|
|
+// [paramsDic setObject:@"" forKey:@"gender"];
|
|
|
|
+ NSDictionary *userInfo = @{@"identifier":MM_str(result[@"id"]) ,
|
|
|
|
+ @"email":MM_str(result[@"email"]),
|
|
|
|
+ @"firstName":MM_str(result[@"first_name"]),
|
|
|
|
+ @"lastName":MM_str(result[@"last_name"]),
|
|
|
|
+ @"displayName":@""};
|
|
|
|
+
|
|
|
|
+ NSString *userInfoStr = [userInfo mj_JSONString];
|
|
|
|
+
|
|
|
|
+ [paramsDic setObject:userInfoStr forKey:@"userInfo"];
|
|
|
|
+ [paramsDic setObject:@"facebook" forKey:@"hauth_done"];
|
|
[paramsDic setObject:tmpToken forKey:@"token"];
|
|
[paramsDic setObject:tmpToken forKey:@"token"];
|
|
- [paramsDic setObject:MM_str(result[@"email"]) forKey:@"email"];
|
|
|
|
- [paramsDic setObject:MM_str(result[@"id"]) forKey:@"uid"];
|
|
|
|
- [paramsDic setObject:MM_str(result[@"first_name"]) forKey:@"firstName"];
|
|
|
|
- [paramsDic setObject:MM_str(result[@"last_name"]) forKey:@"lastName"];
|
|
|
|
- [paramsDic setObject:@"" forKey:@"birthday"];
|
|
|
|
- [paramsDic setObject:@"" forKey:@"gender"];
|
|
|
|
|
|
+
|
|
|
|
+
|
|
NSLog(@"paramsDic----%@",paramsDic);
|
|
NSLog(@"paramsDic----%@",paramsDic);
|
|
[self generaltriggermethodType:ThirdTypeFaceBook data:paramsDic];
|
|
[self generaltriggermethodType:ThirdTypeFaceBook data:paramsDic];
|
|
|
|
|
|
@@ -211,27 +239,52 @@
|
|
}
|
|
}
|
|
-(void)tool_google{
|
|
-(void)tool_google{
|
|
UIViewController *topvc = topViewController();
|
|
UIViewController *topvc = topViewController();
|
|
|
|
+ K_WEAK_SELF;
|
|
[MBProgressHUD showHUDAddedTo:topvc.view animated:YES];
|
|
[MBProgressHUD showHUDAddedTo:topvc.view animated:YES];
|
|
[GIDSignIn.sharedInstance signInWithPresentingViewController:topvc completion:^(GIDSignInResult * _Nullable signInResult, NSError * _Nullable error) {
|
|
[GIDSignIn.sharedInstance signInWithPresentingViewController:topvc completion:^(GIDSignInResult * _Nullable signInResult, NSError * _Nullable error) {
|
|
|
|
+ K_STRONG_SELF;
|
|
|
|
+ [MBProgressHUD hideHUDForView:topvc.view animated:YES];
|
|
|
|
+
|
|
if (error) {
|
|
if (error) {
|
|
NSLog(@"NSError-----%@",error);
|
|
NSLog(@"NSError-----%@",error);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
GIDGoogleUser *user = signInResult.user;
|
|
GIDGoogleUser *user = signInResult.user;
|
|
- if (user == nil) { return; }
|
|
|
|
|
|
+ if (user == nil) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
NSString *name = user.profile.name;
|
|
NSString *name = user.profile.name;
|
|
NSString *givenName = user.profile.givenName;
|
|
NSString *givenName = user.profile.givenName;
|
|
NSString *familyName = user.profile.familyName;
|
|
NSString *familyName = user.profile.familyName;
|
|
NSMutableDictionary *paramsDic= [NSMutableDictionary dictionary];
|
|
NSMutableDictionary *paramsDic= [NSMutableDictionary dictionary];
|
|
- [paramsDic setObject:@(2) forKey:@"type"];
|
|
|
|
- [paramsDic setObject:user.accessToken forKey:@"token"];
|
|
|
|
- [paramsDic setObject:user.profile.email forKey:@"email"];
|
|
|
|
- [paramsDic setObject:user.userID forKey:@"uid"];
|
|
|
|
- [paramsDic setObject:familyName forKey:@"firstName"];
|
|
|
|
- [paramsDic setObject:givenName forKey:@"lastName"];
|
|
|
|
- [paramsDic setObject:@"" forKey:@"birthday"];
|
|
|
|
- [paramsDic setObject:@"" forKey:@"gender"];
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ NSDictionary *userInfo = @{@"identifier":user.userID,
|
|
|
|
+ @"email":user.profile.email,
|
|
|
|
+ @"firstName":familyName,
|
|
|
|
+ @"lastName":givenName,
|
|
|
|
+ @"displayName":@""};
|
|
|
|
+
|
|
|
|
+ NSString *userInfoStr = [userInfo mj_JSONString];
|
|
|
|
+
|
|
|
|
+ [paramsDic setObject:userInfoStr forKey:@"userInfo"];
|
|
|
|
+ [paramsDic setObject:@"google" forKey:@"hauth_done"];
|
|
|
|
+ [paramsDic setObject:user.accessToken.tokenString forKey:@"token"];
|
|
|
|
+
|
|
|
|
+// [paramsDic setObject:user.profile.email forKey:@"email"];
|
|
|
|
+// [paramsDic setObject:user.userID forKey:@"identifier"];
|
|
|
|
+// [paramsDic setObject:familyName forKey:@"firstName"];
|
|
|
|
+// [paramsDic setObject:givenName forKey:@"lastName"];
|
|
|
|
+// [paramsDic setObject:@"" forKey:@"birthday"];
|
|
|
|
+// [paramsDic setObject:@"" forKey:@"gender"];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// [paramsDic setObject:signInResult.serverAuthCode forKey:@"code"];
|
|
|
|
+// [paramsDic setObject:@"google" forKey:@"state"];
|
|
|
|
+
|
|
NSLog(@"paramsDic----%@",paramsDic);
|
|
NSLog(@"paramsDic----%@",paramsDic);
|
|
[self generaltriggermethodType:ThirdTypeGoogle data:paramsDic];
|
|
[self generaltriggermethodType:ThirdTypeGoogle data:paramsDic];
|
|
}];
|
|
}];
|