Bladeren bron

17.07.13 규칙, 모

eunmi.kim 8 jaren geleden
bovenliggende
commit
509812ba72

+ 1 - 1
OneCable.xcodeproj/project.pbxproj

@@ -1162,9 +1162,9 @@
 				A13BD0BC1C3B563D00C76527 /* DaylightPopupView.xib */,
 				E240C92D1F0B38F300F5F58C /* DoorSensorPopupView.h */,
 				E240C92E1F0B38F300F5F58C /* DoorSensorPopupView.m */,
+				A16D937C1C5600D300DC0DF1 /* DurationPopupView.m */,
 				E240C92F1F0B38F300F5F58C /* DoorSensorPopupView.xib */,
 				A16D937B1C5600D300DC0DF1 /* DurationPopupView.h */,
-				A16D937C1C5600D300DC0DF1 /* DurationPopupView.m */,
 				A16D937D1C5600D300DC0DF1 /* DurationPopupView.xib */,
 				A13BD0BD1C3B563D00C76527 /* ExternHeatPopupView.h */,
 				A13BD0BE1C3B563D00C76527 /* ExternHeatPopupView.m */,

+ 2 - 2
OneCable/Base.lproj/Main.storyboard

@@ -4404,7 +4404,7 @@
                                                 <rect key="frame" x="0.0" y="207" width="320" height="219"/>
                                                 <autoresizingMask key="autoresizingMask"/>
                                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="xsB-wP-ggW" id="qqk-dn-Ftx">
-                                                    <rect key="frame" x="0.0" y="0.0" width="320" height="218.5"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="320" height="219"/>
                                                     <autoresizingMask key="autoresizingMask"/>
                                                     <subviews>
                                                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="i69-BM-Qfs" userLabel="View - Cell" customClass="KNView">
@@ -4655,7 +4655,7 @@
                                                 <rect key="frame" x="0.0" y="426" width="320" height="164"/>
                                                 <autoresizingMask key="autoresizingMask"/>
                                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bHe-zk-XaM" id="rhd-Oi-wkg">
-                                                    <rect key="frame" x="0.0" y="0.0" width="320" height="163.5"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="320" height="164"/>
                                                     <autoresizingMask key="autoresizingMask"/>
                                                     <subviews>
                                                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9vO-bf-gRH" userLabel="View - Cell">

+ 3 - 3
OneCable/Base.lproj/Rules.storyboard

@@ -285,7 +285,7 @@
                                                             </constraints>
                                                         </view>
                                                         <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XCn-ZD-6wP">
-                                                            <rect key="frame" x="248" y="21.5" width="56" height="32"/>
+                                                            <rect key="frame" x="248" y="22" width="56" height="32"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="width" constant="54" id="Ti1-fo-tKL"/>
                                                                 <constraint firstAttribute="height" constant="32" id="fy1-eO-k9P"/>
@@ -3768,10 +3768,10 @@
                                                             </constraints>
                                                         </view>
                                                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2017.04.07 08:00" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IQk-FF-ctY" customClass="CustomLabel">
-                                                            <rect key="frame" x="162" y="74.5" width="140" height="20"/>
+                                                            <rect key="frame" x="102" y="74.5" width="200" height="20"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="height" constant="20" id="4TV-Qy-6Vh"/>
-                                                                <constraint firstAttribute="width" constant="140" id="klp-Qk-aM9"/>
+                                                                <constraint firstAttribute="width" constant="200" id="klp-Qk-aM9"/>
                                                             </constraints>
                                                             <fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
                                                             <color key="textColor" red="0.53333333329999999" green="0.56078431370000004" blue="0.6588235294" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

+ 6 - 6
OneCable/Classes/CommonUI/DeviceSelectPopupView.m

@@ -108,11 +108,6 @@
 
 - (void)didMoveToSuperview {
     
-    NSLog(@"didMoveToSuperview");
-    NSLog(@"didMoveToSuperview");
-    NSLog(@"didMoveToSuperview");
-    NSLog(@"didMoveToSuperview");
-    NSLog(@"didMoveToSuperview");
     
 }
 
@@ -158,13 +153,18 @@
     
     ItemModel *item = _refDevices[indexPath.row];
     
+    NSLog(@"item : %@", item);
+    
     UIImageView *selectedBg = [[UIImageView alloc] initWithImage:_bgCellImage1];
     UIImageView *defaultBg = [[UIImageView alloc] initWithImage:_bgCellImage2];
     
     
     DeviceSelectPopupTableViewCell *tcell = (DeviceSelectPopupTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"DeviceCellIdentifier"];
     tcell.lblDeviceName.text = item.sourceName;
-    [tcell.imgvDevice sd_setImageWithURL:[NSURL URLWithString:item.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
+    
+    
+    tcell.imgvDevice.image = [UIImage imageNamed:[[JDFacade facade] deviceIconFromSourceName:item.sourceName]];
+    //    [tcell.imgvDevice sd_setImageWithURL:[NSURL URLWithString:item.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
 
     if ([_typeCode isEqualToString:ksItemTypeCodeTrigger] || [_typeCode isEqualToString:ksItemTypeCodeCondition]) {//트리거 또는 컨디션
         tcell.chkSelect.hidden = YES;

+ 4 - 0
OneCable/Classes/Definitions.h

@@ -474,6 +474,10 @@ typedef enum MorePopupBtnType {
                    NSLocalizedString(@"토", @"토"),\
                    NSLocalizedString(@"일", @"일")]
 
+#define DEVICE_SOURCE_ICON  @[ @{@"sourceName":@"Gaslock", @"sourceSubId":@"gasvalve", @"icon":@"img_rule_icon_device_valve"}\
+                              ,@{@"sourceName":@"Smart Plug", @"sourceSubId":@"plug", @"icon":@"img_rule_icon_device_plug"}\
+                              ,@{@"sourceName":@"Door", @"sourceSubId":@"door", @"icon":@"img_rule_icon_device_door"}]
+
 
 //kneet2_Definitions_h
 #endif

+ 5 - 0
OneCable/Classes/JDFacade.h

@@ -175,4 +175,9 @@ extern CGRect gKeyboardRect;
 -(NSString *)getUrlWithArr:(NSString *)str arguments:(NSArray *)arguments;
 -(NSString *)getUrlWithCustGroupIDAndMemberID:(NSString *)str;
 -(NSString *)getUrlWithCustAndGroupIDAndInputMemId:(NSString *)str inputId:(NSString *)inputId;
+
+
+- (NSString*)deviceIconFromSourceSubId:(NSString*)source;
+- (NSString*)deviceIconFromSourceName:(NSString*)name;
+
 @end

+ 40 - 0
OneCable/Classes/JDFacade.m

@@ -1020,4 +1020,44 @@ static NSString *const ksKeychainArchiveData = @"_archiveData";
 }
 
 
+//itemsubmodel 에서 sourcesubid로 아이콘 찾기
+- (NSString*)deviceIconFromSourceSubId:(NSString*)source {
+    
+    NSString *icon = @"" ;
+    
+    for( NSDictionary *item in DEVICE_SOURCE_ICON ) {
+        
+        NSString *sourceId = [item objectForKey:@"sourceSubId"] ;
+        
+        if( EQUALS(sourceId, source)) {
+            
+            icon = [item objectForKey:@"icon"] ;
+            break;
+        }
+        
+    }
+    
+    return icon ;
+}
+
+//itemmodel 에서 sourcename으로 아이콘 찾기
+- (NSString*)deviceIconFromSourceName:(NSString*)name {
+    
+    NSString *icon = @"" ;
+    
+    for( NSDictionary *item in DEVICE_SOURCE_ICON ) {
+        
+        NSString *sourceName = [item objectForKey:@"sourceName"] ;
+        
+        if( EQUALS(sourceName, name)) {
+            
+            icon = [item objectForKey:@"icon"] ;
+            break;
+        }
+        
+    }
+    
+    return icon ;
+}
+
 @end

+ 3 - 3
OneCable/Classes/Model/DeviceModel.m

@@ -660,7 +660,7 @@
         self.cmdclsValue = subItem.cmdclsValue;
         self.nickname = subItem.nickname;
         self.deleteYn = subItem.deleteYn;
-
+        
 //        objc_setAssociatedObject(self, @"CHECK_STATUS", @YES, OBJC_ASSOCIATION_COPY_NONATOMIC); //for checkbox
         [[JDFacade facade] setRadioButtonStatus:@YES object:self];  //for radio box
     }
@@ -689,7 +689,7 @@
         self.softwareVersion = deviceModel.softwareVersion;
         self.totalCtrtCnt = deviceModel.totalCtrtCnt;
         self.deviceOnlineLastDatetime = deviceModel.deviceOnlineLastDatetime;
-
+        
         //        objc_setAssociatedObject(self, @"CHECK_STATUS", @YES, OBJC_ASSOCIATION_COPY_NONATOMIC); //for checkbox
         [[JDFacade facade] setRadioButtonStatus:@YES object:self];  //for radio box
     }
@@ -856,7 +856,7 @@
         self.cmdclsValue = subItem.cmdclsValue;
         self.predCmdclsValue = subItem.predCmdclsValue;
         self.deleteYn = subItem.deleteYn;
-
+       
         [[JDFacade facade] setCheckBoxStatus:@YES object:self];  //for check box
         [[JDFacade facade] setRadioButtonStatus:@YES object:self];  //for radio box
     }

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

@@ -134,7 +134,7 @@ typedef NS_ENUM(NSInteger, CmdClsType) {
 
 @property (copy, nonatomic) NSString *hour;
 @property (copy, nonatomic) NSString *minute;
-@property (copy, nonatomic) NSString *daysOfWeek;
+@property (copy, nonatomic) NSString *dayofweek;
 @property (copy, nonatomic) NSString *nickname;
 @property (copy, nonatomic) NSString *predCmdclsValue;
 

+ 3 - 3
OneCable/Classes/Model/ItemModel.m

@@ -48,9 +48,9 @@
     return lstr;
 }
 
-- (NSString *)daysOfWeek {
-    if (_daysOfWeek) {
-        return _daysOfWeek;
+- (NSString *)dayOfWeek {
+    if (_dayofweek) {
+        return _dayofweek;
     }
 
     NSMutableString *days = [[NSMutableString alloc] init];

+ 4 - 0
OneCable/Classes/ViewControllers/MainScreens/ManagementViewController.m

@@ -292,6 +292,10 @@
     
     ModeModel *mode = [_dashboard.modeList objectKey:@"basicModeCode" eqaulToString:modeCode];
     
+    //이미 사용중이면 통신 안함.
+    if ([mode.useYn boolValue]) return;
+    
+    
     //    로직 변경
     //        if (!mode.homegrpSceneId || [mode.homegrpSceneId isEmptyString]) {
     //

+ 2 - 2
OneCable/Classes/ViewControllers/RuelsScreens/DaylightPopupView.m

@@ -116,7 +116,7 @@
         
         for (NSInteger i = 0 ; i < WEEKDAYS.count ; i++) {
             
-            if ([subItem.daysOfWeek containsString: [WEEKDAYS objectAtIndex:i]]) {
+            if ([subItem.dayofweek containsString: [WEEKDAYS objectAtIndex:i]]) {
                 
                 CustomCheckBox *chk = [_chkDays objectAtIndex:i];
                 chk.checked = YES;
@@ -245,7 +245,7 @@
     subItem.sourceId = _weatherLocation.commonCode;
     subItem.sourceName = _weatherLocation.commonCodeName;
     subItem.sourceSubId = _btnSunRise.selected ? @"sunriseUtcTime" : @"sunsetUtcTime";
-    subItem.daysOfWeek = [TimePickerPopupView daysOfWeek:_chkDays];
+    subItem.dayofweek = [TimePickerPopupView daysOfWeek:_chkDays];
     
     //set Days condition
     //[TimePickerPopupView setDaysCondition:_refConditions chkDays:_chkDays];

+ 2 - 2
OneCable/Classes/ViewControllers/RuelsScreens/ExternHeatPopupView.m

@@ -140,7 +140,7 @@
         
         for (NSInteger i = 0 ; i < WEEKDAYS.count ; i++) {
             
-            if ([subItem.daysOfWeek containsString: [WEEKDAYS objectAtIndex:i]]) {
+            if ([subItem.dayofweek containsString: [WEEKDAYS objectAtIndex:i]]) {
                 
                 CustomCheckBox *chk = [_chkDays objectAtIndex:i];
                 chk.checked = YES;
@@ -299,7 +299,7 @@
     subItem.sourceName = _weatherLocation.commonCodeName;
     subItem.conditionTypeCode = _btnOver.selected ? ksConditionTypeCodeGreatOrEqual : ksConditionTypeCodeLessOrEqual;
     subItem.cmdclsValue = _temperature;
-    subItem.daysOfWeek = [TimePickerPopupView daysOfWeek:_chkDays];
+    subItem.dayofweek = [TimePickerPopupView daysOfWeek:_chkDays];
     
     //set Days condition
     //[TimePickerPopupView setDaysCondition:_refConditions chkDays:_chkDays];

+ 1 - 1
OneCable/Classes/ViewControllers/RuelsScreens/RulesAddViewController.h

@@ -71,7 +71,7 @@
 @property (weak, nonatomic) IBOutlet CustomButton *btnDelete;
 @property (weak, nonatomic) IBOutlet CustomButton *btnConfirm;
 
-- (void)registHeightChangeBlock:(void (^)(CGFloat height)) heightChangeBlock ;
+- (void)registTvStatusChangeBlock:(void (^)(NSInteger tag, CGFloat height)) statusChangeBlock ;
 
 @end
 

+ 41 - 23
OneCable/Classes/ViewControllers/RuelsScreens/RulesAddViewController.m

@@ -68,7 +68,7 @@
 //알림 메시지
 @interface RulesAddTextTableViewCell() <UITextViewDelegate>
 
-@property (nonatomic, strong) void (^heightChangeBlock)(CGFloat height) ;
+@property (nonatomic, strong) void (^statusChangeBlock)(NSInteger tag, CGFloat height) ;
 
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *constTxtHeight;
 @property CGRect previousRect;
@@ -85,15 +85,15 @@
 }
 
 
-- (void)registHeightChangeBlock:(void (^)(CGFloat height)) heightChangeBlock {
+- (void)registTvStatusChangeBlock:(void (^)(NSInteger tag, CGFloat height)) statusChangeBlock {
     
-    _heightChangeBlock = heightChangeBlock ;
+    _statusChangeBlock = statusChangeBlock ;
 }
 
 - (void)invokeChangeHeight:(CGFloat)height {
     
-    if( _heightChangeBlock != nil )
-        _heightChangeBlock(height) ;
+    if( _statusChangeBlock != nil )
+        _statusChangeBlock(1, height) ;
 }
 
 #pragma mark - textView delegate
@@ -130,6 +130,9 @@
 - (void)textViewDidBeginEditing:(UITextView *)textView {
     
     _imgTxtBg.highlighted = YES;
+    
+    if( _statusChangeBlock != nil )
+        _statusChangeBlock(0, 0) ;
 }
 
 - (void)textViewDidEndEditing:(UITextView *)textView {
@@ -386,8 +389,6 @@
 
 - (void)requestRegisterRule {
     
-    NSLog(@"requestRegisterRule");
-    
     NSArray *triggers       = [self items:_triggers];
     NSArray *actions        = [self items:_actions];
     
@@ -621,7 +622,7 @@
             
             NSDictionary *rSubItem = @{@"hour": subItem.hour,
                                        @"minute": subItem.minute,
-                                       @"dayofweek": subItem.daysOfWeek};
+                                       @"dayofweek": subItem.dayofweek};
             
             [rSubItems addObject:rSubItem];
         }
@@ -632,7 +633,7 @@
             
             NSDictionary *rSubItem = @{@"source_id": subItem.sourceId,
                                        @"source_sub_id": subItem.sourceSubId,
-                                       @"dayofweek": subItem.daysOfWeek};
+                                       @"dayofweek": subItem.dayofweek};
             
             [rSubItems addObject:rSubItem];
         }
@@ -644,7 +645,7 @@
             NSDictionary *rSubItem = @{@"source_id": subItem.sourceId,
                                        @"condition_type_code": subItem.conditionTypeCode,
                                        @"cmdcls_value": subItem.cmdclsValue,
-                                       @"dayofweek": subItem.daysOfWeek};
+                                       @"dayofweek": subItem.dayofweek};
             
             [rSubItems addObject:rSubItem];
         }
@@ -1069,9 +1070,13 @@
         
         //노드의 액션 값을 세팅함.
         if (subItem.cmdclsValueList && subItem.cmdclsValueList.count) {//커맨드클래스 밸루 리스트가 있을 경우,
+            
             CmdClsValueModel *cmdclsValue = [subItem.cmdclsValueList matchedObjectName:ksCustomRadioButtonStatus condition:YES];
+            
             cell.lblCondition.text = [DeviceModel contentValueMsgByCmdClsCode:subItem.cmdclsCode cmdclsTypeId:(NSString *)subItem.cmdclsTypeId contentValue:cmdclsValue.cmdclsValue];
-        } else {
+        }
+        else {
+            
             if (subItem.cmdclsValueMsg) {
                 cell.lblCondition.text = subItem.cmdclsValueMsg;
             } else {
@@ -1079,6 +1084,7 @@
                 cell.lblCondition.text = [NSString stringWithFormat:@"%@%@ %@", subItem.cmdclsValue, subItem.unit, condition];
             }
         }
+        
         //[cell.lblCondition setUnderLine:cell.lblCondition.text];
         cell.lblCondition.hidden = NO;
         
@@ -1086,15 +1092,14 @@
         
         subItem = item.timers && item.timers.count ? item.timers[0] : nil;
         if (subItem) {
-            
-            NSLog(@"subItem : %@", subItem);
+ 
             NSInteger phour = [subItem.hour integerValue];
             NSString *period = phour < 12 ? @"오전" : @"오후";
             NSString *title = [NSString stringWithFormat:@"%@ %zd:%@", period, phour, subItem.minute];
             
 //            NSDictionary *titleColor = @{NSForegroundColorAttributeName : kUITextColor02};
             cell.lblItem.text = title;
-            cell.lblSubItem.text = subItem.daysOfWeek;//[self daysOfWeekAtSubItem];
+            cell.lblSubItem.text = subItem.dayofweek;//[self daysOfWeekAtSubItem];
             
             cell.lblCondition.hidden = YES;
         }
@@ -1105,7 +1110,7 @@
             NSString *title = [subItem.sourceSubId isEqualToString:@"sunriseUtcTime"] ? @"해뜰때" : @"해질때";
 
             cell.lblItem.text = title;
-            cell.lblSubItem.text = [NSString stringWithFormat:@"%@ / %@", subItem.sourceName, subItem.daysOfWeek];//[self daysOfWeekAtSubItem]];
+            cell.lblSubItem.text = [NSString stringWithFormat:@"%@ / %@", subItem.sourceName, subItem.dayofweek];//[self daysOfWeekAtSubItem]];
             
             cell.lblCondition.hidden = YES;
         }
@@ -1116,7 +1121,7 @@
             NSString *title = [subItem.conditionTypeCode isEqualToString:ksConditionTypeCodeGreatOrEqual] ? @"더울때" : @"추울때";
             
             cell.lblItem.text = title;
-            cell.lblSubItem.text = [NSString stringWithFormat:@"%@ / %@℃ / %@", subItem.sourceName, subItem.cmdclsValue, subItem.daysOfWeek];//[self daysOfWeekAtSubItem]];
+            cell.lblSubItem.text = [NSString stringWithFormat:@"%@ / %@℃ / %@", subItem.sourceName, subItem.cmdclsValue, subItem.dayofweek];//[self daysOfWeekAtSubItem]];
             
             cell.lblCondition.hidden = YES;
         }
@@ -1139,7 +1144,7 @@
     ItemModel *daysCondition = [_conditions objectKey:@"itemSubTypeCode" eqaulToString:ksConditionSubTypeCodeDaysOfWeek];
     if (daysCondition) {
         ItemSubModel *subCondition = daysCondition.subItems[0];
-        daysOfWeek = subCondition.daysOfWeek;
+        daysOfWeek = subCondition.dayofweek;
     }
     return daysOfWeek;
 }
@@ -1159,7 +1164,10 @@
         image = [UIImage imageNamed:@"img_rule_icon_Temperature"];
     }
     else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeDevice]) {
-        image = [UIImage imageNamed:@"img_rule_icon_device_plug"];
+        
+        ItemSubModel *subItem = [item.subItems matchedObjectName:ksCustomRadioButtonStatus condition:YES];
+        image = [UIImage imageNamed:[[JDFacade facade] deviceIconFromSourceSubId:subItem.sourceSubId]];
+        
     }
     return image;
 }
@@ -1224,8 +1232,9 @@
 
         tcell.lblSubItem.text = subItem.sourceSubName;
 //        tcell.lblItem.textColor = kUITextColor01;
-        
-        [tcell.imgvIcon sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
+
+        tcell.imgvIcon.image = [UIImage imageNamed:[[JDFacade facade] deviceIconFromSourceSubId:subItem.sourceSubId]];
+//        [tcell.imgvIcon sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
 
         //노드의 액션 값을 세팅함.
         if (subItem.cmdclsValueList && subItem.cmdclsValueList.count) {//커맨드클래스 밸루 리스트가 있을 경우,
@@ -1263,9 +1272,18 @@
         RulesAddTextTableViewCell *tcell = (RulesAddTextTableViewCell *)[_tableView dequeueReusableCellWithIdentifier:@"TextCellIdentifier"];
         
         //높이변경
-        [tcell registHeightChangeBlock:^(CGFloat height) {
-            textCellChangeHeight += height;
-            [self tableView:_tableView reloadRowWhileShowingKeyboard:indexPath];
+        [tcell registTvStatusChangeBlock:^(NSInteger tag, CGFloat height) {
+            
+            if (tag == 0) {
+                [tableView scrollToRowAtIndexPath:indexPath
+                                 atScrollPosition:UITableViewScrollPositionTop
+                                         animated:NO];
+            }
+            else {
+                
+                textCellChangeHeight += height;
+                [self tableView:_tableView reloadRowWhileShowingKeyboard:indexPath];
+            }
         }];
         
         if (!_txvMessage) {

+ 4 - 5
OneCable/Classes/ViewControllers/RuelsScreens/RulesConditionViewController.m

@@ -349,7 +349,7 @@
     NSArray *dueDates = [subCondition.cmdclsValue componentsSeparatedByString:@"~"];
     tcell.lblItem.text = [NSString stringWithFormat:@"%@ ~ %@", dueDates.firstObject, dueDates.lastObject];
     
-    [tcell.imgvIcon setImage:[UIImage imageNamed:@"img_rule_icon_calendar"]];
+    [tcell.imgvIcon setImage:[UIImage imageNamed:@"img_rule_icon_period"]];
     
     tcell.btnDelete.hidden = _isShowingMode;
     if (!tcell.btnDelete.hidden) {
@@ -376,7 +376,8 @@
     }
     tcell.lblSubItem.text = subItem.sourceSubName;
     
-    [tcell.imgvIcon sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
+    tcell.imgvIcon.image = [UIImage imageNamed:[[JDFacade facade] deviceIconFromSourceSubId:subItem.sourceSubId]];
+//    [tcell.imgvIcon sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
     
     //노드의 액션 값을 세팅함.
     if (subItem.cmdclsValueList && subItem.cmdclsValueList.count) {//커맨드클래스 밸루 리스트가 있을 경우,
@@ -552,9 +553,7 @@
     height += self.pdevices.count > 0 ?  HEADER_HEIGHT + (80 * self.pdevices.count) : 0;
 
     self.view.height = height;
-    
-    NSLog(@"height updateTableView %f", height);
-    
+
     [_tableView reloadData];
     
     if ([self.parentViewController isKindOfClass:[RulesAddViewController class]]) {

+ 20 - 12
OneCable/Classes/ViewControllers/RuelsScreens/RulesDetailViewController.m

@@ -183,6 +183,7 @@
 }
 
 - (void)setContents {
+    
     _triggers = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_ruleDetail.triggers];
     _actions = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_ruleDetail.actions];
     _conditions = (NSMutableArray<ItemModel> *)[[NSMutableArray alloc] initWithArray:_ruleDetail.conditions];
@@ -413,8 +414,6 @@
     
     ItemSubModel *subItem = nil;
     
-    NSLog(@"item : %@", item);
-    
     if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeDevice]) {//장치일 경우
         
         subItem = [item.subItems matchedObjectName:ksCustomRadioButtonStatus condition:YES];
@@ -446,7 +445,8 @@
         
         cell.lblCondition.hidden = NO;
         
-    } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeTimer]) {
+    }
+    else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeTimer]) {
         
         subItem = item.subItems && item.subItems.count ? item.subItems[0] : nil;
         if (subItem) {
@@ -463,35 +463,40 @@
             
 //            NSDictionary *titleColor = @{NSForegroundColorAttributeName : kUITextColor02};
             cell.lblItem.text = title;
-            cell.lblSubItem.text = subItem.daysOfWeek;//[self daysOfWeekAtSubItem];
+            cell.lblSubItem.text = subItem.dayofweek;//[self daysOfWeekAtSubItem];
             
             cell.lblCondition.hidden = YES;
         }
         
-    } else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeDaylight]) {
+    }
+    else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeDaylight]) {
         
         subItem = item.subItems && item.subItems.count ? item.subItems[0] : nil;
         if (subItem) {
             NSString *title = [subItem.sourceSubId isEqualToString:@"sunriseUtcTime"] ? @"해뜰때" : @"해질때";
             
             cell.lblItem.text = title;
-            cell.lblSubItem.text = [NSString stringWithFormat:@"%@ / %@", subItem.sourceName, subItem.daysOfWeek];
+            cell.lblSubItem.text = [NSString stringWithFormat:@"%@ / %@", subItem.sourceName, subItem.dayofweek];
             
             cell.lblCondition.hidden = YES;
+            
         }
-    }  else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeHeat]) {
+    }
+    else if ([item.itemSubTypeCode isEqualToString:ksItemSubTypeCodeHeat]) {
         
         subItem = item.subItems && item.subItems.count ? item.subItems[0] : nil;
         if (subItem) {
             NSString *title = [subItem.conditionTypeCode isEqualToString:ksConditionTypeCodeGreatOrEqual] ? @"더울때" : @"추울때";
             
             cell.lblItem.text = title;
-            cell.lblSubItem.text = [NSString stringWithFormat:@"%@ / %@℃ / %@", subItem.sourceName, subItem.cmdclsValue, subItem.daysOfWeek];
+            cell.lblSubItem.text = [NSString stringWithFormat:@"%@ / %@℃ / %@", subItem.sourceName, subItem.cmdclsValue, subItem.dayofweek];
             
             cell.lblCondition.hidden = YES;
         }
     }
     
+    NSLog(@"configureTriggerCell\n\n%@", subItem);
+    
 //    [cell.imgvIcon sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
     //수정
     cell.imgvIcon.image = [self imageForTrigger:item];
@@ -525,7 +530,7 @@
     ItemModel *daysCondition = [_conditions objectKey:@"itemSubTypeCode" eqaulToString:ksConditionSubTypeCodeDaysOfWeek];
     if (daysCondition) {
         ItemSubModel *subCondition = daysCondition.subItems[0];
-        daysOfWeek = subCondition.daysOfWeek;
+        daysOfWeek = subCondition.dayofweek;
     }
     return daysOfWeek;
 }
@@ -559,8 +564,6 @@
         ItemModel *deviceItem = [_actions objectKey:@"itemSubTypeCode" eqaulToString:ksItemSubTypeCodeDevice];
         ItemSubModel *subItem = deviceItem.subItems[indexPath.row];
         
-        NSLog(@"section == 2\nsubItem : %@", subItem);
-        
         RulesDetailTableViewCell *tcell = (RulesDetailTableViewCell *)[_tableView dequeueReusableCellWithIdentifier:@"RulesCellIdentifier"];
         tcell.lblItem.text = subItem.sourceName;
         tcell.lblItem.textColor = kUITextColor01;
@@ -572,7 +575,9 @@
         tcell.lblSubItem.text = subItem.sourceSubName;
         tcell.lblCondition.text = subItem.cmdclsValueMsg;         //노드의 액션 값을 세팅함.
         
-        [tcell.imgvIcon sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
+        //        [tcell.imgvIcon sd_setImageWithURL:[NSURL URLWithString:subItem.imageFileName] placeholderImage:nil options:SDWebImageRefreshCached];
+        
+        tcell.imgvIcon.image = [UIImage imageNamed:[[JDFacade facade] deviceIconFromSourceSubId:subItem.sourceSubId]];
         
         cell = tcell;
         
@@ -794,6 +799,9 @@
         
         _ruleDetail = (RuleDetailModel *) responseObject;
         
+        
+        NSLog(@"\n\n_ruleDetail : %@", _ruleDetail);
+        
         if (_ruleDetail) {//API 성공
             
             [self setContents];

+ 2 - 1
OneCable/Classes/ViewControllers/RuelsScreens/RulesViewController.m

@@ -479,7 +479,7 @@
         if (!cell.switchRulePlay.hidden) {
             
             cell.switchRulePlay.hidden = [JDFacade facade].loginUser.level < 90;
-            cell.imgvStatus.highlighted = !EQUALS(rule.useYn, @"Y");
+//            cell.imgvStatus.highlighted = !EQUALS(rule.useYn, @"Y");
 
             cell.switchRulePlay.tag = indexPath.row;
             if (![cell.switchRulePlay actionsForTarget:self forControlEvent:UIControlEventValueChanged]) {
@@ -498,6 +498,7 @@
         rcell = cell;
     }
     else {
+        
         RulesCreateTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AddCellIdentifier"];
         if (![cell.btnAdd actionsForTarget:self forControlEvent:UIControlEventTouchUpInside]) {
             [cell.btnAdd addTarget:self action:@selector(addNewRule) forControlEvents:UIControlEventTouchUpInside];

+ 3 - 3
OneCable/Classes/ViewControllers/RuelsScreens/TimePickerPopupView.m

@@ -128,7 +128,7 @@
         
         for (NSInteger i = 0 ; i < WEEKDAYS.count ; i++) {
             
-            if ([subItem.daysOfWeek containsString: [WEEKDAYS objectAtIndex:i]]) {
+            if ([subItem.dayofweek containsString: [WEEKDAYS objectAtIndex:i]]) {
                 
                 CustomCheckBox *chk = [_chkDays objectAtIndex:i];
                 chk.checked = YES;
@@ -257,7 +257,7 @@
         
         subItem.hour = _txtHour.text;
         subItem.minute = _txtMinute.text;
-        subItem.daysOfWeek = [TimePickerPopupView daysOfWeek:_chkDays];
+        subItem.dayofweek = [TimePickerPopupView daysOfWeek:_chkDays];
 
         _timeTrigger.timers = (NSMutableArray<ItemSubModel> *)[[NSMutableArray alloc] init];
         [_timeTrigger.timers addObject:subItem];
@@ -375,7 +375,7 @@
     ItemSubModel *subCondition = [[ItemSubModel alloc] init];
     subCondition.conditionTypeCode = @"09";
     subCondition.cmdclsValue = [TimePickerPopupView daysOfWeekValue:chkDays];
-    subCondition.daysOfWeek = [TimePickerPopupView daysOfWeek:chkDays];
+    subCondition.dayofweek = [TimePickerPopupView daysOfWeek:chkDays];
     
 
     [condition.subItems addObject:subCondition];