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