Kaynağa Gözat

- 회원가입 유형 선택 메뉴 추가

TaeHyun 8 yıl önce
ebeveyn
işleme
efefb1462e

+ 12 - 0
OneCable.xcodeproj/project.pbxproj

@@ -185,6 +185,8 @@
 		E20397631EC57CE7002443E5 /* ChangeDeviceNamePopupView.m in Sources */ = {isa = PBXBuildFile; fileRef = E20397611EC57CE7002443E5 /* ChangeDeviceNamePopupView.m */; };
 		E20397661EC57E9C002443E5 /* ChangeDeviceNamePopupView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E20397651EC57E9C002443E5 /* ChangeDeviceNamePopupView.xib */; };
 		E2063B351EB0A1EB009025EA /* SettingsPasswdInputViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2063B341EB0A1EB009025EA /* SettingsPasswdInputViewController.m */; };
+		E215979C1ED5086700AB5B5A /* SignUpQuizSetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E21597991ED5086700AB5B5A /* SignUpQuizSetViewController.m */; };
+		E215979D1ED5086700AB5B5A /* SignUpTypeSelectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E215979B1ED5086700AB5B5A /* SignUpTypeSelectViewController.m */; };
 		E216555E1EB0681500090EB6 /* ChangePhotoPopupView.m in Sources */ = {isa = PBXBuildFile; fileRef = E216555C1EB0681500090EB6 /* ChangePhotoPopupView.m */; };
 		E21655611EB0693E00090EB6 /* ChangePhotoPopupView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E21655601EB0693E00090EB6 /* ChangePhotoPopupView.xib */; };
 		E2295F0B1E83857A008C5915 /* ThingsGeneralDelStartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E2295F0A1E83857A008C5915 /* ThingsGeneralDelStartViewController.m */; };
@@ -568,6 +570,10 @@
 		E2063B331EB0A1EB009025EA /* SettingsPasswdInputViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsPasswdInputViewController.h; sourceTree = "<group>"; };
 		E2063B341EB0A1EB009025EA /* SettingsPasswdInputViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsPasswdInputViewController.m; sourceTree = "<group>"; };
 		E21000791E91C98A00D5C4AE /* IdFindViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IdFindViewController.h; sourceTree = "<group>"; };
+		E21597981ED5086700AB5B5A /* SignUpQuizSetViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignUpQuizSetViewController.h; sourceTree = "<group>"; };
+		E21597991ED5086700AB5B5A /* SignUpQuizSetViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignUpQuizSetViewController.m; sourceTree = "<group>"; };
+		E215979A1ED5086700AB5B5A /* SignUpTypeSelectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignUpTypeSelectViewController.h; sourceTree = "<group>"; };
+		E215979B1ED5086700AB5B5A /* SignUpTypeSelectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignUpTypeSelectViewController.m; sourceTree = "<group>"; };
 		E216555B1EB0681500090EB6 /* ChangePhotoPopupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChangePhotoPopupView.h; sourceTree = "<group>"; };
 		E216555C1EB0681500090EB6 /* ChangePhotoPopupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChangePhotoPopupView.m; sourceTree = "<group>"; };
 		E21655601EB0693E00090EB6 /* ChangePhotoPopupView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ChangePhotoPopupView.xib; sourceTree = "<group>"; };
@@ -1209,6 +1215,10 @@
 				E2E08D071E8DDAE60034D6F7 /* PwFindCompleteViewController.m */,
 				E2E08D091E8DDB000034D6F7 /* QuizSelectViewController.h */,
 				E2E08D0A1E8DDB000034D6F7 /* QuizSelectViewController.m */,
+				E21597981ED5086700AB5B5A /* SignUpQuizSetViewController.h */,
+				E21597991ED5086700AB5B5A /* SignUpQuizSetViewController.m */,
+				E215979A1ED5086700AB5B5A /* SignUpTypeSelectViewController.h */,
+				E215979B1ED5086700AB5B5A /* SignUpTypeSelectViewController.m */,
 			);
 			path = SignUpScreens;
 			sourceTree = "<group>";
@@ -1524,6 +1534,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				A13BD0691C3B491400C76527 /* ThingsAddViewController.m in Sources */,
+				E215979D1ED5086700AB5B5A /* SignUpTypeSelectViewController.m in Sources */,
 				E2A21B9A1E9CD0C30028CD9F /* CustomDatePopupView.m in Sources */,
 				A13BCFDD1C3B491400C76527 /* NSData+AESCrypt.m in Sources */,
 				A13BD01B1C3B491400C76527 /* LoginModel.m in Sources */,
@@ -1555,6 +1566,7 @@
 				A51708471E78E0F900AEF165 /* MoreBtnModel.m in Sources */,
 				A13BD00B1C3B491400C76527 /* CustomPicker.m in Sources */,
 				A13BD0681C3B491400C76527 /* ThingsAddStartViewController.m in Sources */,
+				E215979C1ED5086700AB5B5A /* SignUpQuizSetViewController.m in Sources */,
 				A13BD0301C3B491400C76527 /* QRCodeViewController.m in Sources */,
 				E2AA822D1E6FD652009B8077 /* MorePopOverViewController.m in Sources */,
 				A13BD02E1C3B491400C76527 /* QRCodeInputPopupView.m in Sources */,

+ 27 - 0
OneCable/Classes/ViewControllers/SignUpScreens/SignUpQuizSetViewController.h

@@ -0,0 +1,27 @@
+//
+//  SignUpQuizSetViewController.h
+//  OneCable
+//
+//  Created by nComz on 2017. 5. 22..
+//  Copyright © 2017년 ntels. All rights reserved.
+//
+
+#import "JDViewController.h"
+
+@class CustomTextField;
+@class CustomButton;
+
+@interface SignUpQuizSetViewController : JDViewController
+
+@property (weak, nonatomic) IBOutlet CustomTextField *txtQuizSelect; // 퀴즈 선택
+@property (weak, nonatomic) IBOutlet CustomTextField *txtSelfQuiz;  // 퀴즈 질문 작성
+@property (weak, nonatomic) IBOutlet CustomButton *btnInputQuizAnswer;  // 퀴즈 정답 버튼
+@property (weak, nonatomic) IBOutlet CustomLabel *lblStep;
+
+@property (weak, nonatomic) IBOutlet UIView *viewSelfQuiz;
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *viewHeight;
+
+@property (weak, nonatomic) IBOutlet CustomButton *btnCancel;
+@property (weak, nonatomic) IBOutlet CustomButton *btnNext;
+
+@end

+ 231 - 0
OneCable/Classes/ViewControllers/SignUpScreens/SignUpQuizSetViewController.m

@@ -0,0 +1,231 @@
+//
+//  SignUpQuizSetViewController.m
+//  OneCable
+//
+//  Created by nComz on 2017. 5. 22..
+//  Copyright © 2017년 ntels. All rights reserved.
+//
+
+#import "SignUpQuizSetViewController.h"
+#import "CustomTextField.h"
+#import "CustomDatePopupView.h"
+#import "RequestHandler.h"
+#import "ImageUtil.h"
+
+/**
+ 해당 메뉴는 마스터만 출력
+ **/
+@interface SignUpQuizSetViewController () <CustomTextFieldDelegate> {
+    
+    DataSelectListModel *_quizList;
+    DataSelectModel *_selectedQuiz;
+    CustomDatePopupView *_popDate;
+    NSString *answer;
+}
+
+@end
+
+@implementation SignUpQuizSetViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+
+    [self initUI];
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    [self requestInviteQuizList];
+    
+}
+
+- (void)initUI {
+    [self.navigationController.navigationBar setHidden:YES];
+    self.navigationController.interactivePopGestureRecognizer.enabled = NO;
+    
+    [_lblStep setColor:kUITextColor03 text:[NSString stringWithFormat:@"%@", @"/ 5"]];
+    
+    answer = @"";
+    _btnNext.enabled = NO;
+    [self showDirectInputArea:NO];
+    
+    _txtQuizSelect.delegate = self;
+    _txtSelfQuiz.delegate = self;
+    
+    _txtQuizSelect.keyboardType = UIKeyboardTypeDefault;
+    _txtQuizSelect.returnKeyType = UIReturnKeyDone;
+    
+    _txtQuizSelect.placeholder = @"퀴즈를 선택하세요.";
+}
+
+-(void)showDirectInputArea:(BOOL)isShow
+{
+    _viewSelfQuiz.hidden = !isShow;
+    
+    if(_viewSelfQuiz.isHidden){
+        _viewHeight.constant = 0;
+    } else{
+        _viewHeight.constant = 177.0f;
+    }
+}
+
+- (void)updateUI {
+    _btnNext.enabled = [self isValidRequestInfo];
+    
+    if (_selectedQuiz != nil) {
+        QuizModel *info = (QuizModel *)_selectedQuiz.value;
+        [self showDirectInputArea:[info isUserEditQuiz]];
+        _txtQuizSelect.text = _selectedQuiz.title;
+    } else {
+        [self showDirectInputArea:NO];
+    }
+}
+
+- (void)requestInviteQuizList {
+    
+    NSString *path = [NSString stringWithFormat:API_POST_HOMEGROUP_INVITE_QUIZ];
+    
+    [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:nil modelClass:[QuizListModel class] completion:^(id responseObject) {
+        
+        QuizListModel *quizList = (QuizListModel *)responseObject;
+        
+        NSLog(@"Response : %@", responseObject);
+        _quizList = [[DataSelectListModel alloc] init];
+        _quizList.title = @"퀴즈 선택";
+        
+        for (QuizModel *info in quizList.quizList) {
+            DataSelectModel *data = [[DataSelectModel alloc] init];
+            data.title = info.quiz;
+            data.value = info;
+            [_quizList.list addObject:data];
+        }
+        
+    } failure:^(id errorObject) {
+        JDErrorModel *error = (JDErrorModel *)errorObject;
+        [[JDFacade facade] alert:error.errorMessage];
+    }];
+    
+}
+
+- (void)requestQuizUpdate{
+    QuizModel *quizInfo = (QuizModel *)_selectedQuiz.value;
+    NSLog(@"Quiz Info : %@", quizInfo);
+    
+    NSString *quiz = quizInfo.quiz;
+    if (quizInfo.isUserEditQuiz) {
+        quiz = [_txtSelfQuiz.text trim];
+    }
+    
+    //parameters
+    NSDictionary *parameter = @{@"type": @"quiz" ,
+                                @"quiz": quiz,
+                                @"quiz_id":quizInfo.quizId,
+                                @"status_code":quizInfo.statusCode,
+                                @"answer":answer};
+    
+    NSString *path = [[JDFacade facade] getUrlWithCustGroupIDAndMemberID:API_POST_MEMBER_UPDATE];
+
+    [[RequestHandler handler] sendAsyncPutRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
+        
+//        [JDFacade facade].loginUser.quiz = quiz;
+        UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"IDSetViewController" storyboardName:@"SignUp"];
+        
+        [self.navigationController pushViewController:vc animated:YES];
+        
+    } failure:^(id errorObject) {
+        JDErrorModel *error = (JDErrorModel *)errorObject;
+        [[JDFacade facade] alert:error.errorMessage];
+    }];
+}
+
+-(void)showQuizList{
+    [[JDFacade facade] selectDatas:self listInfo:_quizList completion:^(DataSelectModel *seleced) {
+        _selectedQuiz = seleced;
+        _txtQuizSelect.text = _selectedQuiz.title;
+        [self updateUI];
+        
+    }];
+}
+
+- (IBAction)btnCancelTouched:(id)sender {
+    [self dismissViewControllerAnimated:YES completion:nil];
+}
+
+- (IBAction)btnNextTouched:(id)sender {
+// TODO : 퀴즈 업데이트? cust,group id 없음
+//    [self requestQuizUpdate];
+    UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"IDSetViewController" storyboardName:@"SignUp"];
+    
+    [self.navigationController pushViewController:vc animated:YES];
+}
+
+- (IBAction)btnInputQuizTouched:(id)sender {
+    if (_popDate == nil) {
+        _popDate = [[CustomDatePopupView alloc] initWithTitle:@"정답 날짜 입력"];
+    }
+    
+    [_popDate showWithCompletion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
+        if (buttonIndex == 0) {//OK
+            NSLog(@"Input Date : %@%@%@", _popDate.txtYear.text, _popDate.txtMonth.text, _popDate.txtDay.text);
+            
+            NSString *date = [NSString stringWithFormat:@"%@%@%@",_popDate.txtYear.text,_popDate.txtMonth.text,_popDate.txtDay.text];
+            
+            answer = date;
+            if ([date isEqualToString:@""]) {
+                [_btnInputQuizAnswer setTitle:[CommonUtil currentDate2] forState:UIControlStateNormal];
+                answer = [CommonUtil currentDate3];
+            } else {
+                NSString *date = [NSString stringWithFormat:@"%@ / %@ / %@",_popDate.txtYear.text,_popDate.txtMonth.text,_popDate.txtDay.text];
+                [_btnInputQuizAnswer setTitle:date forState:UIControlStateNormal];
+            }
+            [_btnInputQuizAnswer setBackgroundImage:[UIImage imageNamed:@"img_input_round_bg_active"] forState:UIControlStateNormal];
+            [_btnInputQuizAnswer setTitleColor:kUITextColor01 forState:UIControlStateNormal];
+        }
+    }];
+}
+
+- (BOOL)isValidRequestInfo {
+    BOOL result = YES;
+    QuizModel *quizInfo = (_selectedQuiz != nil) ? (QuizModel *)_selectedQuiz.value : nil;
+    
+    if (result && quizInfo == nil)
+    {
+        result = NO;
+    }
+    
+    if (result && quizInfo.isUserEditQuiz)
+    {
+        if ([[_txtSelfQuiz.text trim] isEmptyString])
+        {
+            result = NO;
+        }
+    }
+    
+    return result;
+}
+
+-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
+    if ([textField isEqual:_txtQuizSelect]) {
+        [self showQuizList];
+        return NO;
+    }
+    return YES;
+}
+
+- (void)textFieldDidEndEditing:(UITextField *)textField{
+    if (_txtSelfQuiz.text.length > 0) {
+        
+        UIImage *active = [ImageUtil stretchedImage:[UIImage imageNamed:@"img_input_round_bg_active"] expectSize:CGSizeMake(_txtSelfQuiz.frame.size.width, _txtSelfQuiz.frame.size.height)];
+        [_txtSelfQuiz setBackground:active];
+        _btnNext.enabled = YES;
+    } else {
+        _btnNext.enabled = NO;
+    }
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+
+}
+
+@end

+ 26 - 0
OneCable/Classes/ViewControllers/SignUpScreens/SignUpTypeSelectViewController.h

@@ -0,0 +1,26 @@
+//
+//  SignUpTypeSelectViewController.h
+//  OneCable
+//
+//  Created by nComz on 2017. 5. 22..
+//  Copyright © 2017년 ntels. All rights reserved.
+//
+
+#import "JDViewController.h"
+
+@class CustomButton;
+
+@protocol signTypeDelegate <NSObject>
+
+- (void) signType:(NSString *)type;
+
+@end
+@interface SignUpTypeSelectViewController : JDViewController
+
+
+@property (weak, nonatomic) IBOutlet CustomButton *btnMasterSignUP;  // 마스터 회원가입 버튼
+@property (weak, nonatomic) IBOutlet CustomButton *btnMemSignUp;  // 멤버 회원가입 버튼
+@property (weak, nonatomic) IBOutlet CustomButton *btnCancel;  // 취소 버튼
+
+@property(weak, nonatomic) id <signTypeDelegate> delegate;
+@end

+ 61 - 0
OneCable/Classes/ViewControllers/SignUpScreens/SignUpTypeSelectViewController.m

@@ -0,0 +1,61 @@
+//
+//  SignUpTypeSelectViewController.m
+//  OneCable
+//
+//  Created by nComz on 2017. 5. 22..
+//  Copyright © 2017년 ntels. All rights reserved.
+//
+
+#import "SignUpTypeSelectViewController.h"
+#import "CustomButton.h"
+#import "CertificationViewController.h"
+#import "AgreementViewController.h"
+#import "RequestHandler.h"
+
+@interface SignUpTypeSelectViewController ()
+
+@end
+
+@implementation SignUpTypeSelectViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    
+    [self initUI];
+}
+
+- (void)initUI {
+    [self.navigationController.navigationBar setHidden:YES];
+    self.navigationController.interactivePopGestureRecognizer.enabled = NO;
+}
+
+// TODO : 마스터 가입 여부 전달 필요
+- (IBAction)btnMasterSignUpTouched:(id)sender {
+    
+    [self moveAgreementViewController];
+    [self.delegate signType:KNEET_MEMBER_MASTER];
+}
+
+// TODO : 멤버 가입 여부 전달 필요
+- (IBAction)btnMemSignUpTouched:(id)sender {
+    
+    [self moveAgreementViewController];
+    [self.delegate signType:KNEET_MEMBER_SIMPLE];
+}
+
+- (void)moveAgreementViewController{
+    AgreementViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"AgreementViewController" storyboardName:@"SignUp"];
+    
+    [self.navigationController pushViewController:vc animated:YES];
+}
+
+- (IBAction)btnCancelTouched:(id)sender {
+    [self dismissViewControllerAnimated:YES completion:nil];
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+
+}
+
+@end