Browse Source

- 장치 목록 화면 기능 적용중

KaRam Kim 8 years ago
parent
commit
76aa83444b

+ 2 - 2
OneCable/Classes/AppDelegate.m

@@ -67,8 +67,8 @@
     
     [Fabric with:@[[Crashlytics class]]];
     //set logger 
-    [DDLog addLogger:[DDASLLogger sharedInstance]];
-//    [DDLog addLogger:[DDTTYLogger sharedInstance]];
+//    [DDLog addLogger:[DDASLLogger sharedInstance]];
+    [DDLog addLogger:[DDTTYLogger sharedInstance]];
     
     [[DDTTYLogger sharedInstance] setColorsEnabled:YES];
 }

+ 1 - 1
OneCable/Classes/Definitions.h

@@ -127,7 +127,7 @@ static NSString *kWebLinkServer = @"http://61.40.220.23:7794";      //운영
 //#define API_POST_GROUP_DELETE   @"/groups/devices/%@"   //그룹 내 디바이스 삭제
 
 #define API_PARAM_PAGING        @"?paging_datetime=%@&paging_type=%@"
-#define API_GET_DEVICE_LIST     @"/devices"
+#define API_GET_DEVICE_LIST     @"/customer/%@/group/%@/device"
 #define API_GET_DEVICE_DETAIL   @"/devices/%@"
 #define API_POST_NODE_COMMAND   @"/devices/%@/nodes/%@/commands"
 #define API_GET_DEVICE_ICONS    @"/devices/icons/%@"       //디바이스 아이콘

+ 1 - 0
OneCable/Classes/Model/MoreBtnModel.h

@@ -10,6 +10,7 @@
 
 typedef enum {
     MasterTransfer = 90001,
+    ReOrder,
     AddMember,
     Add,
     Del,

+ 4 - 0
OneCable/Classes/Model/MoreBtnModel.m

@@ -35,6 +35,10 @@
             [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_icon_masterchange"];
             [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_icon_masterchange_press"];
             break;
+        case ReOrder:
+            [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_memberadd"];
+            [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_memberadd_press"];
+            break;
         case AddMember:
             [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_memberadd"];
             [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_memberadd_press"];

+ 20 - 16
OneCable/Classes/ViewControllers/ThingsScreens/ThingsViewController.m

@@ -347,7 +347,8 @@
     NSDictionary *parameter = @{@"paging_datetime": _pagingId ? _pagingId : ksEmptyString,
                                 @"paging_type": _pagingType ? _pagingType : ksEmptyString};
 
-    NSString *path = [NSString stringWithFormat:API_GET_DEVICE_LIST];
+//    NSString *path = [NSString stringWithFormat:API_GET_DEVICE_LIST];
+    NSString *path = [[JDFacade facade] getUrlWithCustAndGroupID:API_GET_DEVICE_LIST aditional:nil];
 
     [[RequestHandler handler] sendAsyncRequestAPIPath:path method:ksHTTPRequestGET parameters:parameter
                                            modelClass:[DeviceListModel class] showLoadingView:showLoadingView completion:^(id responseObject) {
@@ -359,7 +360,6 @@
 
         if (deviceList && deviceList.list && deviceList.list.count) {
             _deviceList = deviceList.list;
-            
             [self updateTitle];
         } else {
             if (!_deviceList.count) {//이미 로드된 데이터가 있을 경우는 출력하지 않음.
@@ -374,12 +374,12 @@
 //        [self requestPollingDevicesStatusInBackground];
                                                
         //refresh controller
-        if (self.refreshController && self.refreshController.refreshState == JYRefreshStateLoading) {
-            [self.refreshController stopRefreshWithAnimated:YES completion:nil];
-        }
+//        if (self.refreshController && self.refreshController.refreshState == JYRefreshStateLoading) {
+//            [self.refreshController stopRefreshWithAnimated:YES completion:nil];
+//        }
 
     } failure:^(id errorObject) {
-        [self releaseDevicesTimer];
+//        [self releaseDevicesTimer];
         
         JDErrorModel *error = (JDErrorModel *)errorObject;
         [[JDFacade facade] alert:error.errorMessage];
@@ -401,7 +401,7 @@
     _lblTitle.text = [NSString stringWithFormat:@"장치 전체 %zd", _deviceList.count];
     NSLog(@"HomeHubID : %@", [JDFacade facade].loginUser.homehubDeviceId);
     if (![JDFacade facade].loginUser.hasHomeHub) {//홈허브 아이디가 없는 경우,
-        
+        NSLog(@"이쪽으로 빠짐");
         [_mainView bringSubviewToFront:_addHubContainerView];
         _addHubContainerView.hidden = NO;
         _collectionView.hidden = YES;
@@ -440,7 +440,7 @@
         }
         
     } else {
-        
+        NSLog(@"이쪽으로 빠짐2");
         if (![JDFacade facade].loginUser.isHomehubOnline) {
             _imgvHubAlert.hidden = NO;
             _lblTitle.text = @"홈허브 오프라인";
@@ -497,7 +497,7 @@
 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
     
     UICollectionViewCell *rcell = nil;
-    
+
     if (indexPath.row < _deviceList.count) {
         ThingsCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ThingsCellIdentifier" forIndexPath:indexPath];
         
@@ -512,20 +512,23 @@
         }];
         [cell.btnDevice addTarget:self action:@selector(btnDeviceTouched:) forControlEvents:UIControlEventTouchUpInside];
         cell.btnDevice.value = indexPath;
-        
+
         //커맨드 클래스 뷰를 초기화함.
         [[cell.controlContainer subviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
             UIView *subview = (UIView *)obj;
             [subview removeFromSuperview];
         }];
 
-        cell.pcontainerView.hidden = !device.isRequesting;
-        if (!cell.pcontainerView.hidden) {
-            [cell startProgressAni];
-        } else {
-            [cell stopProgressAni];
-        }
+        NSLog(@"Is Requesting : %@", BOOLToString(device.isRequesting));
         
+        // TODO : 어떤 부분인지 내용 확인 필요
+        cell.pcontainerView.hidden = !device.isRequesting;
+//        if (!cell.pcontainerView.hidden) {
+//            [cell startProgressAni];
+//        } 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;
@@ -556,6 +559,7 @@
             [cell.btnDevice setBackgroundImage:[UIImage imageNamed:@"img_thing_icon_bg_default"] forState:UIControlStateNormal];
         }
         
+
         
         rcell = cell;
     }