|
|
@@ -14,8 +14,8 @@
|
|
|
#import "QuizViewController.h"
|
|
|
|
|
|
#define kiZeroHeight 0;
|
|
|
-#define kiViewHeight 14;
|
|
|
-#define kiBtnSendHeight 50;
|
|
|
+#define kiViewHeight 14; // 전송 버튼 위 여백뷰 높이 값
|
|
|
+#define kiBtnSendHeight 50; // 전송 버튼 높이 값
|
|
|
#define ksSimpleSignUp @"2"; // 일반 회원가입
|
|
|
#define ksMasterSignUP @"3"; // 마스터 회원가입
|
|
|
|
|
|
@@ -34,6 +34,7 @@
|
|
|
[self initUI];
|
|
|
}
|
|
|
|
|
|
+// UI 설정
|
|
|
- (void)initUI {
|
|
|
[self.navigationController.navigationBar setHidden:YES];
|
|
|
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
|
|
|
@@ -57,6 +58,7 @@
|
|
|
|
|
|
[self.btnSend setBackgroundImage:[UIImage imageNamed:@"img_btn_common_disable"] forState:UIControlStateDisabled capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
|
|
|
|
|
|
+ // 마스터,멤버 여부에 따라 전송 버튼 Hidden 여부설정
|
|
|
if ([[JDFacade facade].signType isEqualToString:KNEET_MEMBER_MASTER]) {
|
|
|
[self hiddenSendButton:YES];
|
|
|
} else {
|
|
|
@@ -65,6 +67,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+// 휴대폰 번호 인증 확인 요청
|
|
|
- (void)requestValidNum {
|
|
|
|
|
|
NSDictionary *parameter = @{@"phone": _txtPhoneNum.text,
|
|
|
@@ -79,7 +82,8 @@
|
|
|
SignUpModel *signUpModel = (SignUpModel *)responseObject;
|
|
|
|
|
|
NSLog(@"Response : %@",signUpModel);
|
|
|
-
|
|
|
+
|
|
|
+ // 마스터 회원가입일 경우 퀴즈 선택 메뉴로 이동
|
|
|
if ([[JDFacade facade].signType isEqualToString:KNEET_MEMBER_MASTER]) {
|
|
|
SignUpQuizSetViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SignUpQuizSetViewController" storyboardName:@"SignUp"];
|
|
|
|
|
|
@@ -88,6 +92,7 @@
|
|
|
[JDFacade facade].signUpUser = signUpModel;
|
|
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
+ // 멤버 회원가입일 경우 퀴즈 정답 입력 메뉴로 이동
|
|
|
} else {
|
|
|
QuizViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"QuizViewController" storyboardName:@"SignUp"];
|
|
|
|
|
|
@@ -105,11 +110,12 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+// 인증번호 전송 ( 멤버 회원가입만 해당 )
|
|
|
- (void)requestAuthSendNum {
|
|
|
//parameters
|
|
|
NSDictionary *parameter = @{@"phone": _txtPhoneNum.text,
|
|
|
@"auth_type": signType};
|
|
|
-
|
|
|
+
|
|
|
NSString *path = API_POST_REQUEST_AUTH_NUM;
|
|
|
|
|
|
[[RequestHandler handler] sendAsyncPostRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
|
|
|
@@ -125,36 +131,41 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+// 인증번호 전송 여부 설정
|
|
|
- (void)hiddenSendButton:(BOOL)isHidden{
|
|
|
if (isHidden) {
|
|
|
_btnSend.hidden = YES;
|
|
|
- _btnSendHeight.constant = kiZeroHeight;
|
|
|
- _viewHeight.constant = kiZeroHeight;
|
|
|
+ _btnSendHeight.constant = kiZeroHeight; // 버튼 높이 값 0 설정
|
|
|
+ _viewHeight.constant = kiZeroHeight; // 뷰 높이 값 0 설정
|
|
|
_lblMessage.text = @"설치기사님에게 인증번호 SMS를 받은 번호만\n인증이 가능합니다.";
|
|
|
- signType = ksMasterSignUP;
|
|
|
+ signType = ksMasterSignUP; // 인증 타입 마스터로 설정
|
|
|
} else {
|
|
|
_btnSend.hidden = NO;
|
|
|
- _btnSendHeight.constant = kiBtnSendHeight;
|
|
|
- _viewHeight.constant = kiViewHeight;
|
|
|
+ _btnSendHeight.constant = kiBtnSendHeight; // 버튼 높이 값 50 설정
|
|
|
+ _viewHeight.constant = kiViewHeight; // 뷰 높이 값 14 설정
|
|
|
_lblMessage.text = @"마스터 사용자에게 초대 SMS를 받은 번호만\n인증이 가능합니다.";
|
|
|
- signType = ksSimpleSignUp;
|
|
|
+ signType = ksSimpleSignUp; // 인증 타입 멤버로 설정
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 다음 버튼 터치시 인증번호 유효성 체크
|
|
|
- (IBAction)btnNextTouched:(id)sender {
|
|
|
[self requestValidNum];
|
|
|
}
|
|
|
|
|
|
+// 메뉴 닫기
|
|
|
- (IBAction)btnCancelTouched:(id)sender {
|
|
|
|
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
}
|
|
|
-
|
|
|
+// 인증 번호 전송 버튼 터치시 입력 된 휴대폰 번호로 인증번호 전송
|
|
|
- (IBAction)btnSendTouched:(id)sender {
|
|
|
[self requestAuthSendNum];
|
|
|
}
|
|
|
|
|
|
+// 휴대폰 번호 및 인증번호에 입력 된 글자 수에따라 다음 버튼 Enable여부 설정
|
|
|
- (void)textFieldDidEndEditing:(UITextField *)textField{
|
|
|
+ // 휴대폰 번호가 10자리 이상 입력 된 경우 다음 버튼 활성화
|
|
|
if (_txtPhoneNum.text.length >= 10) {
|
|
|
_btnSend.enabled = YES;
|
|
|
_btnNext.enabled = YES;
|
|
|
@@ -163,6 +174,7 @@
|
|
|
_btnNext.enabled = NO;
|
|
|
}
|
|
|
|
|
|
+ // 인증번호가 4자리가 입력 된 경우 다음 버튼 활성화
|
|
|
if (_txtCertifyInput.text.length >= 4){
|
|
|
_btnNext.enabled = YES;
|
|
|
} else {
|
|
|
@@ -170,12 +182,15 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 휴대폰 번호 및 인증번호 최대 입력가능한 텍스트 설정
|
|
|
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
|
|
|
|
|
+ // 휴대폰 번호입력 최대 11글자
|
|
|
if ([textField isEqual:_txtPhoneNum]) {
|
|
|
if (textField.text.length >= 11 && range.length == 0) {
|
|
|
return NO;
|
|
|
}
|
|
|
+ // 인증번호 최대 4글자
|
|
|
} else if([textField isEqual:_txtCertifyInput]){
|
|
|
if (textField.text.length >= 4 && range.length == 0) {
|
|
|
return NO;
|