Explorar el Código

- 홈모드 아이콘 표시 로직 수정

KaRam Kim hace 8 años
padre
commit
0035865b54

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

@@ -131,6 +131,7 @@ typedef NS_ENUM(NSInteger, CmdClsType) {
 @property (copy, nonatomic) NSString *dataTypeCode;
 @property (copy, nonatomic) NSString *deleteYn;
 @property (copy, nonatomic) NSString *imageFileName;
+@property (copy, nonatomic) NSString *imageFileViewName;
 
 @property (copy, nonatomic) NSString *hour;
 @property (copy, nonatomic) NSString *minute;

+ 25 - 5
OneCable/Classes/ViewControllers/MainScreens/HomeModeSettingsViewController.m

@@ -76,12 +76,12 @@
     NSArray *arr = @[ksItemTypeCodeAction];
     //    NSString *path = [NSString stringWithFormat:API_GET_ITEM_DEVICES, ksItemTypeCodeAction];
     NSString *path = [[JDFacade facade] getUrlWithCustAndGroupID:API_GET_ITEM_DEVICES arguments:arr];
-    
+    NSLog(@"path : %@", path);
     [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:nil modelClass:[ItemListModel class] completion:^(id responseObject) {
         if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
             return;
         }
-        
+        NSLog(@"_items : %@", responseObject);
         ItemListModel *fetchedItemList = (ItemListModel *)responseObject;
         
         if (fetchedItemList && fetchedItemList.list && fetchedItemList.list.count) {//API 성공 ,
@@ -111,10 +111,11 @@
         
         ItemSubListModel *fetchedSubItems = (ItemSubListModel *) responseObject;
         
+//        NSLog(@"Item Sub Model : %@", fetchedSubItems);
         if (fetchedSubItems && fetchedSubItems.list && fetchedSubItems.list.count) {//API 성공 ,
             _subItems = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] initWithArray:fetchedSubItems.list];
         }
-        
+//        NSLog(@"Item Sub Model : %@", _subItems);
         [self matchItemListWithSubItemsForMode];
         
     } failure:^(id errorObject) {
@@ -217,7 +218,7 @@
         //노드 액션이 선택된 노드만 출력함.
         NSInteger fcount = indexPath.row; //선택된 액션만 찾기 위한 인덱스
         NSArray *matchedSubItems = [_items matchedArrayInSubArrays:@"subItems" objectName:ksCustomRadioButtonStatus condition:YES];
-        
+//        NSLog(@"SubInfo : %@", matchedSubItems);
         ItemSubModel *subItem = nil;
         for (subItem in matchedSubItems) {
             if (fcount == 0) {
@@ -227,8 +228,27 @@
             }
         }
         
+        for (ItemModel *info in _items) {
+            if ([info.sourceId isEqualToString:subItem.sourceId]) {
+                subItem.imageFileName = info.imageFileName;
+                subItem.imageFileViewName = info.imageFileViewName;
+                break;
+            }
+        }
+        
         HomeSettingsDeviceTableViewCell *tcell = (HomeSettingsDeviceTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"DeviceCellIdentifier"];
-        [tcell.imgvDevice sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
+//        [tcell.imgvDevice sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
+        // TODO : 이미지 표시하기.......
+//        NSLog(@"SubInfo  : %@", subItem);
+        NSString *imageName = nil;
+        NSArray *tmpArr = [subItem.imageFileViewName explode:@"/"];
+        NSArray *tmpArr2 = [tmpArr.lastObject explode:@"."];
+        imageName = tmpArr2[0];
+        if (imageName) {
+            tcell.imgvDevice.image = [UIImage imageNamed:imageName];
+        }
+        
+//        NSLog(@"Image Name : %@", subItem.imageFileViewName);
         tcell.lblDeviceName.text = subItem.sourceName;
         tcell.lblNodeName.text = subItem.sourceSubName;