ThingsAddStartViewController.m 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // ThingsAddStartViewController.m
  3. // kneet2
  4. //
  5. // Created by Jason Lee on 11/13/15.
  6. // Copyright © 2015 ntels. All rights reserved.
  7. //
  8. #import "JDObject.h"
  9. #import "CustomLabel.h"
  10. #import "CustomButton.h"
  11. #import "CustomImageView.h"
  12. #import "ThingsAddIncludeViewController.h"
  13. #import "ThingsAddInitViewController.h"
  14. #import "ThingsAddStartViewController.h"
  15. #import "DeviceModel.h"
  16. @interface ThingsAddStartViewController () {
  17. }
  18. @end
  19. // 가스 밸브 타이틀 : 가스 밸브 삭제
  20. // 가스 밸브 삭제 코멘트 : 안정적인 장치 추가를 위해 초기화 작업을 먼저 진행합니다.
  21. // 가스 벨브 장치 추가 코멘트 : 배터리가 제대로 장착되었는지 확인하시고 시작 버튼을 누르세요.
  22. // 가스 밸브 이미지명 : img_things_product_addimg_01_smartgasvalve
  23. // 도어센서 타이틀 : 도어 센서 추가
  24. // 도어센서 초기화 코멘트 : 동일
  25. // 도어센서 장치추가 코멘트 : 동일
  26. // 도어센서 이미지 명 : img_things_product_addimg_02_mutisensor_door
  27. // 스마트플러그 타이틀 : 스마트 플러그 추가
  28. // 스마트플러그 초기화 코멘트 : 동일
  29. // 스마트플러그 장치추가 코멘트 : 동일
  30. // 스마트플러그 이미지 명 : img_things_product_addimg_03_smartplug
  31. #pragma mark - Class Definition
  32. @implementation ThingsAddStartViewController
  33. - (void)viewDidLoad {
  34. [super viewDidLoad];
  35. // Do any additional setup after loading the view.
  36. [self initUI];
  37. [self prepareViewDidLoad];
  38. }
  39. - (void)initUI {
  40. // if (_addableDevice) {
  41. // [_btnDoStart setTitle:@"시작" forState:UIControlStateNormal];
  42. // _lblComment.text = @"장치 근처로 이동 후\n추가시작 버튼을 누르세요";
  43. //
  44. // } else if (_removableDevice) {
  45. // [_btnDoStart setTitle:@"삭제 시작" forState:UIControlStateNormal];
  46. // _lblComment.text = @"장치 근처로 이동 후\n삭제시작 버튼을 누르세요";
  47. // }
  48. _lblSensorName.text = [NSString stringWithFormat:@"%@ 추가", _addDevice.prdName];
  49. _imgThings.image = [_addDevice imgaeForAddDel];
  50. _lblManufacturer.text = [_addDevice manufacturerName];
  51. }
  52. - (void)viewDidAppear:(BOOL)animated {
  53. [super viewDidAppear:animated];
  54. [UIView animateWithDuration:kfAnimationDur animations:^{
  55. _maskView.alpha = 0.7;
  56. } completion:^(BOOL finished) {
  57. _constraintPopViewTop.constant = (IPHONE_HEIGHT - _popView.height) / 2;
  58. [UIView animateWithDuration:kfAnimationDur animations:^{
  59. [self.view layoutIfNeeded];
  60. }];
  61. }];
  62. }
  63. - (void)prepareViewDidLoad {
  64. // if (_addableDevice) {//inclusion
  65. // _lblSensorName.text = _addableDevice[@"nodeName"];
  66. // _lblManufacturer.text = _addableDevice[@"manufacturer"];
  67. //
  68. // } else if (_removableDevice) {//exclusion
  69. // _lblSensorName.text = _removableDevice.deviceName;
  70. //
  71. // if (_removableGroups) {
  72. // NSMutableString *groups = [[NSMutableString alloc] init];
  73. // for (DeviceModel *device in _removableGroups) {
  74. // NSString *prefix = [groups isEmptyString] ? ksEmptyString : @",";
  75. // [groups appendFormat:@"%@%@", prefix, device.deviceName];
  76. // }
  77. //
  78. // _lblManufacturer.text = [NSString stringWithFormat:@"이 장치를 삭제하면 %@도 함께 삭제됩니다", groups];
  79. // _lblManufacturer.backgroundColor = kUITextColor02;
  80. // }
  81. // }
  82. }
  83. #pragma mark - Main Logic
  84. #pragma mark - UI Events
  85. - (void)btnAddTouched:(id)sender {
  86. if ([[JDFacade facade].loginUser.homehubOnlineState isEqualToString:@"OFF"]) {
  87. [[JDFacade facade] toast:@"홈허브가 온라인 상태로\r연결되어 있을 때 시도해주세요"];
  88. return;
  89. }
  90. ThingsAddInitViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ThingsAddInitViewController" storyboardName:@"Things"];
  91. // vc.addableDevice = _addableDevice;
  92. // vc.removableDevice = _removableDevice;
  93. vc.addDevice = _addDevice;
  94. vc.selectHub = _selectHub;
  95. [self showTransparencyModalView:vc];
  96. }
  97. - (void)btnCancelTouched:(id)sender {
  98. // [UIView animateWithDuration:kfAnimationDur animations:^{
  99. // _maskView.alpha = 0.0;
  100. // } completion:^(BOOL finished) {
  101. // [self dismissViewControllerAnimated:YES completion:nil];
  102. // }];
  103. [self dismissViewControllerAnimated:YES completion:nil];
  104. }
  105. #pragma mark - MemoryWarning
  106. - (void)didReceiveMemoryWarning
  107. {
  108. [super didReceiveMemoryWarning];
  109. // Dispose of any resources that can be recreated.
  110. }
  111. @end