| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- //
- // ConfirmPasswdPopupView.m
- // OneCable
- //
- // Created by Jason Lee on 01/14/15.
- // Copyright (c) 2016 ntels. All rights reserved.
- //
- #import "JDObject.h"
- #import "RequestHandler.h"
- #import "JDJSONModel.h"
- #import "CustomLabel.h"
- #import "CustomTextField.h"
- #import "ValidateUtil.h"
- #import "ConfirmPasswdPopupView.h"
- #import "PwdPopupView.h"
- @interface ConfirmPasswdPopupView () <CustomTextFieldDelegate>
- {
- }
- @end
- @implementation ConfirmPasswdPopupView
- - (id)initFromNib {
- for (UIView *view in [CommonUtil nibViews:@"ConfirmPasswdPopupView"]) {
- if ([view isKindOfClass:[ConfirmPasswdPopupView class]]) {
- self = (ConfirmPasswdPopupView *)view;
- //XIB의 경우, 현재 화면 사이즈로 맞춰줘야 함.
- self.frame = [UIScreen mainScreen].bounds;
-
- _txtPasswd.keyboardType = UIKeyboardTypeDefault;
- _txtPasswd.returnKeyType = UIReturnKeyDone;
-
- //Localization
- [self.btnConfirm setTitle:NSLocalizedString(@"확인", @"확인") forState:UIControlStateNormal];
- [self.btnCancel setTitle:NSLocalizedString(@"취소", @"취소") forState:UIControlStateNormal];
- }
- }
- return self;
- }
- - (void)didMoveToSuperview {
- if (!self.superview) {
- return;
- }
- _txtPasswd.customTextFieldSuperview = CustomTextFieldSuperviewIsPopupContentView;
- }
- #pragma mark - Main Logic
- - (void)requestCheckUserPasswd {
- //parameters
- NSDictionary *parameter = @{@"password": _txtPasswd.text};
-
- NSString *path = [NSString stringWithFormat:API_GET_CHECK_PWD, [JDFacade facade].loginUser.memberId];
-
- [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
-
- [self loadPopup];
-
- } failure:^(id errorObject) {
- JDErrorModel *error = (JDErrorModel *)errorObject;
- [[JDFacade facade] alert:error.errorMessage];
- }];
- }
- - (void)loadPopup {
-
- PwdPopupView *popup = [[PwdPopupView alloc] initFromNib];
- [popup show];
-
- [super btnConfirmTouched:nil];
- }
- #pragma mark - UI Events
- - (IBAction)btnConfirmTouched:(id)sender {
- //validate
- if (![ValidateUtil validateTextfiled:_txtPasswd type:ValidateTypeNull title:@"비밀번호"]) {
- return;
- }
-
- [self requestCheckUserPasswd];
- }
- #pragma mark - CustomTextField
- - (BOOL)textFieldShouldReturn:(UITextField *)textField {
- if ([textField isEqual:_txtPasswd]) {
- [self btnConfirmTouched:nil];
- }
- return YES;
- }
- @end
|