|
|
@@ -48,15 +48,15 @@
|
|
|
Head Text Color : kUITextColor01
|
|
|
Device 명 Text Color : kUITextColor01
|
|
|
Device 상태표시 Text Color
|
|
|
- - 열림 : kUITextColor02
|
|
|
- - 닫힘 : kUITextColor01
|
|
|
-
|
|
|
+ - 열림 : kUITextColor02
|
|
|
+ - 닫힘 : kUITextColor01
|
|
|
+
|
|
|
장치 추가 Text Color : kUITextColor01
|
|
|
|
|
|
(이미지 명)
|
|
|
디바이스 아이콘 bg
|
|
|
- - Default : img_thing_icon_bg_default
|
|
|
- - Active : img_thing_icon_bg_active
|
|
|
+ - Default : img_thing_icon_bg_default
|
|
|
+ - Active : img_thing_icon_bg_active
|
|
|
|
|
|
도어 컨텍트 센서 : 40102
|
|
|
가스 밸브 : 40108
|
|
|
@@ -85,8 +85,8 @@
|
|
|
[UIView animateWithDuration:0.5f delay:0.0f options:UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear animations:^{
|
|
|
_imgvProgress.transform = CGAffineTransformMakeRotation(M_PI);
|
|
|
} completion:nil];
|
|
|
- }
|
|
|
-
|
|
|
+}
|
|
|
+
|
|
|
- (void)stopProgressAni {
|
|
|
[UIView animateWithDuration:0.0f delay:0.0f options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveLinear animations:^{
|
|
|
_imgvProgress.transform = CGAffineTransformMakeRotation(0);
|
|
|
@@ -137,7 +137,7 @@
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
|
-
|
|
|
+
|
|
|
[self initProperties];
|
|
|
[self initUI];
|
|
|
}
|
|
|
@@ -173,7 +173,7 @@
|
|
|
[_btnOption setHidden:NO];
|
|
|
[_viewEditMode setHidden:YES];
|
|
|
|
|
|
-// [self setThingsPopoverOptions];
|
|
|
+ // [self setThingsPopoverOptions];
|
|
|
[self setMoreBtnArray];
|
|
|
[self initRefreshController];
|
|
|
}
|
|
|
@@ -194,27 +194,27 @@
|
|
|
|
|
|
|
|
|
- (void)setThingsPopoverOptions {
|
|
|
-//
|
|
|
-// //set Popover Contents
|
|
|
-// __weak typeof(self) weakSelf = self;
|
|
|
-// _popooverOptionArray = [[NSMutableArray alloc] init];
|
|
|
-//
|
|
|
-// [_popooverOptionArray addObject:@{@"menuName" : NSLocalizedString(@"새로고침", @"새로고침"),
|
|
|
-// @"iconName": @"img_bg_morepopup_icon_refresh",
|
|
|
-// @"target": weakSelf,
|
|
|
-// @"selector": [NSValue valueWithPointer:@selector(refreshDeviceList)]}];
|
|
|
-//
|
|
|
-//// if ([JDFacade facade].loginUser.level == 90) {//권한
|
|
|
-//// [_popooverOptionArray addObject:@{@"menuName" : NSLocalizedString(@"추가", @"추가"),
|
|
|
-//// @"iconName": @"tp_01_img_bg_morepopup_icon_group_deviceadd",
|
|
|
-//// @"target": weakSelf,
|
|
|
-//// @"selector": [NSValue valueWithPointer:@selector(addNewDevice)]}];
|
|
|
-////
|
|
|
-//// [_popooverOptionArray addObject:@{@"menuName" : NSLocalizedString(@"삭제", @"삭제"),
|
|
|
-//// @"iconName": @"tp_01_img_bg_morepopup_icon_group_deviceadd",
|
|
|
-//// @"target": weakSelf,
|
|
|
-//// @"selector": [NSValue valueWithPointer:@selector(toggleEditMode)]}];
|
|
|
-//// }
|
|
|
+ //
|
|
|
+ // //set Popover Contents
|
|
|
+ // __weak typeof(self) weakSelf = self;
|
|
|
+ // _popooverOptionArray = [[NSMutableArray alloc] init];
|
|
|
+ //
|
|
|
+ // [_popooverOptionArray addObject:@{@"menuName" : NSLocalizedString(@"새로고침", @"새로고침"),
|
|
|
+ // @"iconName": @"img_bg_morepopup_icon_refresh",
|
|
|
+ // @"target": weakSelf,
|
|
|
+ // @"selector": [NSValue valueWithPointer:@selector(refreshDeviceList)]}];
|
|
|
+ //
|
|
|
+ //// if ([JDFacade facade].loginUser.level == 90) {//권한
|
|
|
+ //// [_popooverOptionArray addObject:@{@"menuName" : NSLocalizedString(@"추가", @"추가"),
|
|
|
+ //// @"iconName": @"tp_01_img_bg_morepopup_icon_group_deviceadd",
|
|
|
+ //// @"target": weakSelf,
|
|
|
+ //// @"selector": [NSValue valueWithPointer:@selector(addNewDevice)]}];
|
|
|
+ ////
|
|
|
+ //// [_popooverOptionArray addObject:@{@"menuName" : NSLocalizedString(@"삭제", @"삭제"),
|
|
|
+ //// @"iconName": @"tp_01_img_bg_morepopup_icon_group_deviceadd",
|
|
|
+ //// @"target": weakSelf,
|
|
|
+ //// @"selector": [NSValue valueWithPointer:@selector(toggleEditMode)]}];
|
|
|
+ //// }
|
|
|
}
|
|
|
|
|
|
- (void)setMoreBtnArray {
|
|
|
@@ -310,7 +310,7 @@
|
|
|
|
|
|
dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{//RUN to background thread
|
|
|
NodeListModel *fdevices = [[RequestHandler handler] sendSyncGetRequestAPIPath:path parameters:nil
|
|
|
- modelClass:[NodeListModel class] showLoadingView:YES];
|
|
|
+ modelClass:[NodeListModel class] showLoadingView:YES];
|
|
|
|
|
|
if (fdevices && fdevices.nodes && fdevices.nodes.count) {
|
|
|
|
|
|
@@ -328,8 +328,8 @@
|
|
|
rdevice.isRequesting = [rdevice.contentValue isEqualToString:matchedDevice.contentValue] && !hasChangedStatus && !isOverTimeLimit;
|
|
|
|
|
|
//TODO - home hub check
|
|
|
-// rdevice.requestTime = matchedDevice.requestTime;
|
|
|
-// rdevice.collectTime = matchedDevice.collectTime;
|
|
|
+ // rdevice.requestTime = matchedDevice.requestTime;
|
|
|
+ // rdevice.collectTime = matchedDevice.collectTime;
|
|
|
rdevice.onlineState = matchedDevice.onlineState;
|
|
|
|
|
|
if (!rdevice.isRequesting || !rdevice.isOnline || ![JDFacade facade].loginUser.isHomehubOnline) {//정상적으로 변경됨.
|
|
|
@@ -406,7 +406,7 @@
|
|
|
- (void)addNewDevice {
|
|
|
ThingsAddViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ThingsAddViewController" storyboardName:@"Things"];
|
|
|
vc.selectHub = _selectHub;
|
|
|
- [self presentViewController:vc animated:YES completion:nil];
|
|
|
+ [self presentViewController:vc animated:YES completion:nil];
|
|
|
}
|
|
|
|
|
|
- (void)refreshDeviceList {
|
|
|
@@ -468,12 +468,12 @@
|
|
|
}
|
|
|
|
|
|
- (void)requestDeviceList:(id)arg {
|
|
|
-
|
|
|
+
|
|
|
if (![JDFacade facade].loginUser.hasHomeHub) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-// BOOL showLoadingView = [arg isKindOfClass:[NSTimer class]] ? [((NSTimer *)arg).userInfo boolValue] : [arg boolValue];
|
|
|
+ // BOOL showLoadingView = [arg isKindOfClass:[NSTimer class]] ? [((NSTimer *)arg).userInfo boolValue] : [arg boolValue];
|
|
|
BOOL showLoadingView = YES;
|
|
|
//parameters
|
|
|
|
|
|
@@ -484,58 +484,57 @@
|
|
|
// 멀티 홈허브 환경에서 선택된 홈허브 아이디가 있을경우 적용하기
|
|
|
NSString *path = [[JDFacade facade] getUrlWithCustAndGroupID:API_GET_NODE_LIST aditional:@""];
|
|
|
|
|
|
-// TODO : 장치가 없을경우도 처리 하도록 수정하기
|
|
|
+ // TODO : 장치가 없을경우도 처리 하도록 수정하기
|
|
|
[[RequestHandler handler] sendAsyncRequestAPIPath:path method:ksHTTPRequestPOST parameters:parameter
|
|
|
modelClass:[NodeListModel class] showLoadingView:showLoadingView completion:^(id responseObject) {
|
|
|
- if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- _nodeListData = (NodeListModel *)responseObject;
|
|
|
+ if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- [self initNodeDataRemainCtrt:device_id] ;
|
|
|
+ _nodeListData = (NodeListModel *)responseObject;
|
|
|
|
|
|
+ [self initNodeDataRemainCtrt:device_id] ;
|
|
|
[self setMoreBtnArray];
|
|
|
|
|
|
_deviceList = _nodeListData.nodes;
|
|
|
_deviceReOrderList = [[NSMutableArray alloc] initWithArray:_deviceList];
|
|
|
[self updateTitle];
|
|
|
|
|
|
- if (!_deviceList.count) {//이미 로드된 데이터가 있을 경우는 출력하지 않음.
|
|
|
- _lblConnectHub.text = @"등록된 장치가 없습니다";
|
|
|
- _imgvHubAlert.hidden = YES;
|
|
|
-
|
|
|
- _imgvConnectHub.image = [UIImage imageNamed:@"img_1depth_nodevice"];
|
|
|
- }
|
|
|
-
|
|
|
-// if (_nodeListData && _nodeListData.nodes && _nodeListData.nodes.count) {
|
|
|
-// _deviceList = _nodeListData.nodes;
|
|
|
-// _deviceReOrderList = [[NSMutableArray alloc] initWithArray:_deviceList];
|
|
|
-// [self updateTitle];
|
|
|
-// } else {
|
|
|
-// if (!_deviceList.count) {//이미 로드된 데이터가 있을 경우는 출력하지 않음.
|
|
|
-// _lblConnectHub.text = @"등록된 장치가 없습니다";
|
|
|
-// _imgvHubAlert.hidden = YES;
|
|
|
-//
|
|
|
-// _imgvConnectHub.image = [UIImage imageNamed:@"img_1depth_nodevice"];
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if (!_deviceList.count) {//이미 로드된 데이터가 있을 경우는 출력하지 않음.
|
|
|
+ _lblConnectHub.text = @"등록된 장치가 없습니다";
|
|
|
+ _imgvHubAlert.hidden = YES;
|
|
|
+
|
|
|
+ _imgvConnectHub.image = [UIImage imageNamed:@"img_1depth_nodevice"];
|
|
|
+ }
|
|
|
|
|
|
- [_collectionView reloadData];
|
|
|
+ // if (_nodeListData && _nodeListData.nodes && _nodeListData.nodes.count) {
|
|
|
+ // _deviceList = _nodeListData.nodes;
|
|
|
+ // _deviceReOrderList = [[NSMutableArray alloc] initWithArray:_deviceList];
|
|
|
+ // [self updateTitle];
|
|
|
+ // } else {
|
|
|
+ // if (!_deviceList.count) {//이미 로드된 데이터가 있을 경우는 출력하지 않음.
|
|
|
+ // _lblConnectHub.text = @"등록된 장치가 없습니다";
|
|
|
+ // _imgvHubAlert.hidden = YES;
|
|
|
+ //
|
|
|
+ // _imgvConnectHub.image = [UIImage imageNamed:@"img_1depth_nodevice"];
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
-// [self requestPollingDevicesStatusInBackground];
|
|
|
+ [_collectionView reloadData];
|
|
|
|
|
|
- //refresh controller
|
|
|
- if (self.refreshController && self.refreshController.refreshState == JYRefreshStateLoading) {
|
|
|
- [self.refreshController stopRefreshWithAnimated:YES completion:nil];
|
|
|
- }
|
|
|
-
|
|
|
- } failure:^(id errorObject) {
|
|
|
-// [self releaseDevicesTimer];
|
|
|
-
|
|
|
- JDErrorModel *error = (JDErrorModel *)errorObject;
|
|
|
- [[JDFacade facade] alert:error.errorMessage];
|
|
|
- }];
|
|
|
+ // [self requestPollingDevicesStatusInBackground];
|
|
|
+
|
|
|
+ //refresh controller
|
|
|
+ if (self.refreshController && self.refreshController.refreshState == JYRefreshStateLoading) {
|
|
|
+ [self.refreshController stopRefreshWithAnimated:YES completion:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(id errorObject) {
|
|
|
+ // [self releaseDevicesTimer];
|
|
|
+
|
|
|
+ JDErrorModel *error = (JDErrorModel *)errorObject;
|
|
|
+ [[JDFacade facade] alert:error.errorMessage];
|
|
|
+ }];
|
|
|
}
|
|
|
|
|
|
//노드 데이터에서 디바이스 별로 남은 추가 장치 수 계산해서 NodeListModel 셋팅해줌
|
|
|
@@ -543,9 +542,9 @@
|
|
|
|
|
|
|
|
|
NSMutableArray *devices = _nodeListData.devices;
|
|
|
-
|
|
|
+
|
|
|
NSInteger cnt = 0;
|
|
|
-
|
|
|
+
|
|
|
for (DeviceModel *device in devices) {
|
|
|
|
|
|
if (EQUALS(deviceID, @"")) {
|
|
|
@@ -558,16 +557,16 @@
|
|
|
//자기 디바이스의 노드 카운트만
|
|
|
cnt += [device.totalCtrtCnt integerValue];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
_nodeListData.ctrtCnt = [NSString stringWithFormat:@"%ld", cnt];
|
|
|
}
|
|
|
|
|
|
- (void)requestDeviceOrderReset {
|
|
|
NSString *path = [[JDFacade facade] getUrlWithCustAndGroupID:API_PUT_NODE_ORDER_RESET aditional:nil];
|
|
|
NSDictionary *parameter = @{@"type": @"node"};
|
|
|
-
|
|
|
+
|
|
|
[[RequestHandler handler] sendAsyncPutRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
|
|
|
NSLog(@"Reset Result : %@", responseObject);
|
|
|
[self refreshDeviceList];
|
|
|
@@ -590,7 +589,7 @@
|
|
|
NSDictionary *parameter = @{@"nodes": nodeOrder};
|
|
|
[[RequestHandler handler] sendAsyncPutRequestAPIPath:path parameters:parameter modelClass:[JDJSONModel class] completion:^(id responseObject) {
|
|
|
NSLog(@"ReOrder Result : %@", responseObject);
|
|
|
-// [self refreshDeviceList];
|
|
|
+ // [self refreshDeviceList];
|
|
|
} failure:^(id errorObject) {
|
|
|
JDErrorModel *error = (JDErrorModel *)errorObject;
|
|
|
[[JDFacade facade] alert:error.errorMessage];
|
|
|
@@ -613,7 +612,7 @@
|
|
|
[[JDFacade facade] selectDatas:self listInfo:_homeHubList completion:^(DataSelectModel *seleced) {
|
|
|
_selectHub = (DeviceModel *)seleced.value;
|
|
|
NSLog(@"Selected Hub : %@", _selectHub);
|
|
|
-
|
|
|
+
|
|
|
[self updateTitle];
|
|
|
[self requestDeviceList:@YES];
|
|
|
}];
|
|
|
@@ -645,7 +644,7 @@
|
|
|
_lblTitle.text = [NSString stringWithFormat:@"%@", _selectHub.deviceName];
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
_lblCount.text = [NSString stringWithFormat:@"%zd", _deviceList.count];
|
|
|
NSLog(@"HomeHubID : %@", [JDFacade facade].loginUser.homehubDeviceId);
|
|
|
@@ -655,13 +654,13 @@
|
|
|
_collectionView.hidden = YES;
|
|
|
_btnOption.hidden = NO;
|
|
|
_btnClose.hidden = YES;
|
|
|
-
|
|
|
+
|
|
|
if (![JDFacade facade].loginUser.homegrpId) {//연결한 적이 없음
|
|
|
_lblConnectHub.text = @"초대를 받아서\n시작해 보세요";
|
|
|
_imgvHubAlert.hidden = YES;
|
|
|
|
|
|
_imgvConnectHub.image = [UIImage imageNamed:@"img_1depth_invitation"];
|
|
|
-
|
|
|
+
|
|
|
_lblLeaveAccount.hidden = YES;
|
|
|
_lblSimpleMemberInfo.hidden = YES;
|
|
|
|
|
|
@@ -704,7 +703,7 @@
|
|
|
}
|
|
|
|
|
|
if ([_lblTitle.text rangeOfString:@"장치 전체"].location != NSNotFound) {
|
|
|
- [_lblTitle setColor:kUITextColor03 text:[NSString stringWithFormat:@"%zd", _deviceList.count]];
|
|
|
+ [_lblTitle setColor:kUITextColor03 text:[NSString stringWithFormat:@"%zd", _deviceList.count]];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -717,14 +716,14 @@
|
|
|
|
|
|
for (DeviceModel *rdevice in _commandArray) {
|
|
|
DeviceModel *matchedDevice = [_deviceList objectByUsingPredicateFormat:@"deviceId == %@", rdevice.deviceId]; //일치하는 디바이스가 있을 경우, 추가하지 않음.
|
|
|
-// DeviceModel *matchedDevice = [_deviceList objectByUsingPredicateFormat:@"deviceId == %@ && nodeId == %@", rdevice.deviceId, rdevice.nodeId]; //일치하는 디바이스가 있을 경우, 추가하지 않음.
|
|
|
+ // DeviceModel *matchedDevice = [_deviceList objectByUsingPredicateFormat:@"deviceId == %@ && nodeId == %@", rdevice.deviceId, rdevice.nodeId]; //일치하는 디바이스가 있을 경우, 추가하지 않음.
|
|
|
if (matchedDevice) {
|
|
|
matchedDevice.isRequesting = rdevice.isRequesting;
|
|
|
matchedDevice.requestTime = rdevice.requestTime;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// [_collectionView reloadData];
|
|
|
+ // [_collectionView reloadData];
|
|
|
}
|
|
|
|
|
|
- (void)releaseDevicesTimer {
|
|
|
@@ -739,7 +738,7 @@
|
|
|
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
|
|
NSInteger auth = [JDFacade facade].loginUser.level == 90 && !_isDeleteMode && [_nodeListData isCanAddNode]; //마스터 권한일 경우,
|
|
|
NSInteger count = _deviceList.count % _deviceFlag == 0 ? _deviceList.count + auth : _deviceList.count + auth; //홀수일 경우, 멤버 초대 버튼을 추가해줌.
|
|
|
-// NSInteger count = _deviceList.count;
|
|
|
+ // NSInteger count = _deviceList.count;
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
@@ -747,32 +746,33 @@
|
|
|
|
|
|
UICollectionViewCell *rcell = nil;
|
|
|
UIPanGestureRecognizer *drag = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureHandler:)];
|
|
|
+
|
|
|
if (indexPath.row < _deviceList.count) {
|
|
|
ThingsCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ThingsCellIdentifier" forIndexPath:indexPath];
|
|
|
-// [cell.btnDelete setHidden:YES];
|
|
|
-// [cell.btnChangeOrder setHidden:YES];
|
|
|
+ // [cell.btnDelete setHidden:YES];
|
|
|
+ // [cell.btnChangeOrder setHidden:YES];
|
|
|
|
|
|
DeviceModel *device =_deviceList[indexPath.row];
|
|
|
cell.indexPath = indexPath;
|
|
|
|
|
|
cell.lblDeviceName.text = device.prdName;
|
|
|
|
|
|
-// [cell.btnDevice sd_setImageWithURL:[NSURL URLWithString:device.imageFileName] forState:UIControlStateNormal
|
|
|
-// placeholderImage:nil options:SDWebImageRefreshCached completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
|
|
|
-// [cell layoutIfNeeded];
|
|
|
-// }];
|
|
|
+ // [cell.btnDevice sd_setImageWithURL:[NSURL URLWithString:device.imageFileName] forState:UIControlStateNormal
|
|
|
+ // placeholderImage:nil options:SDWebImageRefreshCached completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
|
|
|
+ // [cell layoutIfNeeded];
|
|
|
+ // }];
|
|
|
[cell.imgDevice setImage:[UIImage imageNamed:device.deviceclassTypeId]];
|
|
|
[cell.btnDevice addTarget:self action:@selector(btnDeviceTouched:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[cell.btnDelete addTarget:self action:@selector(btnDeviceDelete:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
cell.btnDevice.value = indexPath;
|
|
|
cell.btnDelete.value = indexPath;
|
|
|
-
|
|
|
+
|
|
|
//커맨드 클래스 뷰를 초기화함.
|
|
|
[[cell.controlContainer subviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
|
|
UIView *subview = (UIView *)obj;
|
|
|
[subview removeFromSuperview];
|
|
|
}];
|
|
|
-
|
|
|
+
|
|
|
// TODO : 어떤 부분인지 내용 확인 필요
|
|
|
cell.pcontainerView.hidden = !device.isRequesting;
|
|
|
if (!cell.pcontainerView.hidden) {
|
|
|
@@ -780,30 +780,30 @@
|
|
|
} else {
|
|
|
[cell stopProgressAni];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//허브 On-Off line check
|
|
|
-// cell.lblDeviceStatus.hidden = !([[JDFacade facade].loginUser.homehubOnlineState isEqualToString:@"OFF"] || [device.onlineState isEqualToString:@"OFF"]);
|
|
|
-// cell.controlContainer.hidden = !cell.lblDeviceStatus.hidden;
|
|
|
+ // cell.lblDeviceStatus.hidden = !([[JDFacade facade].loginUser.homehubOnlineState isEqualToString:@"OFF"] || [device.onlineState isEqualToString:@"OFF"]);
|
|
|
+ // cell.controlContainer.hidden = !cell.lblDeviceStatus.hidden;
|
|
|
|
|
|
cell.btnDelete.hidden = !_isDeleteMode;
|
|
|
cell.btnChangeOrder.hidden = !_isReOrderMode;
|
|
|
|
|
|
if(_isDeleteMode || _isReOrderMode)
|
|
|
{
|
|
|
-// cell.btnDevice.enabled = NO;
|
|
|
+ // cell.btnDevice.enabled = NO;
|
|
|
cell.btnDeviceControl.hidden = YES;
|
|
|
_btnOption.hidden = YES;
|
|
|
_imgvLogo.hidden = YES;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-// cell.btnDevice.enabled = YES;
|
|
|
+ // cell.btnDevice.enabled = YES;
|
|
|
cell.btnDeviceControl.hidden = NO;
|
|
|
_btnOption.hidden = NO;
|
|
|
_imgvLogo.hidden = NO;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
[cell.btnChangeOrder addGestureRecognizer:drag];
|
|
|
cell.btnChangeOrder.value = indexPath;
|
|
|
@@ -827,12 +827,12 @@
|
|
|
UIView *superview = cell.controlContainer;
|
|
|
[superview addSubview:controlView];
|
|
|
|
|
|
-// controlView.width = IS_IPHONE_6P ? 98.0f : 120;
|
|
|
-// NSLog(@"Controll View : %f", ViewWidth(superview));
|
|
|
-// controlView.width = ViewWidth(superview);
|
|
|
+ // controlView.width = IS_IPHONE_6P ? 98.0f : 120;
|
|
|
+ // NSLog(@"Controll View : %f", ViewWidth(superview));
|
|
|
+ // controlView.width = ViewWidth(superview);
|
|
|
[controlView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.size.mas_equalTo(superview.frame.size);
|
|
|
-// make.center.equalTo(superview);
|
|
|
+ // make.size.mas_equalTo(superview.frame.size);
|
|
|
+ // make.center.equalTo(superview);
|
|
|
make.top.equalTo(superview.mas_top).with.offset(0); //with is an optional semantic filler
|
|
|
make.left.equalTo(superview.mas_left).with.offset(0);
|
|
|
make.bottom.equalTo(superview.mas_bottom).with.offset(0);
|
|
|
@@ -846,13 +846,14 @@
|
|
|
|
|
|
[cell.btnDevice setBackgroundImage:[UIImage imageNamed:@"img_thing_icon_bg_default"] forState:UIControlStateNormal];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
rcell = cell;
|
|
|
} else {
|
|
|
+
|
|
|
ThingsAddCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ThingsAddCellIdentifier" forIndexPath:indexPath];
|
|
|
-
|
|
|
-//
|
|
|
+
|
|
|
+ //
|
|
|
if (![cell.btnAdd actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
|
|
|
[cell.btnAdd addTarget:self action:@selector(addNewDevice) forControlEvents:UIControlEventTouchUpInside];
|
|
|
}
|
|
|
@@ -899,16 +900,16 @@
|
|
|
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
|
|
|
|
|
if (_isReOrderMode || _isDeleteMode) {
|
|
|
-// [collectionView beginInteractiveMovementForItemAtIndexPath:indexPath];
|
|
|
+ // [collectionView beginInteractiveMovementForItemAtIndexPath:indexPath];
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (indexPath.row < _deviceList.count) {//디바이스인 경우,
|
|
|
-// DeviceModel *device = _deviceList[indexPath.row];
|
|
|
-//
|
|
|
-// ThingsDetailViewController *vc = (ThingsDetailViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"ThingsDetailViewController" storyboardName:@"Things"];
|
|
|
-// vc.refDevice = device;
|
|
|
-// [self presentViewController:vc animated:YES completion:nil];
|
|
|
+ // DeviceModel *device = _deviceList[indexPath.row];
|
|
|
+ //
|
|
|
+ // ThingsDetailViewController *vc = (ThingsDetailViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"ThingsDetailViewController" storyboardName:@"Things"];
|
|
|
+ // vc.refDevice = device;
|
|
|
+ // [self presentViewController:vc animated:YES completion:nil];
|
|
|
[self moveToDetail:indexPath];
|
|
|
}
|
|
|
}
|
|
|
@@ -937,11 +938,11 @@
|
|
|
{
|
|
|
CGPoint locationPoint = [self getCellCenter:[sender locationInView:_collectionView]];
|
|
|
|
|
|
-
|
|
|
+
|
|
|
switch (sender.state) {
|
|
|
case UIGestureRecognizerStateBegan:
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
NSIndexPath *indexPathOfPoint = [self.collectionView indexPathForItemAtPoint:locationPoint];
|
|
|
_moveCell = (ThingsCollectionViewCell *)[self.collectionView cellForItemAtIndexPath:indexPathOfPoint];
|
|
|
UIGraphicsBeginImageContext(_moveCell.bounds.size);
|
|
|
@@ -965,21 +966,21 @@
|
|
|
break;
|
|
|
case UIGestureRecognizerStateCancelled:
|
|
|
case UIGestureRecognizerStateEnded:
|
|
|
-// [self.collectionView performBatchUpdates:^{
|
|
|
-// //update cell indexPath
|
|
|
-// _reorderingCellIndexPath = toIndexPath;
|
|
|
-// [self.collectionView moveItemAtIndexPath:atIndexPath toIndexPath:toIndexPath];
|
|
|
-// //did move
|
|
|
-// if ([self.datasource respondsToSelector:@selector(collectionView:itemAtIndexPath:didMoveToIndexPath:)]) {
|
|
|
-// [self.datasource collectionView:self.collectionView itemAtIndexPath:atIndexPath didMoveToIndexPath:toIndexPath];
|
|
|
-// }
|
|
|
-// } completion:nil];
|
|
|
+ // [self.collectionView performBatchUpdates:^{
|
|
|
+ // //update cell indexPath
|
|
|
+ // _reorderingCellIndexPath = toIndexPath;
|
|
|
+ // [self.collectionView moveItemAtIndexPath:atIndexPath toIndexPath:toIndexPath];
|
|
|
+ // //did move
|
|
|
+ // if ([self.datasource respondsToSelector:@selector(collectionView:itemAtIndexPath:didMoveToIndexPath:)]) {
|
|
|
+ // [self.datasource collectionView:self.collectionView itemAtIndexPath:atIndexPath didMoveToIndexPath:toIndexPath];
|
|
|
+ // }
|
|
|
+ // } completion:nil];
|
|
|
|
|
|
-//
|
|
|
-// _dragIndexPath= nil;
|
|
|
-// [_cellFakeView removeFromSuperview];
|
|
|
-
|
|
|
-//
|
|
|
+ //
|
|
|
+ // _dragIndexPath= nil;
|
|
|
+ // [_cellFakeView removeFromSuperview];
|
|
|
+
|
|
|
+ //
|
|
|
[self moveItemIfNeeded];
|
|
|
break;
|
|
|
default:
|
|
|
@@ -1001,14 +1002,14 @@
|
|
|
} completion:nil];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
_moveCell.hidden = NO;
|
|
|
[_cellFakeView removeFromSuperview];
|
|
|
- _dragIndexPath = nil;
|
|
|
-// [_cellInfo]
|
|
|
+ _dragIndexPath = nil;
|
|
|
+ // [_cellInfo]
|
|
|
}
|
|
|
|
|
|
-(CGPoint)getCellCenter:(CGPoint)point
|
|
|
@@ -1031,12 +1032,12 @@
|
|
|
DeviceModel *device =_deviceReOrderList[atIndexPath.item];
|
|
|
|
|
|
NSLog(@"DeviceModel : %@", device);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
[_deviceReOrderList removeObjectAtIndex:atIndexPath.item];
|
|
|
[_deviceReOrderList insertObject:device atIndex:toIndexPath.item];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(void)moveToDetail:(NSIndexPath *)indexPath
|
|
|
@@ -1067,7 +1068,7 @@
|
|
|
**/
|
|
|
|
|
|
- (IBAction)btnOptionTouched:(id)sender {
|
|
|
- [self toggleOptionsWithArray:sender btnArray:_moreBtnArray];
|
|
|
+ [self toggleOptionsWithArray:sender btnArray:_moreBtnArray];
|
|
|
}
|
|
|
|
|
|
- (IBAction)btnReFreshTouched:(id)sender {
|
|
|
@@ -1089,8 +1090,8 @@
|
|
|
}
|
|
|
}];
|
|
|
|
|
|
-// _deviceList = _deviceReOrderList;
|
|
|
-// [self toggleReOrderMode:NO];
|
|
|
+ // _deviceList = _deviceReOrderList;
|
|
|
+ // [self toggleReOrderMode:NO];
|
|
|
}
|
|
|
|
|
|
- (IBAction)btnCloseTouched:(id)sender {
|
|
|
@@ -1148,15 +1149,15 @@
|
|
|
|
|
|
CASE (@"node.register")
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
CASE (@"node.delete")
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
CASE(@"nodes.reload")
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
DEFAULT
|
|
|
@@ -1172,7 +1173,7 @@
|
|
|
|
|
|
-(void) receiveSocketData:(NSNotification *)notification {
|
|
|
SocketModel *result = [[SocketModel alloc] initWithDictionary:notification.object error:nil];
|
|
|
-// CommandModel *response = [[CommandModel alloc] initWithDictionary:notification.object error:nil];
|
|
|
+ // CommandModel *response = [[CommandModel alloc] initWithDictionary:notification.object error:nil];
|
|
|
NSLog(@"Result : %@", result);
|
|
|
|
|
|
if ([result.messageType isEquestToIgnoreCase:MSG_TYPE_NODE_CONTENT]) {
|
|
|
@@ -1182,8 +1183,8 @@
|
|
|
info.collectTime = response.collectTime;
|
|
|
|
|
|
id contentValue = [NSJSONSerialization JSONObjectWithData:[response.contentValue dataUsingEncoding:NSUTF8StringEncoding]
|
|
|
- options:NSJSONReadingAllowFragments
|
|
|
- error:nil];
|
|
|
+ options:NSJSONReadingAllowFragments
|
|
|
+ error:nil];
|
|
|
|
|
|
info.contentValue = contentValue[info.cmdclsId];
|
|
|
if (info.isRequesting) {
|
|
|
@@ -1191,7 +1192,7 @@
|
|
|
}
|
|
|
[_collectionView reloadData];
|
|
|
break;
|
|
|
-// NSLog(@"Info : %@", contentValue[info.cmdclsId]);
|
|
|
+ // NSLog(@"Info : %@", contentValue[info.cmdclsId]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1200,7 +1201,7 @@
|
|
|
}
|
|
|
else if ([result.messageType isEquestToIgnoreCase:MSG_TYPE_NODE_REGIST_RES] || [result.messageType isEquestToIgnoreCase:MSG_TYPE_NODE_DELETE_RES]) {
|
|
|
[self requestDeviceList:@NO];
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1259,9 +1260,9 @@
|
|
|
-(void)btnDeviceTouched:(id)sender
|
|
|
{
|
|
|
NSIndexPath *indexPath = (NSIndexPath *) ((CustomButton *)sender).value;
|
|
|
-//
|
|
|
-// DeviceModel *device =_deviceList[indexPath.row];
|
|
|
-// NSLog(@"Device : %@", device);
|
|
|
+ //
|
|
|
+ // DeviceModel *device =_deviceList[indexPath.row];
|
|
|
+ // NSLog(@"Device : %@", device);
|
|
|
[self moveToDetail:indexPath];
|
|
|
}
|
|
|
|
|
|
@@ -1270,35 +1271,35 @@
|
|
|
NSIndexPath *indexPath = (NSIndexPath *) ((CustomButton *)sender).value;
|
|
|
|
|
|
DeviceModel *device =_deviceList[indexPath.row];
|
|
|
-
|
|
|
+
|
|
|
if ([device.onlineState isEquestToIgnoreCase:@"OFF"]) {
|
|
|
ThingsForcedDelViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ThingsForcedDelViewController" storyboardName:@"Things"];
|
|
|
|
|
|
vc.delDevice = device;
|
|
|
-// vc.providesPresentationContextTransitionStyle = YES;
|
|
|
-// vc.definesPresentationContext = YES;
|
|
|
-//
|
|
|
-// [vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
|
|
|
-//
|
|
|
-// [self presentViewController:vc animated:NO completion:nil];
|
|
|
+ // vc.providesPresentationContextTransitionStyle = YES;
|
|
|
+ // vc.definesPresentationContext = YES;
|
|
|
+ //
|
|
|
+ // [vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
|
|
|
+ //
|
|
|
+ // [self presentViewController:vc animated:NO completion:nil];
|
|
|
[self showTransparencyModalView:vc removeSelf:NO];
|
|
|
|
|
|
} else {
|
|
|
ThingsGeneralDelViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ThingsGeneralDelViewController" storyboardName:@"Things"];
|
|
|
|
|
|
vc.delDevice = device;
|
|
|
-// vc.providesPresentationContextTransitionStyle = YES;
|
|
|
-// vc.definesPresentationContext = YES;
|
|
|
-//
|
|
|
-// [vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
|
|
|
-//
|
|
|
-// [self presentViewController:vc animated:NO completion:nil];
|
|
|
+ // vc.providesPresentationContextTransitionStyle = YES;
|
|
|
+ // vc.definesPresentationContext = YES;
|
|
|
+ //
|
|
|
+ // [vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
|
|
|
+ //
|
|
|
+ // [self presentViewController:vc animated:NO completion:nil];
|
|
|
[self showTransparencyModalView:vc removeSelf:NO];
|
|
|
}
|
|
|
|
|
|
|
|
|
NSLog(@"Device : %@", device);
|
|
|
-// [self requestDeviceList:@NO];
|
|
|
+ // [self requestDeviceList:@NO];
|
|
|
}
|
|
|
|
|
|
-(void)finishDeviveDelete
|