LoginViewController.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. //
  2. // LoginViewController.m
  3. // kneet
  4. //
  5. // Created by Jason Lee on 2/4/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. @import QuartzCore;
  9. #import "RequestHandler.h"
  10. #import "CustomTextField.h"
  11. #import "CustomButton.h"
  12. #import "JDJSONModel.h"
  13. #import "LoginModel.h"
  14. #import "LoginViewController.h"
  15. #import "CustomLabel.h"
  16. #import "CustomCheckBox.h"
  17. #import "KeychainItemWrapper.h"
  18. #import "NewMobileViewController.h"
  19. #import "ValidateUtil.h"
  20. #import "CustomAlertView.h"
  21. #import "CustomImageView.h"
  22. #import "PwdPopupView.h"
  23. #import "QuizSetViewController.h"
  24. //#import "MobilesOverViewController.h"
  25. //#import "InvitationListViewController.h"
  26. /**
  27. ID / PW Input Box Text Color
  28. - 기본 : kUITextColor01
  29. - Hint : kUITextColor03
  30. - Disable : kUITextColor06
  31. 로그인 유지 / 아이디 저장 Text Color : kUITextColor01
  32. 아이디 찾기 / 비밀번호 찾기 / 회원가입하기 Text Color
  33. - 아이디 찾기,비밀번호 찾기 : kUITextColor01
  34. - 회원가입 하기 : kUITextColor04
  35. **/
  36. @interface LoginViewController () <CustomTextFieldDelegate,dismissQuizViewDelegate> {
  37. }
  38. @end
  39. #pragma mark - Class Definition
  40. @implementation LoginViewController
  41. - (void)viewDidLoad {
  42. [super viewDidLoad];
  43. // Do any additional setup after loading the view.
  44. [self initUI];
  45. [self prepareViewDidLoad];
  46. }
  47. - (void)initUI {
  48. _btnLogin.enabled = NO;
  49. [self.btnLogin setBackgroundImage:[UIImage imageNamed:@"img_btn_common_active"] forState:UIControlStateNormal capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  50. [self.btnLogin setBackgroundImage:[UIImage imageNamed:@"img_btn_common_press"] forState:UIControlStateHighlighted capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  51. [self.btnLogin setBackgroundImage:[UIImage imageNamed:@"img_btn_common_disable"] forState:UIControlStateDisabled capInsets:UIEdgeInsetsMake(kfTopInset,kfRightInset,kfBottomInset,kfLeftInset)];
  52. [self.lblFindId setHidden:YES];
  53. CGRect screen = [UIScreen mainScreen].bounds;
  54. if (screen.size.height == 480) {//iphone4s
  55. [_imgvBg setImage:[UIImage imageNamed:@"img_login_bg_4inch"]];
  56. } if (screen.size.height == 667.0f) {//iphone6
  57. _constraintLeftPadding.constant *= 1.25;
  58. _constraintRightPadding.constant *= 1.25;
  59. } else if (screen.size.height == 736.0f) {//iphone6 plus
  60. _constraintLeftPadding.constant *= 1.5;
  61. _constraintRightPadding.constant *= 1.5;
  62. }
  63. // [self.view layoutIfNeeded];
  64. _txtEmail.customTextFieldSuperview = CustomTextFieldSuperviewIsScrollView;
  65. _txtPasswd.customTextFieldSuperview = CustomTextFieldSuperviewIsScrollView;
  66. _txtPasswd.secureTextEntry = YES;
  67. _txtEmail.keyboardType = UIKeyboardTypeDefault;
  68. _txtPasswd.keyboardType = UIKeyboardTypeDefault;
  69. _txtEmail.returnKeyType = UIReturnKeyNext;
  70. _txtPasswd.returnKeyType = UIReturnKeyDone;
  71. _txtPasswd.delegate = self;
  72. _txtEmail.delegate = self;
  73. //Localization
  74. [_chkAutoLogin setTitle:NSLocalizedString(@"로그인 유지", @"로그인 유지") forState:UIControlStateNormal];
  75. [_chkIdSave setTitle:NSLocalizedString(@"아이디 저장", @"아이디 저장") forState:UIControlStateNormal];
  76. _txtEmail.placeholder = NSLocalizedString(@"아이디", @"아이디");
  77. _txtPasswd.placeholder = NSLocalizedString(@"비밀번호", @"비밀번호");
  78. _lblSignUp.text = NSLocalizedString(@"회원가입하기", @"회원가입하기");
  79. _lblFindId.text = NSLocalizedString(@"아이디/비번찾기", @"아이디/비번찾기");
  80. // [_lblSignUp setUnderLine:_lblSignUp.text];
  81. [_lblSignUp addTouchEventHandler:^(id label) {
  82. [self lblSignUpTouched];
  83. }];
  84. [_lblFindId setUnderLine:_lblFindId.text];
  85. [_lblFindId addTouchEventHandler:^(id label) {
  86. [self lblFindIdTouched];
  87. }];
  88. }
  89. - (void)prepareViewDidLoad {
  90. [RequestHandler handler].authorization = nil;
  91. BOOL autoLogin = [[[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_AUTO_LOGIN] boolValue];
  92. BOOL idSave = [[[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_SAVE_ID] boolValue];
  93. _chkAutoLogin.checked = [[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_AUTO_LOGIN] != nil ? autoLogin : YES;
  94. _chkIdSave.checked = [[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_SAVE_ID] != nil ? idSave : YES;
  95. if (autoLogin) {
  96. [self requestAutoLogin];
  97. // _txtEmail.text = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  98. // _txtPasswd.text = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_PWD];
  99. //
  100. // [self btnLogInTouched:_btnLogin];
  101. }
  102. if (idSave) {
  103. NSLog(@"Save ID : %@", [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID]);
  104. _txtEmail.text = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  105. }
  106. }
  107. #pragma mark - Main Logic
  108. - (void)requestLogin {
  109. SocketRequestModel *request = [[SocketRequestModel alloc] initWithMsgType:MSG_TYPE_LOGIN];
  110. NSDictionary *param = @{@"member_id": [_txtEmail.text trim],
  111. @"password": [_txtPasswd.text trim],
  112. @"os_type": MOBILE_DEVICE_TYPE,
  113. @"device_token": [JDFacade facade].APNSToken ? [JDFacade facade].APNSToken : ksEmptyString};
  114. [request setRequestMsg:param];
  115. [self sendDataToSocket:request modelClass:[LoginModel class] isLoading:YES];
  116. }
  117. //자동로그인 요청
  118. - (void)requestAutoLogin {;
  119. LoginModel *tmpInfo = [[LoginModel alloc] init];
  120. tmpInfo.memberId = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  121. tmpInfo.authToken = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_AUTOTOKEN];
  122. SocketRequestModel *request = [[SocketRequestModel alloc] initWithMsgType:MSG_TYPE_AUTO_LOGIN];
  123. NSDictionary *param = @{@"Authorization": tmpInfo.authorization,
  124. @"device_token": [JDFacade facade].APNSToken ? [JDFacade facade].APNSToken : ksEmptyString,
  125. @"os_type": MOBILE_DEVICE_TYPE};
  126. [request setRequestMsg:param];
  127. [self sendDataToSocket:request modelClass:[LoginModel class] isLoading:YES];
  128. // NSString *path = [NSString stringWithFormat:API_GET_SIGN_IN_AUTO];
  129. //
  130. // [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:parameter modelClass:[LoginModel class] completion:^(id responseObject) {
  131. // if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
  132. // return;
  133. // }
  134. //
  135. // LoginModel *loginInfo = (LoginModel *)responseObject;
  136. //
  137. // if (loginInfo) {//API 성공 ,함
  138. // [self actionForLoginSucceed:loginInfo];
  139. //
  140. // }
  141. // } failure:^(id errorObject) {
  142. // JDErrorModel *error = (JDErrorModel *)errorObject;
  143. //
  144. // if ([error.errorCode isEqualToString:API_RESPONSE_UNAUTHORIZED_DEVICE]) {//새로운 단말 인증 필요
  145. // [self actionForNeedsRegisteringNewDevice:error.nickname];
  146. // } else {
  147. // [[JDFacade facade] alert:error.errorMessage];
  148. // }
  149. // }];
  150. }
  151. //인증 메일 재요청
  152. - (void)requestAuthMail {
  153. //parameters
  154. NSDictionary *parameter = @{@"email_id": [JDFacade facade].tmpEmailId};
  155. NSString *path = [NSString stringWithFormat:API_POST_AUTH_MAIL];
  156. [[RequestHandler handler] sendAsyncPostRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
  157. if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
  158. return;
  159. }
  160. JDJSONModel *result = (JDJSONModel *) responseObject;
  161. if (result) {//API 성공 ,
  162. [[JDFacade facade] toast:NSLocalizedString(@"인증 메일이 발송되었습니다", @"인증 메일이 발송되었습니다")];
  163. }
  164. } failure:^(id errorObject) {
  165. JDErrorModel *error = (JDErrorModel *)errorObject;
  166. [[JDFacade facade] alert:error.errorMessage];
  167. }];
  168. }
  169. //로그인 이후 처리.
  170. - (void)actionForLoginSucceed:(LoginModel *)loginInfo {
  171. if (loginInfo) {//API 성공함
  172. [JDFacade facade].loginUser = loginInfo;
  173. // [JDFacade facade].loginUser.gradeCode = KNEET_MEMBER_MASTER;
  174. // [JDFacade facade].loginUser.level = 90;
  175. NSLog(@"%@", [JDFacade facade].loginUser);
  176. if ([[JDFacade facade].loginUser.emailId isEqualToString:[JDFacade facade].tmpEmailId]) {
  177. [JDFacade facade].tmpEmailId = ksEmptyString;
  178. }
  179. if ([[JDFacade facade].loginUser.emailId isEqualToString:[JDFacade facade].loginUser.newEmailId]) {//이메일 변경 요청 중
  180. [JDFacade facade].loginUser.newEmailId = ksEmptyString;
  181. }
  182. [RequestHandler handler].authorization = loginInfo.authorization;
  183. [[JDFacade facade] storeObjectToUserDefaults:@(_chkAutoLogin.checked) forKey:USDEF_APP_AUTO_LOGIN];
  184. [[JDFacade facade] storeObjectToUserDefaults:@(_chkIdSave.checked) forKey:USDEF_APP_SAVE_ID];
  185. if (_chkAutoLogin.checked) {//자동로그인 설정 시, 인증 토큰 저장
  186. [[JDFacade facade] storeObjectToKeychain:loginInfo.memberId forKey:USDEF_SESSION_LOGIN_ID];
  187. [[JDFacade facade] storeObjectToKeychain:loginInfo.authToken forKey:USDEF_SESSION_AUTOTOKEN];
  188. } else {
  189. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_AUTOTOKEN];
  190. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_PWD];
  191. if (!_chkIdSave.checked) {
  192. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_ID];
  193. }
  194. }
  195. if (_chkIdSave.checked) {
  196. [[JDFacade facade] storeObjectToKeychain:[_txtEmail.text trim] forKey:USDEF_SESSION_LOGIN_ID];
  197. } else {
  198. if (!_chkAutoLogin.checked) {
  199. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_ID];
  200. }
  201. }
  202. [self actionAfterLogin];
  203. }
  204. }
  205. //퀴즈 설정 메뉴 dismiss 시
  206. - (void)dismissQuizView {
  207. [self actionAfterInvitaion];
  208. }
  209. //홈그룹 체크 및 대시보드 이동
  210. - (void)actionAfterLogin {
  211. if ([[JDFacade facade].loginUser.quiz isEqualToString:@""]) {
  212. QuizSetViewController *vc = (QuizSetViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"QuizSetViewController" storyboardName:@"Main"];
  213. vc.delegate = self;
  214. [self presentViewController:vc animated:YES completion:nil];
  215. return;
  216. }
  217. if ([[JDFacade facade].loginUser.invitationsCount integerValue] > 0) {
  218. [self actionForInvitation];
  219. return;
  220. }
  221. [self actionAfterInvitaion];
  222. }
  223. //초대알림 화면으로 이동
  224. - (void)actionForInvitation {
  225. [[JDFacade facade] loadInvitationView];
  226. }
  227. //초대화면 액션이 종료된 후,
  228. - (void)actionAfterInvitaion {
  229. //메인으로 이동
  230. [self gotoMainView];
  231. }
  232. //새로운 단말 인증 필요 - 화면 이동
  233. - (void)actionForNeedsRegisteringNewDevice:(NSString *)nickname {
  234. NewMobileViewController *vc = (NewMobileViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"NewMobileViewController" storyboardName:@"SignUp"];
  235. vc.checkedAutoLogin = _chkAutoLogin.checked;
  236. vc.nickname = nickname;
  237. [[JDFacade facade] presentViewControllerByPush:vc pvc:self];
  238. }
  239. //단말대수 초과
  240. - (void)actionForMobilesOver:(NSArray<MobileDeviceModel> *)deviceList {
  241. //SHA-2
  242. }
  243. //인증대기중 - 화면 이동
  244. - (void)actionForWaiting {
  245. NSString *message1 = [NSString stringWithFormat:@"%@에서\n인증 메일을 확인하세요", [JDFacade facade].tmpEmailId];
  246. NSString *message2 = @"\n\n메일을 확인할 수 없는 경우에는\n스팸 메일함을 확인해보세요";
  247. CustomAlertView *alert = [[CustomAlertView alloc] initWithTitle:@"메일을 확인하세요" message:[NSString stringWithFormat:@"%@%@", message1, message2] delegate:nil OKButtonTitle:@"확인" cancelButtonTitle:nil];
  248. [alert.lblMessage1 setColor:kUITextColor02 text:message1];
  249. [alert showWithCompletion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
  250. if (buttonIndex == 1) {//재발송
  251. [self requestAuthMail];
  252. }
  253. }];
  254. }
  255. - (void)gotoMainView {
  256. // UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SignUpCompleteViewController" storyboardName:@"SignUp"];
  257. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"MainViewController" storyboardName:@"Main"];
  258. [JDFacade facade].mainViewController = (MainViewController *)vc;
  259. [[JDFacade facade].appDelegate.window setRootViewController:vc];
  260. }
  261. - (void)requestLogout {
  262. [JDFacade facade].loginUser = nil;
  263. [self actionAfterLogout];
  264. // NSDictionary *param = @{API_AUTHORIZATION_KEY: [[JDFacade facade].loginUser authorization],
  265. // @"message_type": @"auth.out"};
  266. //
  267. // [self sendDataToSocket:param];
  268. //parameters
  269. // [self actionAfterLogout];
  270. // NSString *path = [NSString stringWithFormat:API_POST_SIGN_OUT];
  271. //
  272. // [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:nil modelClass:[JDJSONModel class] completion:^(id responseObject) {
  273. // [self actionAfterLogout];
  274. //
  275. // } failure:^(id errorObject) {
  276. // JDErrorModel *error = (JDErrorModel *)errorObject;
  277. // [[JDFacade facade] alert:error.errorMessage];
  278. // }];
  279. }
  280. - (void)actionAfterLogout {
  281. //자동 로그인 설정 - 취소
  282. [[JDFacade facade] storeObjectToUserDefaults:@(NO) forKey:USDEF_APP_AUTO_LOGIN];
  283. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_AUTOTOKEN];
  284. if (![[[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_SAVE_ID] boolValue]) {
  285. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_ID];
  286. }
  287. [JDFacade facade].loginUser = nil;
  288. [self closeSocket];
  289. //root view 변경
  290. [[JDFacade facade].appDelegate.window setRootViewController:self];
  291. }
  292. #pragma mark - UI Events
  293. - (IBAction)btnLogInTouched:(id)sender {
  294. //#ifdef DEBUG_MODE
  295. // if ([_txtEmail.text isEmptyString]) {
  296. // _txtEmail.text = @"asura77";//@"smiles1080";
  297. // }
  298. //
  299. // if ([_txtPasswd.text isEmptyString]) {
  300. // _txtPasswd.text = @"12345678a";//@"12341234aa";
  301. //
  302. // }
  303. //#endif
  304. // TODO : 아이디 형식 검사할것
  305. // if (![ValidateUtil validateTextfiled:_txtEmail type:ValidateTypeEmail title:@"이메일" ]) {
  306. // return;
  307. // }
  308. if (![ValidateUtil validateTextfiled:_txtEmail type:ValidateTypeNull title:@"비밀번호" ]) {
  309. return;
  310. }
  311. [JDFacade facade].tmpEmailId = [_txtEmail.text trim];
  312. [JDFacade facade].tmpPassword = [_txtPasswd.text trim];
  313. [self requestLogin];
  314. }
  315. //회원가입 호출
  316. - (void)lblSignUpTouched {
  317. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SignUpTypeSelectViewController" storyboardName:@"SignUp"];
  318. UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
  319. [self presentViewController:m_navi animated:YES completion:nil];
  320. }
  321. - (void)lblFindIdTouched {
  322. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ResetPwdViewController" storyboardName:@"SignUp"];
  323. [self presentViewController:vc animated:YES completion:nil];
  324. }
  325. // 아이디 찾기 호출
  326. - (IBAction)btnIdFindTouched:(id)sender {
  327. NSLog(@"아이디 찾기");
  328. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"IdFindViewController" storyboardName:@"SignUp"];
  329. UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
  330. [self presentViewController:m_navi animated:YES completion:nil];
  331. }
  332. // 비밀번호 찾기 호출
  333. - (IBAction)btnPwFindTouched:(id)sender {
  334. NSLog(@"비밀번호 찾기");
  335. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"PwFindViewController" storyboardName:@"SignUp"];
  336. UINavigationController *m_navi =[[UINavigationController alloc]initWithRootViewController:vc];
  337. [self presentViewController:m_navi animated:YES completion:nil];
  338. }
  339. #pragma mark - CustomTextField
  340. - (BOOL)textFieldShouldReturn:(UITextField *)textField {
  341. if ([textField isEqual:_txtEmail])
  342. {
  343. [_txtPasswd becomeFirstResponder];
  344. }
  345. if ([textField isEqual:_txtPasswd])
  346. {
  347. [self btnLogInTouched:nil];
  348. }
  349. return YES;
  350. }
  351. - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
  352. NSString *text = [textField.text stringByReplacingCharactersInRange:range withString:string];
  353. NSString *userID = [textField isEqual:_txtEmail] ? text : _txtEmail.text;
  354. NSString *userPW = [textField isEqual:_txtPasswd] ? text : _txtPasswd.text;
  355. _btnLogin.enabled = userID.length >= 6 && userPW.length >= 8;
  356. return YES;
  357. }
  358. //다음
  359. - (void)moveToNextField:(id)sender {
  360. [_txtPasswd becomeFirstResponder] ;
  361. }
  362. #pragma mark - SocketService
  363. - (void) socketDidReceiveMessage:(id)message result:(SocketModel *)result
  364. {
  365. NSLog(@"Result Info : %@", result);
  366. NSLog(@"Result Info : %@", message);
  367. SWITCH(result.messageType)
  368. {
  369. CASE (MSG_TYPE_LOGIN)
  370. {
  371. [[JDFacade facade] loadIndicator:NO allowUserInteraction:YES];
  372. if (result.isSuccess) {
  373. LoginModel *loginInfo = (LoginModel *)message;
  374. [self actionForLoginSucceed:loginInfo];
  375. }
  376. else
  377. {
  378. //[[JDFacade facade] toast:result.resultMsg];
  379. [[JDFacade facade] alertTitle:@"알림" message:result.resultMsg];
  380. }
  381. break;
  382. }
  383. CASE (MSG_TYPE_AUTO_LOGIN)
  384. {
  385. [[JDFacade facade] loadIndicator:NO allowUserInteraction:YES];
  386. if (result.isSuccess) {
  387. LoginModel *loginInfo = (LoginModel *)message;
  388. loginInfo.memberId = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
  389. loginInfo.authToken = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_AUTOTOKEN];
  390. [self actionForLoginSucceed:loginInfo];
  391. }
  392. else
  393. {
  394. [[JDFacade facade] alertTitle:@"알림" message:result.resultMsg];
  395. // [[JDFacade facade] toast:result.resultMsg];
  396. }
  397. break;
  398. }
  399. CASE(@"auth.out")
  400. {
  401. if (result.isSuccess) {
  402. [self actionAfterLogout];
  403. }
  404. else {
  405. NSLog(@"Result Info : %@", result);
  406. }
  407. }
  408. DEFAULT
  409. {
  410. break;
  411. }
  412. }
  413. }
  414. - (void) socketDidFailWithError:(NSError *)error {
  415. [[JDFacade facade] loadIndicator:NO allowUserInteraction:YES];
  416. }
  417. #pragma mark - MemoryWarning
  418. - (void)didReceiveMemoryWarning
  419. {
  420. [super didReceiveMemoryWarning];
  421. // Dispose of any resources that can be recreated.
  422. }
  423. @end