ThingsAddCompleteViewController.m 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. //
  2. // ThingsAddCompleteViewController.m
  3. // kneet
  4. //
  5. // Created by Jason Lee on 5/26/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. #import "JDObject.h"
  9. #import "CustomLabel.h"
  10. #import "CustomButton.h"
  11. #import "ThingsAddCompleteViewController.h"
  12. #import "ThingsAddViewController.h"
  13. #import "QRCodeViewController.h"
  14. #import "SignUpCompleteViewController.h"
  15. #import "ThingsViewController.h"
  16. #import "ThingsAddWallpadSubViewController.h"
  17. #import "ThingsAddWallpadViewController.h"
  18. @interface ThingsAddCompleteViewController () {
  19. }
  20. @end
  21. #pragma mark - Class Definition
  22. @implementation ThingsAddCompleteViewController
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. // Do any additional setup after loading the view.
  26. [self initUI];
  27. [self prepareViewDidLoad];
  28. }
  29. - (void)initUI {
  30. if (IPHONE_HEIGHT == 460.0f) {
  31. _constraintImgvAvatarTop.constant -= 75.0f;
  32. }
  33. _lblTitle.text = NSLocalizedString(@"축하합니다!", @"축하합니다!");
  34. _lblDesc.text = NSLocalizedString(@"이제부터 '내 장치' 메뉴에서\n사용할 수 있습니다", @"이제부터 '내 장치' 메뉴에서\n사용할 수 있습니다");
  35. [_btnNext setTitle:NSLocalizedString(@"보러가기", @"보러가기") forState:UIControlStateNormal];
  36. [_btnAddMore setTitle:NSLocalizedString(@"장치 추가", @"장치 추가") forState:UIControlStateNormal];
  37. }
  38. - (void)prepareViewDidLoad {
  39. }
  40. #pragma mark - Main Logic
  41. #pragma mark - UI Events
  42. - (IBAction)btnNextTouched:(id)sender {
  43. [[JDFacade facade] gotoWishMenu:KNMenuIdThings]; //장치리스트로 이동.
  44. }
  45. - (IBAction)btnAddMoreTouched:(id)sender {
  46. ThingsViewController *tvc = [[JDFacade facade] viewControllerOnNaviationController:[ThingsViewController class]];
  47. if (tvc) {//장치 리스트를 갱신함.
  48. [tvc prepareViewDidLoad];
  49. }
  50. if ([self.presentingViewController.presentingViewController isKindOfClass:[QRCodeViewController class]]) {//QR코드로 등록한 경우,
  51. UIViewController *vc = self.presentingViewController.presentingViewController.presentingViewController.presentingViewController; //signup Complete
  52. if (vc) {//회원가입
  53. [[JDFacade facade] dismissViewControllerByPush:vc];
  54. } else {//디바이스 메뉴
  55. vc = self.presentingViewController.presentingViewController.presentingViewController;
  56. [[JDFacade facade] dismissViewControllerByPush:vc completion:^{
  57. ThingsAddViewController *vc = [[JDFacade facade] viewControllerOnNaviationController:[ThingsAddViewController class]];
  58. [[JDFacade facade].currentViewController.navigationController popToViewController:vc animated:NO];
  59. }];
  60. }
  61. } else {//cam, smartphone, wallpadsubtype
  62. if (self.presentingViewController.presentingViewController) {//회원가입, 디바이스 메뉴 - 월패드 하위디바이스
  63. UIViewController *vc = self.presentingViewController.presentingViewController; //signup Complete
  64. BOOL isWallpadSub = NO;
  65. if ([vc isKindOfClass:[UINavigationController class]]) {
  66. UINavigationController *nc = (UINavigationController *)vc;
  67. isWallpadSub = [nc.viewControllers.firstObject isKindOfClass:[ThingsAddWallpadSubViewController class]];
  68. }
  69. [[JDFacade facade] dismissViewControllerByPush:vc completion:^{
  70. if (tvc) {//월패드 하위 디바이스
  71. ThingsAddViewController *vc = [[JDFacade facade] viewControllerOnNaviationController:[ThingsAddViewController class]];
  72. [[JDFacade facade].currentViewController.navigationController popToViewController:vc animated:NO];
  73. } else if (isWallpadSub) {
  74. UIViewController *pvc = [JDFacade facade].currentViewController.presentedViewController.presentedViewController.presentedViewController;
  75. [pvc dismissViewControllerAnimated:NO completion:nil];
  76. }
  77. }];
  78. } else {//디바이스 메뉴
  79. [[JDFacade facade] dismissViewControllerByPush:self completion:^{
  80. ThingsAddViewController *vc = [[JDFacade facade] viewControllerOnNaviationController:[ThingsAddViewController class]];
  81. [[JDFacade facade].currentViewController.navigationController popToViewController:vc animated:NO];
  82. }];
  83. }
  84. }
  85. }
  86. #pragma mark - MemoryWarning
  87. - (void)didReceiveMemoryWarning
  88. {
  89. [super didReceiveMemoryWarning];
  90. // Dispose of any resources that can be recreated.
  91. }
  92. @end