Skip to content

Commit c1f328a

Browse files
ccharlesrenoldcodefarmer
authored andcommitted
默认设备名称添加逻辑判断,采用别名名称
Change-Id: I31a209f32c41789853535611cc98ada69341676c
1 parent bab4378 commit c1f328a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Source/LinkApp/Classes/Module/EquipmentPanel/Controller/TIoTPanelMoreViewController.m

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
167167
// {
168168
// tipString = self.deviceDic[@"DeviceName"];
169169
// }
170+
tipString = [self getDeviceAliasName:tipString];
170171

171172
[av alertWithTitle:NSLocalizedString(@"device_name", @"设备名称") message:tipString cancleTitlt:NSLocalizedString(@"cancel", @"取消") doneTitle:NSLocalizedString(@"verify", @"确认")];
172173
av.maxLength = 20;
@@ -199,6 +200,18 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
199200

200201
}
201202

203+
- (NSString *)getDeviceAliasName:(NSString *)tipString {
204+
NSString * alias = self.deviceDic[@"AliasName"];
205+
if (alias && [alias isKindOfClass:[NSString class]] && alias.length > 0) {
206+
tipString = self.deviceDic[@"AliasName"];
207+
}
208+
else
209+
{
210+
tipString = self.deviceDic[@"DeviceName"];
211+
}
212+
return tipString;
213+
}
214+
202215
#pragma mark setter or getter
203216
- (UITableView *)tableView{
204217
if (_tableView == nil) {
@@ -216,7 +229,10 @@ - (UITableView *)tableView{
216229
- (NSMutableArray *)dataArr{
217230
if (!_dataArr) {
218231
_dataArr = [NSMutableArray array];
219-
[_dataArr addObject:[NSMutableDictionary dictionaryWithDictionary:@{@"title":NSLocalizedString(@"device_name", @"设备名称"),@"value":self.deviceDic[@"AliasName"],@"needArrow":@"1"}]];
232+
233+
NSString * tipString = @"";
234+
tipString = [self getDeviceAliasName:tipString];
235+
[_dataArr addObject:[NSMutableDictionary dictionaryWithDictionary:@{@"title":NSLocalizedString(@"device_name", @"设备名称"),@"value":tipString,@"needArrow":@"1"}]];
220236
[_dataArr addObject:[NSMutableDictionary dictionaryWithDictionary:@{@"title":NSLocalizedString(@"device_info", @"设备信息"),@"value":@"",@"needArrow":@"1"}]];
221237
[_dataArr addObject:[NSMutableDictionary dictionaryWithDictionary:@{@"title":NSLocalizedString(@"room_setting", @"房间设置"),@"value":@"",@"needArrow":@"1"}]];
222238
[_dataArr addObject:[NSMutableDictionary dictionaryWithDictionary:@{@"title":NSLocalizedString(@"device_share", @"设备分享"),@"value":@"",@"needArrow":@"1"}]];

0 commit comments

Comments
 (0)