|
|
@@ -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) {
|