萤石云 iOSSDK,移植跨平台相关工程
Davin
2023-07-10 0de4cf306d8e13fd57b3e04bfb81362a10f12a4d
EZSDK/EZSDK/EZ/TempPassword/Views/HDLEZDeviceMsgListView.m
@@ -30,6 +30,9 @@
        self.delegate = self;
        self.dataSource = self;
        cellHeight=80;
        self.rowHeight = UITableViewAutomaticDimension;
        self.estimatedRowHeight = 80;
        [self registerClass:[HDLEZVideoDoorMsgCell class] forCellReuseIdentifier:@"HDLEZVideoDoorMsgCell"];
        [self setSeparatorInset:UIEdgeInsetsZero];
//        [self setLayoutMargins:UIEdgeInsetsZero];
    }
@@ -46,12 +49,12 @@
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return cellHeight;
    return UITableViewAutomaticDimension;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    HDLEZLog(@"初始化cell");
    HDLEZVideoDoorMsgCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HDLEZVideoDoorMsgCell"];
    HDLEZVideoDoorMsgCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HDLEZVideoDoorMsgCell" forIndexPath:indexPath];
    if(cell == nil){
        cell=[[HDLEZVideoDoorMsgCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"HDLEZVideoDoorMsgCell"];
    }
@@ -71,10 +74,8 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.msgList.count <= indexPath.row) return;
    HDLEZDeviceMsgInfoModel *messageModel = self.msgList[indexPath.row];
#warning mock
    NSString *tempPicUrl = @"https://upload-images.jianshu.io/upload_images/5809200-a99419bb94924e6d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240";
    if (self.previewPic) {
        self.previewPic(tempPicUrl);
    if (self.previewPic && messageModel.extInfo.picUrl && messageModel.extInfo.picUrl.length > 0) {
        self.previewPic(messageModel.extInfo.picUrl);
    }
}
@@ -88,9 +89,25 @@
    if (self.msgList.count <= indexPath.row) return;
    
    HDLEZDeviceMsgInfoModel *messageModel = self.msgList[indexPath.row];
#warning mock
    NSString *tempPicUrl = @"https://upload-images.jianshu.io/upload_images/5809200-a99419bb94924e6d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240";
    [cell configMessageInfoWithTitle:messageModel.title deviceStatus:@"未接听" messageTime:messageModel.createTime messageImage:tempPicUrl];
    NSString *status = @"";
    if ([messageModel.extInfo.answerStatus isEqualToString:@"answer"]) {
        status = HDLEZLocallizedString(@"device_callout_answer");
    } else if (([messageModel.extInfo.answerStatus isEqualToString:@"no_answer"])) {
        status = HDLEZLocallizedString(@"device_callout_no_answer");
    }
    if (messageModel.createTime && messageModel.createTime.length == 13) {  // 毫秒转秒
        messageModel.createTime = [messageModel.createTime substringToIndex:10];
    }
    NSString *messageTime = [self turnDate:messageModel.createTime];
    [cell configMessageInfoWithTitle:messageModel.content deviceStatus:status messageTime:messageTime messageImage:messageModel.extInfo.picUrl];
    [cell showSpearator:(self.msgList.count != indexPath.row + 1)];
}
/*时间戳转时间
 */
-(NSString *)turnDate:(NSString*)dateStr{
    return [HDLEZConstants timeStrWithFormate:@"yyyy.MM.dd HH:mm" data:[NSDate dateWithTimeIntervalSince1970:[dateStr integerValue]]];;
}
/*设置消息列表值