Commit af3db83b95687a213b0afb0a40c8299390665761

Authored by iOS-Xiaowen
1 parent e6662811

no message

CNLiveScioLive/Pages/Login/Controller/CNLiveLoginViewController.m
@@ -285,8 +285,6 @@ @@ -285,8 +285,6 @@
285 [self networkParamAction]; 285 [self networkParamAction];
286 [self signInWithApple]; 286 [self signInWithApple];
287 } 287 }
288 -// type = SSDKPlatformTypeSinaWeibo;  
289 -// plat = @"5";  
290 return; 288 return;
291 break; 289 break;
292 default: 290 default:
@@ -299,25 +297,7 @@ @@ -299,25 +297,7 @@
299 // 准备登录参数 297 // 准备登录参数
300 [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:plat thirdPartyId:user.uid nickName:user.nickname gender:nil location:nil faceUrl:user.icon frmId:nil success:^(NSDictionary *result) { 298 [CNLiveUserSystemCenter thirdPartyLoginWithThirdPartyPlatType:plat thirdPartyId:user.uid nickName:user.nickname gender:nil location:nil faceUrl:user.icon frmId:nil success:^(NSDictionary *result) {
301 if ([result[@"errorCode"] integerValue] == 0) { 299 if ([result[@"errorCode"] integerValue] == 0) {
302 -  
303 - ZXWUserInformation *share = [ZXWUserInformation shareZXWUserInformation];  
304 - share.model = [[ZXWUserModel alloc] initWithDictionary:result[@"data"]];  
305 -  
306 - [[ZXWUserInformation shareZXWUserInformation] saveToken:result[@"data"][@"token"]];  
307 - [[ZXWUserInformation shareZXWUserInformation] saveUser_id:@""];  
308 - [[ZXWUserInformation shareZXWUserInformation] setIsLoginSuccess:YES];  
309 -  
310 - [[ZXWUserInformation shareZXWUserInformation] saveUser_name:result[@"data"][@"nickName"]];  
311 - [[ZXWUserInformation shareZXWUserInformation] saveUser_pwd:self->_pwd.textField.text];  
312 - [[ZXWUserInformation shareZXWUserInformation] saveUser_phone:result[@"data"][@"mobile"]];  
313 - [[ZXWUserInformation shareZXWUserInformation] saveUser_email:result[@"data"][@"email"]];  
314 - [[ZXWUserInformation shareZXWUserInformation] saveUser_headimgUrlString:result[@"data"][@"faceUrl"]];  
315 - [[NSNotificationCenter defaultCenter] postNotificationName:LoginSuccessful object:nil];  
316 -  
317 - [AlertViewTool showHUDViewText:CustomStr(@"LoginSuccess") block:^{  
318 - [self goBack];  
319 -  
320 - }]; 300 + [self saveUserInfo:result];
321 301
322 } else { 302 } else {
323 [AlertViewTool showHUDViewText:CustomStr(@"LoginFailure")]; 303 [AlertViewTool showHUDViewText:CustomStr(@"LoginFailure")];
@@ -348,6 +328,26 @@ @@ -348,6 +328,26 @@
348 } 328 }
349 }]; 329 }];
350 } 330 }
  331 +- (void)saveUserInfo:(NSDictionary *)result{
  332 + ZXWUserInformation *share = [ZXWUserInformation shareZXWUserInformation];
  333 + share.model = [[ZXWUserModel alloc] initWithDictionary:result[@"data"]];
  334 +
  335 + [[ZXWUserInformation shareZXWUserInformation] saveToken:result[@"data"][@"token"]];
  336 + [[ZXWUserInformation shareZXWUserInformation] saveUser_id:@""];
  337 + [[ZXWUserInformation shareZXWUserInformation] setIsLoginSuccess:YES];
  338 +
  339 + [[ZXWUserInformation shareZXWUserInformation] saveUser_name:result[@"data"][@"nickName"]];
  340 + [[ZXWUserInformation shareZXWUserInformation] saveUser_pwd:self->_pwd.textField.text];
  341 + [[ZXWUserInformation shareZXWUserInformation] saveUser_phone:result[@"data"][@"mobile"]];
  342 + [[ZXWUserInformation shareZXWUserInformation] saveUser_email:result[@"data"][@"email"]];
  343 + [[ZXWUserInformation shareZXWUserInformation] saveUser_headimgUrlString:result[@"data"][@"faceUrl"]];
  344 +
  345 + [[NSNotificationCenter defaultCenter] postNotificationName:LoginSuccessful object:nil];
  346 +
  347 + [AlertViewTool showHUDViewText:CustomStr(@"LoginSuccess") block:^{
  348 + [self goBack];
  349 + }];
  350 +}
351 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ 351 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
352 [self allResignFirstResponder]; 352 [self allResignFirstResponder];
353 353
@@ -377,13 +377,13 @@ @@ -377,13 +377,13 @@
377 NSString *identityToken = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding]; // access token 377 NSString *identityToken = [[NSString alloc] initWithData:credential.identityToken encoding:NSUTF8StringEncoding]; // access token
378 ASUserDetectionStatus realUserStatus = credential.realUserStatus; 378 ASUserDetectionStatus realUserStatus = credential.realUserStatus;
379 379
380 - NSLog(@"state: %@", state);  
381 - NSLog(@"userID: %@", userID);  
382 - NSLog(@"fullName: %@", fullName);  
383 - NSLog(@"email: %@", email);  
384 - NSLog(@"authorizationCode: %@", authorizationCode);  
385 - NSLog(@"identityToken: %@", identityToken);  
386 - NSLog(@"realUserStatus: %@", @(realUserStatus)); 380 +// NSLog(@"state: %@", state);
  381 +// NSLog(@"userID: %@", userID);
  382 +// NSLog(@"fullName: %@", fullName);
  383 +// NSLog(@"email: %@", email);
  384 +// NSLog(@"authorizationCode: %@", authorizationCode);
  385 +// NSLog(@"identityToken: %@", identityToken);
  386 +// NSLog(@"realUserStatus: %@", @(realUserStatus));
387 NSArray * subKeys = [NSArray arrayWithObjects:@"code",@"token",@"userId", @"appId", nil]; 387 NSArray * subKeys = [NSArray arrayWithObjects:@"code",@"token",@"userId", @"appId", nil];
388 NSArray * subValues = [NSArray arrayWithObjects:authorizationCode, identityToken, userID, CNLiveAppId, nil]; 388 NSArray * subValues = [NSArray arrayWithObjects:authorizationCode, identityToken, userID, CNLiveAppId, nil];
389 NSDictionary * dic = [[NSDictionary alloc] initWithObjects:subValues forKeys:subKeys]; 389 NSDictionary * dic = [[NSDictionary alloc] initWithObjects:subValues forKeys:subKeys];
@@ -407,24 +407,8 @@ @@ -407,24 +407,8 @@
407 __strong typeof(weakSelf) strongSelf = weakSelf; 407 __strong typeof(weakSelf) strongSelf = weakSelf;
408 if(!strongSelf) return; 408 if(!strongSelf) return;
409 if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) { 409 if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
410 - ZXWUserInformation *share = [ZXWUserInformation shareZXWUserInformation];  
411 - share.model = [[ZXWUserModel alloc] initWithDictionary:responseObject[@"data"]];  
412 -  
413 - [[ZXWUserInformation shareZXWUserInformation] saveToken:responseObject[@"data"][@"token"]];  
414 - [[ZXWUserInformation shareZXWUserInformation] saveUser_id:responseObject[@"data"][@"uid"]];  
415 - [[ZXWUserInformation shareZXWUserInformation] setIsLoginSuccess:YES];  
416 -  
417 - [[ZXWUserInformation shareZXWUserInformation] saveUser_name:responseObject[@"data"][@"nickName"]];  
418 - [[ZXWUserInformation shareZXWUserInformation] saveUser_pwd:self->_pwd.textField.text];  
419 - [[ZXWUserInformation shareZXWUserInformation] saveUser_phone:responseObject[@"data"][@"mobile"]];  
420 - [[ZXWUserInformation shareZXWUserInformation] saveUser_email:responseObject[@"data"][@"email"]];  
421 - [[ZXWUserInformation shareZXWUserInformation] saveUser_headimgUrlString:responseObject[@"data"][@"faceUrl"]];  
422 - [[NSNotificationCenter defaultCenter] postNotificationName:LoginSuccessful object:nil];  
423 -  
424 - [AlertViewTool showHUDViewText:CustomStr(@"LoginSuccess") block:^{  
425 - [self goBack]; 410 + [self saveUserInfo:responseObject];
426 411
427 - }];  
428 } else { 412 } else {
429 [AlertViewTool showHUDViewText:CustomStr(@"LoginFailure") block:^{}]; 413 [AlertViewTool showHUDViewText:CustomStr(@"LoginFailure") block:^{}];
430 } 414 }
CNLiveScioLive/Pages/Login/View/CNLiveThirdLoginView.m
@@ -41,13 +41,13 @@ @@ -41,13 +41,13 @@
41 [self addSubview:btn]; 41 [self addSubview:btn];
42 } 42 }
43 if (@available(iOS 13, *)) { 43 if (@available(iOS 13, *)) {
44 - ASAuthorizationAppleIDButton *btn = [ASAuthorizationAppleIDButton buttonWithType:ASAuthorizationAppleIDButtonTypeDefault style:ASAuthorizationAppleIDButtonStyleWhite]; 44 + ASAuthorizationAppleIDButton *btn = [ASAuthorizationAppleIDButton buttonWithType:ASAuthorizationAppleIDButtonTypeDefault style:ASAuthorizationAppleIDButtonStyleBlack];
45 btn.tag = 1000+(count-1); 45 btn.tag = 1000+(count-1);
46 btn.layer.masksToBounds = YES; 46 btn.layer.masksToBounds = YES;
47 - btn.layer.cornerRadius = 21.0; 47 + btn.layer.cornerRadius = 22.0;
48 btn.layer.borderWidth = 1.0; 48 btn.layer.borderWidth = 1.0;
49 btn.layer.borderColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0].CGColor; 49 btn.layer.borderColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0].CGColor;
50 - btn.frame = CGRectMake((count-1)*width+20, 48, 42, 42); 50 + btn.frame = CGRectMake((count-1)*width+20, 48, 44, 44);
51 [btn addTarget:self action:@selector(clickedLoginBtn:) forControlEvents:UIControlEventTouchUpInside]; 51 [btn addTarget:self action:@selector(clickedLoginBtn:) forControlEvents:UIControlEventTouchUpInside];
52 [self addSubview:btn]; 52 [self addSubview:btn];
53 } 53 }