// // LoginThirdAuthV.m // Asteria // // Created by 王猛 on 2023/5/16. // #import "LoginThirdAuthV.h" #import #import #import #define LoginBtnTag 10000 @interface LoginThirdAuthV () @end @implementation LoginThirdAuthV - (void)tt_setupViews{ UILabel *tipLab = [[UILabel alloc]init]; tipLab.text = @"Continue With"; tipLab.font = [UIFont fontWithName:Rob_Regular size:12]; [self addSubview:tipLab]; tipLab.frame = CGRectMake(20, 0, KScreenWidth-40, 15); NSArray *titleAry = @[@"Apple",@"Facebook",@"Google"]; NSArray *imgAry = @[@"login_Apple",@"login_Facebook",@"login_Google"]; for (int i= 0; i _Nullable connection, id _Nullable result, NSError * _Nullable error) { [MBProgressHUD hideHUDForView:topvc.view animated:YES]; NSLog(@"%@",result[@"name"]); if (error == nil) { NSMutableDictionary *paramsDic= [NSMutableDictionary dictionary]; [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"]; NSLog(@"paramsDic----%@",paramsDic); [self generaltriggermethodType:ThirdTypeFaceBook data:paramsDic]; }else{ [topvc.view makeToast:[NSString stringWithFormat:@"Login failed with error code:%ld",error.code] duration:3 position:CSToastPositionCenter]; } }]; } }]; } -(void)tool_google{ UIViewController *topvc = topViewController(); [MBProgressHUD showHUDAddedTo:topvc.view animated:YES]; [GIDSignIn.sharedInstance signInWithPresentingViewController:topvc completion:^(GIDSignInResult * _Nullable signInResult, NSError * _Nullable error) { if (error) { NSLog(@"NSError-----%@",error); return; } GIDGoogleUser *user = signInResult.user; if (user == nil) { return; } NSString *name = user.profile.name; NSString *givenName = user.profile.givenName; NSString *familyName = user.profile.familyName; 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"]; NSLog(@"paramsDic----%@",paramsDic); [self generaltriggermethodType:ThirdTypeGoogle data:paramsDic]; }]; } @end