ThingsAddCompleteViewController.m 4.5 KB

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