SettingsViewController.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. //
  2. // SettingsViewController.m
  3. // kneet2
  4. //
  5. // Created by Jason Lee on 10/8/15.
  6. // Copyright (c) 2015 ntels. All rights reserved.
  7. //
  8. #import "JDObject.h"
  9. #import "RequestHandler.h"
  10. #import "CustomLabel.h"
  11. #import "CustomButton.h"
  12. #import "CustomCheckBox.h"
  13. #import "UIButton+WebCache.h"
  14. #import "CustomTableView.h"
  15. #import "WebBrowseViewController.h"
  16. #import "PwdPopupView.h"
  17. #import "ImageUtil.h"
  18. #import "SettingsViewController.h"
  19. #import "AdminAuthPopupView.h"
  20. #import "DeleteAccountPopupView.h"
  21. #import "ChangeNamePopupView.h"
  22. #import "ConfirmPasswdPopupView.h"
  23. #import "ChangeEmailPopupView.h"
  24. #import "ChangePhotoPopupView.h"
  25. #import "ManagementViewController.h"
  26. #import "HomeModeMovementViewController.h"
  27. #define kiAccountCellHeight 555
  28. #define kiNotiCellHeight 137
  29. #define kiServiceCellHeight 143
  30. #define kiVersionCellHeight 137
  31. #define kiDeleteCellHeight 82
  32. //#define kiPasswdCellHeight 135
  33. #define kiPhotoAlbum 0
  34. #define kiPhotoCamera 1
  35. #define kiPhotoDelete 2
  36. @implementation SettingsAccountTableViewCell
  37. - (void)awakeFromNib {
  38. }
  39. - (void)didMoveToSuperview {
  40. // [_lblChangeNickname setUnderLine:_lblChangeNickname.text];
  41. // [_lblChangePassword setUnderLine:_lblChangePassword.text];
  42. // [_lblChangeEmail setUnderLine:_lblChangeEmail.text];
  43. // [_lblChangePassword setHidden:NO];
  44. [_lblChangeEmail setHidden:YES];
  45. [_lblEmailWaiting setHidden:YES];
  46. _btnProfile.layer.frame = CGRectMake(0, 0, _btnProfile.frame.size.width, _btnProfile.frame.size.width);
  47. _btnProfile.layer.masksToBounds = YES;
  48. _btnProfile.layer.cornerRadius = _btnProfile.frame.size.width/2;
  49. _contraintEmailChangeBottom.constant = ![JDFacade facade].tmpEmailId || [[JDFacade facade].tmpEmailId isEmptyString] ? 18 : 45;
  50. _lblEmailWaiting.hidden = ![JDFacade facade].tmpEmailId || [[JDFacade facade].tmpEmailId isEmptyString];
  51. [self layoutIfNeeded];
  52. }
  53. @end
  54. @implementation SettingsNotificationTableViewCell
  55. @end
  56. @implementation SettingsServiceTableViewCell
  57. - (void)didMoveToSuperview {
  58. }
  59. @end
  60. @implementation SettingsVersionTableViewCell
  61. @end
  62. @implementation SettingsDeleteTableViewCell
  63. @end
  64. //@implementation SettingsPasswdTableViewCell
  65. //
  66. //@end
  67. @interface SettingsViewController () <UITableViewDataSource, UITableViewDelegate, ImageUtilDelegate,changePhotoDelegate> {
  68. CustomCheckBox *_chkAutoLogin, *_chkHomeModeChange, *_chkHomeEmptyChange;
  69. CustomButton *_btnProfile;
  70. BOOL _isNotFirstLoading;
  71. DashboardModel *_dashboard;
  72. ImageUtil *_imageUtil;
  73. }
  74. @end
  75. #pragma mark - Class Definition
  76. @implementation SettingsViewController
  77. @synthesize dashboardModel;
  78. - (void)viewDidLoad {
  79. [super viewDidLoad];
  80. // Do any additional setup after loading the view.
  81. [self initUI];
  82. [self prepareViewDidLoad];
  83. }
  84. - (void)viewWillAppear:(BOOL)animated {
  85. [_tableView reloadData];
  86. [super viewWillAppear:animated];
  87. }
  88. - (void)initUI {
  89. [self.navigationController.navigationBar setHidden:YES];
  90. self.navigationController.interactivePopGestureRecognizer.enabled = NO;
  91. //set tableview option
  92. [self initTableViewAsDefaultStyle:_tableView];
  93. }
  94. - (void)prepareViewDidLoad {
  95. }
  96. #pragma mark - Main Logic
  97. - (void)requestUpdatePushSetting:(NSDictionary *)parameter {
  98. //parameters
  99. NSString *path = [NSString stringWithFormat:API_POST_PUSH_SETTINGS];
  100. [[RequestHandler handler] sendAsyncPostRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
  101. NSString *msg = nil;
  102. if ([parameter hasKey:@"push_type_mode_chg_yn"]) {
  103. BOOL isNotifyHomeModeChange = [[parameter valueForKey:@"push_type_mode_chg_yn"] boolValue];
  104. if ([[JDFacade facade].loginUser.pushTypeModeChgYn boolValue] != isNotifyHomeModeChange) {
  105. msg = isNotifyHomeModeChange ? @"지금부터 홈모드가 바뀔 때\n푸시 알림을 받습니다" : @"홈모드 변경 알림을 해제합니다";
  106. [JDFacade facade].loginUser.pushTypeModeChgYn = [parameter valueForKey:@"push_type_mode_chg_yn"];
  107. }
  108. } else if ([parameter hasKey:@"push_type_prsnc_chg_yn"]) {//와이파이,
  109. BOOL isNotifyExecutingRules = [[parameter valueForKey:@"push_type_prsnc_chg_yn"] boolValue];
  110. if ([[JDFacade facade].loginUser.pushTypePrsncChgYn boolValue] != isNotifyExecutingRules) {
  111. msg = isNotifyExecutingRules ? @"지금부터 집이 빌 때\n푸시 알림을 받습니다" : @"빈 집 알림을 해제합니다";
  112. [JDFacade facade].loginUser.pushTypePrsncChgYn = [parameter valueForKey:@"push_type_prsnc_chg_yn"];
  113. }
  114. }
  115. [[JDFacade facade] toast:msg];
  116. } failure:^(id errorObject) {
  117. JDErrorModel *error = (JDErrorModel *)errorObject;
  118. [[JDFacade facade] alert:error.errorMessage];
  119. }];
  120. }
  121. - (void)requestUpdateProfileImage:(UIImage *)profileImage {
  122. NSDictionary *parameter;
  123. BOOL imageIsNull = NO;
  124. if (profileImage == nil) { // 사진 삭제
  125. parameter = @{@"image_file": @""};
  126. imageIsNull = YES;
  127. } else {
  128. parameter = @{@"image_file": profileImage};
  129. imageIsNull = NO;
  130. }
  131. //parameters
  132. // NSDictionary *parameter = @{@"image_file": profileImage};
  133. // NSString *path = [NSString stringWithFormat:API_POST_MEMBER_UPDATE_IMAGE];
  134. NSString *path = [[JDFacade facade] getUrlWithCustGroupIDAndMemberID:API_POST_MEMBER_UPDATE_IMAGE];
  135. [[RequestHandler handler] sendAsyncPostRequestAPIPath:path parameters:parameter modelClass:[LoginModel class] completion:^(id responseObject) {
  136. if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
  137. return;
  138. }
  139. LoginModel *response = (LoginModel *) responseObject;
  140. NSLog(@"responseObject : %@",responseObject);
  141. if (response) {//API 성공
  142. if (!imageIsNull) {
  143. [_btnProfile sd_setBackgroundImageWithURL:[NSURL URLWithString:response.imageFile] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"img_member_photo_default"] options:SDWebImageRefreshCached];
  144. [JDFacade facade].loginUser.profileImage = response.imageFile;
  145. [[JDFacade facade] toast:@"프로필 이미지를 변경했습니다"];
  146. } else {
  147. NSString *msg = @"사진이 삭제 되었습니다.";
  148. [[JDFacade facade] alertTitle:@"알림" message: msg completionHander:nil];
  149. [_btnProfile sd_setBackgroundImageWithURL:[NSURL URLWithString:response.imageFile] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"img_member_photo_default"] options:SDWebImageRefreshCached];
  150. [JDFacade facade].loginUser.profileImage = response.imageFile;
  151. }
  152. }
  153. } failure:^(id errorObject) {
  154. JDErrorModel *error = (JDErrorModel *)errorObject;
  155. [[JDFacade facade] alert:error.errorMessage];
  156. }];
  157. }
  158. #pragma mark - UITableView DataSource & Delegate
  159. #pragma mark - UITableView DataSource & Delegate
  160. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  161. return 5;
  162. }
  163. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  164. return 1;
  165. }
  166. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  167. CGFloat height = 0.0f;
  168. if (indexPath.section == 0) {
  169. // height = ![JDFacade facade].tmpEmailId || [[JDFacade facade].tmpEmailId isEmptyString] ? 331-27 : 331;
  170. height = kiAccountCellHeight;
  171. } else if (indexPath.section == 1) {//notification view
  172. // height = [JDFacade facade].loginUser.isHomehubOnline ? 317-56 : 317;
  173. height = kiNotiCellHeight;
  174. } else if (indexPath.section == 2) {
  175. height = kiServiceCellHeight;
  176. } else if (indexPath.section == 3) {
  177. height = kiVersionCellHeight;
  178. } else if (indexPath.section == 4) {
  179. height = kiDeleteCellHeight;
  180. }
  181. // else if (indexPath.section == 5) {
  182. // height = kiPasswdCellHeight;
  183. // }
  184. return height;
  185. }
  186. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  187. UITableViewCell *cell = nil;//[super tableView:tableView cellForRowAtIndexPath:indexPath];
  188. if (indexPath.section == 0) {//account cell
  189. SettingsAccountTableViewCell *tcell = [_tableView dequeueReusableCellWithIdentifier:@"AccountCellIdentifier"];
  190. tcell.lblNickname.text = [[JDFacade facade].loginUser.nickname isEqualToString:@""] ? @"사용자 이름을 등록해주세요.":[JDFacade facade].loginUser.nickname;
  191. tcell.lblEmail.text = [JDFacade facade].loginUser.memberId;
  192. tcell.lblQuiz.text = [JDFacade facade].loginUser.quiz;
  193. if (!_btnProfile) {
  194. _btnProfile = tcell.btnProfile;
  195. }
  196. [_btnProfile sd_setBackgroundImageWithURL:[NSURL URLWithString:[JDFacade facade].loginUser.profileImage] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"img_member_photo_default"] options:SDWebImageRefreshCached];
  197. tcell.lblPhoneNum.text = [CommonUtil formattedPhoneNumber:[JDFacade facade].loginUser.phone];
  198. //set checkbox
  199. if (!_chkAutoLogin) {
  200. _chkAutoLogin = tcell.chkAutoLogin;
  201. _chkAutoLogin.checked = [[[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_AUTO_LOGIN] boolValue];
  202. }
  203. //set checkbox action
  204. if (![_chkAutoLogin actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  205. [_chkAutoLogin addTarget:self action:@selector(chkAutoLoginTouched:) forControlEvents:UIControlEventTouchUpInside];
  206. }
  207. //set label action
  208. if (!tcell.lblChangeNickname.touchHandler) {
  209. [tcell.lblChangeNickname addTouchEventHandler:^(id label) {
  210. [self lblChangeNicknameTouched];
  211. }];
  212. }
  213. //set label action
  214. if (!tcell.lblChangePassword.touchHandler) {
  215. [tcell.lblChangePassword addTouchEventHandler:^(id label) {
  216. [self lblChangePasswordTouched];
  217. }];
  218. }
  219. //set email change action
  220. if (!tcell.lblChangeEmail.touchHandler) {
  221. [tcell.lblChangeEmail addTouchEventHandler:^(id label) {
  222. [self lblChangeEmailTouched];
  223. }];
  224. }
  225. //set Phone Number change action
  226. if (![tcell.btnChangeNum actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {//set button target
  227. [tcell.btnChangeNum addTarget:self action:@selector(btnChangeNumTouched:) forControlEvents:UIControlEventTouchUpInside];
  228. }
  229. if (![tcell.btnLogout actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {//set button target
  230. [tcell.btnLogout addTarget:self action:@selector(btnLogoutTouched:) forControlEvents:UIControlEventTouchUpInside];
  231. }
  232. if (![tcell.btnProfile actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {//set button target
  233. [tcell.btnProfile addTarget:self action:@selector(btnProfileTouched:) forControlEvents:UIControlEventTouchUpInside];
  234. }
  235. if (![tcell.btnProfileSetting actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  236. [tcell.btnProfileSetting addTarget:self action:@selector(btnProfileTouched:) forControlEvents:UIControlEventTouchUpInside];
  237. }
  238. cell = tcell;
  239. } else if (indexPath.section == 1) {//notification cell
  240. SettingsNotificationTableViewCell *tcell = [_tableView dequeueReusableCellWithIdentifier:@"NotificationCellIdentifier"];
  241. if ([JDFacade facade].loginUser.level < 90) {
  242. tcell.viewThingsSet.hidden = YES;
  243. } else {
  244. tcell.viewThingsSet.hidden = NO;
  245. }
  246. if (!_chkHomeModeChange) {
  247. _chkHomeModeChange = tcell.chkHomeModeChange;
  248. }
  249. // if (!_chkHomeEmptyChange) {
  250. // _chkHomeEmptyChange = tcell.chkHomeEmptyChange;
  251. // }
  252. if (!_isNotFirstLoading) {
  253. _isNotFirstLoading = YES;
  254. _chkHomeModeChange.checked = [[JDFacade facade].loginUser.pushTypeModeChgYn boolValue];
  255. // _chkHomeEmptyChange.checked = [[JDFacade facade].loginUser.pushTypePrsncChgYn boolValue];
  256. }
  257. if (![tcell.chkHomeModeChange actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  258. [tcell.chkHomeModeChange addTarget:self action:@selector(chkHomeModeChangeTouched:) forControlEvents:UIControlEventTouchUpInside];
  259. }
  260. if (![tcell.btnThingsSet actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  261. [tcell.btnThingsSet addTarget:self action:@selector(btnThingsSetTouched:) forControlEvents:UIControlEventTouchUpInside];
  262. }
  263. // if (![tcell.chkHomeEmptyChange actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  264. // [tcell.chkHomeEmptyChange addTarget:self action:@selector(chkHomeEmptyChangeTouched:) forControlEvents:UIControlEventTouchUpInside];
  265. // }
  266. // tcell.homehubInfoView.hidden = [JDFacade facade].loginUser.isHomehubOnline;
  267. // if (tcell.homehubInfoView.hidden) {
  268. // tcell.constraintHomehubInfoViewHeight.constant = 0;
  269. // } else {
  270. // _chkHomeModeChange.enabled = NO;
  271. // _chkHomeEmptyChange.enabled = NO;
  272. // }
  273. cell = tcell;
  274. } else if (indexPath.section == 2) {//service info cell
  275. SettingsServiceTableViewCell *tcell = [_tableView dequeueReusableCellWithIdentifier:@"ServiceCellIdentifier"];
  276. if (![tcell.btnService actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  277. [tcell.btnService addTarget:self action:@selector(btnServiceTouched:) forControlEvents:UIControlEventTouchUpInside];
  278. }
  279. if (![tcell.btnPolicy actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  280. [tcell.btnPolicy addTarget:self action:@selector(btnPolicyTouched:) forControlEvents:UIControlEventTouchUpInside];
  281. }
  282. cell = tcell;
  283. } else if (indexPath.section == 3) {//version info cell
  284. SettingsVersionTableViewCell *tcell = [_tableView dequeueReusableCellWithIdentifier:@"VersionCellIdentifier"];
  285. tcell.lblVersion.text = [NSString stringWithFormat:@"현재 버전 : %@", [CommonUtil applicationShortVersion]];
  286. if (![tcell.btnLicense actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  287. [tcell.btnLicense addTarget:self action:@selector(btnLicenseTouched:) forControlEvents:UIControlEventTouchUpInside];
  288. }
  289. cell = tcell;
  290. } else if (indexPath.section == 4) {//Delete cell
  291. SettingsDeleteTableViewCell *tcell = [_tableView dequeueReusableCellWithIdentifier:@"DeleteCellIdentifier"];
  292. if (![tcell.btnDelete actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  293. [tcell.btnDelete addTarget:self action:@selector(btnDeleteTouched:) forControlEvents:UIControlEventTouchUpInside];
  294. }
  295. cell = tcell;
  296. }
  297. // else if (indexPath.section == 5) {//Passwd info cell
  298. // SettingsPasswdTableViewCell *tcell = [_tableView dequeueReusableCellWithIdentifier:@"PasswdCellIdentifier"];
  299. //
  300. // if (![tcell.btnPassword actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
  301. // [tcell.btnPassword addTarget:self action:@selector(btnPasswordTouched:) forControlEvents:UIControlEventTouchUpInside];
  302. // }
  303. //
  304. // cell = tcell;
  305. // }
  306. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  307. return cell;
  308. }
  309. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  310. [super tableView:tableView didSelectRowAtIndexPath:indexPath];
  311. }
  312. #pragma mark - ImageUtil Delegate
  313. - (void)didFinishPickingImage:(UIImage *)image {
  314. [self requestUpdateProfileImage:image];
  315. }
  316. #pragma mark - UI Events
  317. - (void)lblChangeNicknameTouched {
  318. // ChangeNamePopupView *popup = [[ChangeNamePopupView alloc] initFromNib];
  319. // [popup showWithCompletion:^(CustomAlertView *alertView, NSInteger buttonIndex) {
  320. // if (buttonIndex == 0) {//이름 변경 시,
  321. //
  322. // [_tableView reloadData];
  323. // }
  324. // }];
  325. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SettingsNameSetViewController" storyboardName:@"Settings"];
  326. // vc.providesPresentationContextTransitionStyle = YES;
  327. // vc.definesPresentationContext = YES;
  328. //
  329. // [vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
  330. //
  331. // [self presentViewController:vc animated:YES completion:nil];
  332. [self.navigationController pushViewController:vc animated:YES];
  333. }
  334. - (void)lblChangePasswordTouched {
  335. // ConfirmPasswdPopupView *popup = [[ConfirmPasswdPopupView alloc] initFromNib];
  336. // [popup show];
  337. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SettingsPasswdInputViewController" storyboardName:@"Settings"];
  338. [self.navigationController pushViewController:vc animated:YES];
  339. }
  340. - (void)lblChangeEmailTouched {
  341. ChangeEmailPopupView *popup = [[ChangeEmailPopupView alloc] initFromNib];
  342. [popup show];
  343. }
  344. - (void)btnProfileTouched:(id)sender {
  345. if (!_imageUtil) {
  346. _imageUtil = [[ImageUtil alloc] init];
  347. _imageUtil.delegate = self;
  348. }
  349. // [_imageUtil prepareImagePicker:self];
  350. ChangePhotoPopupView *popup = [[ChangePhotoPopupView alloc]initFromNib];
  351. [popup show];
  352. popup.delegate = self;
  353. }
  354. -(void)changeSelectPhotoType:(NSInteger)index{
  355. [_imageUtil setPresentViewController:self];
  356. if (index == kiPhotoAlbum) {
  357. [_imageUtil showImagePickerController:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
  358. } else if (index == kiPhotoCamera){
  359. [_imageUtil showImagePickerController:UIImagePickerControllerSourceTypeCamera];
  360. } else if (index == kiPhotoDelete){
  361. // UIImage *image = [[UIImage alloc]init];
  362. [self requestUpdateProfileImage:[UIImage imageNamed:@""]];
  363. }
  364. }
  365. - (void)chkAutoLoginTouched:(id)sender {
  366. [[JDFacade facade] storeObjectToUserDefaults:@(_chkAutoLogin.checked) forKey:USDEF_APP_AUTO_LOGIN];
  367. if (_chkAutoLogin.checked) {//자동로그인 설정 시, 인증 토큰 저장
  368. [[JDFacade facade] storeObjectToKeychain:[JDFacade facade].loginUser.authToken forKey:USDEF_SESSION_AUTOTOKEN];
  369. } else {;
  370. [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_AUTOTOKEN];
  371. }
  372. }
  373. - (void)btnLogoutTouched:(id)sender {
  374. [[JDFacade facade] logout];
  375. }
  376. - (void)btnChangeNumTouched:(id)sender {
  377. UIViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"SettingsNumChangeViewController" storyboardName:@"Settings"];
  378. [self.navigationController pushViewController:vc animated:YES];
  379. }
  380. //NoticationcationCell's action
  381. - (void)chkHomeModeChangeTouched:(id)sender {
  382. NSDictionary *parameter = @{@"push_type_mode_chg_yn" : _chkHomeModeChange.checked ? ksYES : ksNO};
  383. [self requestUpdatePushSetting:parameter];
  384. }
  385. //- (void)chkHomeEmptyChangeTouched:(id)sender {
  386. //
  387. // NSDictionary *parameter = @{@"push_type_prsnc_chg_yn" : _chkHomeEmptyChange.checked ? ksYES : ksNO};
  388. // [self requestUpdatePushSetting:parameter];
  389. //}
  390. // 홈모드별 동작할 장치 설정 이동
  391. - (void)btnThingsSetTouched:(id)sender{
  392. HomeModeMovementViewController *vc =[CommonUtil instantiateViewControllerWithIdentifier:@"HomeModeMovementViewController" storyboardName:@"Main"];
  393. vc.modeArray = dashboardModel.modeList;
  394. [self.navigationController pushViewController:vc animated:YES];
  395. }
  396. - (void)btnServiceTouched:(id)sender {
  397. NSString *URLString = [NSString stringWithFormat:@"%@%@", kWebLinkServer, URL_PATH_TERMS];
  398. [[JDFacade facade] loadURLExternalBrowser:URLString];
  399. }
  400. - (void)btnPolicyTouched:(id)sender {
  401. NSString *URLString = [NSString stringWithFormat:@"%@%@", kWebLinkServer, URL_PATH_POLICY];
  402. [[JDFacade facade] loadURLExternalBrowser:URLString];
  403. }
  404. //service passwd cell's action
  405. - (void)btnPasswordTouched:(id)sender {// 셋탑 설정
  406. AdminAuthPopupView *popup = [[AdminAuthPopupView alloc] initFromNib];
  407. [popup show];
  408. }
  409. - (void)btnDeleteTouched:(id)sender { // 계정 삭제
  410. DeleteAccountPopupView *popup = [[DeleteAccountPopupView alloc]initFromNib];
  411. [popup show];
  412. }
  413. - (void)btnLicenseTouched:(id)sender { //오픈소스 라이선스
  414. }
  415. - (IBAction)btnCloseTouched:(id)sender {
  416. [self dismissViewControllerAnimated:YES completion:nil];
  417. }
  418. #pragma mark - MemoryWarning
  419. - (void)didReceiveMemoryWarning
  420. {
  421. [super didReceiveMemoryWarning];
  422. // Dispose of any resources that can be recreated.
  423. }
  424. @end