Skip to content

Instantly share code, notes, and snippets.

@Calvin-Huang
Created March 14, 2019 21:10
Show Gist options
  • Save Calvin-Huang/73d93ecdb5ea60e680e3038958b8ff13 to your computer and use it in GitHub Desktop.
Save Calvin-Huang/73d93ecdb5ea60e680e3038958b8ff13 to your computer and use it in GitHub Desktop.
@interface LoginVC () <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate>
{
UserController *_uco;
RegisterNC *_rNC;
MBProgressHUD *_hud;
LoginUserIdTVC* _tvcUserId;
LoginPasswdTVC* _tvcPasswd;
UIButton *_btnEULACheck, *_btnEULAlblBtn;
BOOL _eulaChecked;
}
@property (weak, nonatomic) IBOutlet UITableView *mainTableView;
@property (weak, nonatomic) IBOutlet UIView *ShieldView;
@end
@implementation LoginVC
-(void)startLoginWithAccountID:(NSString *)userID password:(NSString *)pwd
{
[self hudShow];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self->_uco userLoginWithAccountId:userID
passwd:pwd
socialType:@"N"
completion:^(id data, NSError *error)
{
dispatch_async(dispatch_get_main_queue(), ^{
// logMessage(@"%@", data);
if(error || data == nil)
{
[self hudHide];
[self alertMessage:NSLocalizedString(@"NoInternet",@"Common") title:@"" delegate:^(){}];
}
else if( (data != nil && ![[data valueForKey:@"errCde"] isEqualToString:@"00"])
|| [data valueForKey:@"ikeyToken"] == nil )
{
[self hudHide];
// self->_noEmpty = YES;
phoneAlertVC *vc = [sbRegisterObj instantiateViewControllerWithIdentifier:idvPhoneAlertVC];
[vc setAlertContent:[data valueForKey:@"errMsg"]];
[vc setBackgroundImgageData:[[self agScreenShot]copy]];
[self presentViewController:vc animated:NO completion:nil];
}
else
{
[self->_uco reloadDataWhenLaunchWithCompletion:^(id data, NSError *error) {
[self hudHide];
[self.mainTableView setHidden:YES];
[self.mainTableView setUserInteractionEnabled:NO];
NSDictionary *loginInfo = [self->_uco.userProfile copy];
if([[loginInfo valueForKey:@"isRedirect"] isEqualToString:@"Y"]) {
// UserDataVC *updatePwdVC = [UserDataVC getVC];
//
// updatePwdVC.needCleanRedirect = YES;
//
// updatePwdVC.redirectPwd = pwd;
//
// UINavigationController *naviVC = [[UINavigationController alloc] initWithRootViewController:updatePwdVC];
//
// [self crossDissolvePresentViewController:naviVC completion:nil];
} else {
HomeTabBarVC *tabbarCtrl = [sbHomeObj instantiateViewControllerWithIdentifier:idvHomeTabBarVC];
[self.navigationController pushViewController:tabbarCtrl animated:YES];
}
}];
// CCO.alreadyContactsError = NO;
//
//
// [CCO reloadDataWhenLaunchWithCompletion:^(id selfObj, NSInteger tag, id data, NSError *error) {
// dispatch_async(dispatch_get_main_queue(), ^{
//
// self->_noEmpty = NO;
// //登出時清空
// // [self->_tvcUserId.mainTextField setText:@""];
// // [self->_tvcPasswd.mainTextField setText:@""];
//
// [self hudHide];
//
// NSDictionary *loginInfo = CCO.LoginedUser.LoginInfoResult;
//
// if([[loginInfo valueForKey:@"isRedirect"] isEqualToString:@"Y"])
// {
// UserDataVC *updatePwdVC = [UserDataVC getVC];
//
// updatePwdVC.needCleanRedirect = YES;
//
// updatePwdVC.redirectPwd = pwd;
//
// UINavigationController *naviVC = [[UINavigationController alloc] initWithRootViewController:updatePwdVC];
//
// [self crossDissolvePresentViewController:naviVC completion:nil];
//
// }
// else
// {
// [self sendDatasToSuperVC:@{kSBACommand:[NSNumber numberWithInteger:SBActionPushMainVC]}];
//
// }
//
// });
// }];
}
});
}];
});
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment