Skip to content

Commit

Permalink
解决虚拟设备数据没有获取到快捷入口crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ccharlesren committed Apr 7, 2021
1 parent 480d7c0 commit 117b210
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions Source/LinkApp/Classes/Module/Home/View/TIoTShortcutView.m
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,16 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSe

- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
// TIoTShortcutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kShortcutViewCellID forIndexPath:indexPath];
NSDictionary *shortcutDic = @{};
if (indexPath.row < self.dataArray.count) {
shortcutDic = self.dataArray[indexPath.row]?:@{};
}

NSDictionary *shortcutDic = self.dataArray[indexPath.row]?:@{};
// cell.iconURLString = shortcutDic[@"ui"][@"icon"]?:@"";
NSDictionary *model = self.panelShortcutProperties[indexPath.row];
NSDictionary *model = @{};
if (indexPath.row < self.panelShortcutProperties.count) {
model = self.panelShortcutProperties[indexPath.row];
}

// TIoTShortcutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kShortcutViewCellID forIndexPath:indexPath];
// cell.propertyName = model[@"name"];
Expand All @@ -288,7 +294,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
if ([model[@"define"][@"type"] isEqualToString:@"int"]||[model[@"define"][@"type"] isEqualToString:@"float"]) {

TIoTShortcutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kShortcutViewCellID forIndexPath:indexPath];
cell.propertyName = model[@"name"];
cell.propertyName = model[@"name"]?:@"";

__weak typeof(self)weakSelf = self;

Expand Down Expand Up @@ -341,7 +347,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
return cell;
}else if ([model[@"define"][@"type"] isEqualToString:@"enum"]) {
TIoTShortcutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kShortcutViewCellID forIndexPath:indexPath];
cell.propertyName = model[@"name"];
cell.propertyName = model[@"name"]?:@"";
__weak typeof(self)weakSelf = self;

NSString *valueString = [NSString stringWithFormat:@"%@",model[@"status"][@"Value"]?:@"0"];
Expand All @@ -351,7 +357,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
[cell setPropertyModel:model];
cell.enumUpdate = ^{
//trtc特殊判断逻辑
NSString *key = model[@"id"];
NSString *key = model[@"id"]?:@"";
if ([key isEqualToString:TIoTTRTCaudio_call_status] || [key isEqualToString:TIoTTRTCvideo_call_status]) {
weakSelf.reportData = model;
[weakSelf reportDeviceData:@{key: @1}];
Expand Down Expand Up @@ -395,7 +401,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection

}else if ([model[@"define"][@"type"] isEqualToString:@"bool"]) {
TIoTShortcutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kShortcutViewCellID forIndexPath:indexPath];
cell.propertyName = model[@"name"];
cell.propertyName = model[@"name"]?:@"";

NSString *valueString = [NSString stringWithFormat:@"%@",model[@"status"][@"Value"]?:@"0"];
cell.propertyValue = [NSString stringWithFormat:@"%@",model[@"define"][@"mapping"][valueString]?:@""];
Expand All @@ -418,7 +424,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
return cell;
}else {
TIoTShortcutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kShortcutViewCellID forIndexPath:indexPath];
cell.propertyName = model[@"name"];
cell.propertyName = model[@"name"]?:@"";

if (![NSString isNullOrNilWithObject:model[@"define"][@"type"]]) {
cell.propertyValue = @"";
Expand All @@ -430,7 +436,7 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
}else {
//云端定时
TIoTShortcutViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kShortcutViewCellID forIndexPath:indexPath];
cell.propertyName = model[@"name"];
cell.propertyName = model[@"name"]?:@"";
return cell;
}

Expand Down

0 comments on commit 117b210

Please sign in to comment.