From ce8d0ea359282a6452657d8fbb5fdce11327052d Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Wed, 8 Apr 2020 11:02:50 +0200 Subject: [PATCH] show all my devices --- Classes/DevicesListView.m | 9 +-------- Classes/LinphoneUI/UIDeviceCell.m | 4 ++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Classes/DevicesListView.m b/Classes/DevicesListView.m index 971b46a47..bb16ddc35 100644 --- a/Classes/DevicesListView.m +++ b/Classes/DevicesListView.m @@ -86,9 +86,7 @@ static UICompositeViewDescription *compositeDescription = nil; } LinphoneParticipant *me = linphone_chat_room_get_me(_room); - // not show me if there is only one device - if (bctbx_list_size(linphone_participant_get_devices(me)) > 1) - [_devicesMenuEntries addObject:[[DevicesMenuEntry alloc] initWithTitle:me number:0 isMe:TRUE]]; + [_devicesMenuEntries addObject:[[DevicesMenuEntry alloc] initWithTitle:me number:0 isMe:TRUE]]; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; [_tableView reloadData]; @@ -114,8 +112,6 @@ static UICompositeViewDescription *compositeDescription = nil; - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { DevicesMenuEntry *entry = [_devicesMenuEntries objectAtIndex:indexPath.row]; - if (entry->myself) - return (entry->numberOfDevices + 1) * 56.0; return entry->numberOfDevices > 1 ? (entry->numberOfDevices + 1) * 56.0 : 56.0; } @@ -142,9 +138,6 @@ static UICompositeViewDescription *compositeDescription = nil; NSInteger num = 0; if (entry->numberOfDevices == 0) { num = bctbx_list_size(linphone_participant_get_devices(entry->participant)); - // not show current device - if (entry->myself) - num -= 1; } [_devicesMenuEntries replaceObjectAtIndex:indexPath.row withObject:[[DevicesMenuEntry alloc] initWithTitle:entry->participant number:num isMe:entry->myself]]; [_tableView reloadData]; diff --git a/Classes/LinphoneUI/UIDeviceCell.m b/Classes/LinphoneUI/UIDeviceCell.m index 4161fbaad..763812b16 100644 --- a/Classes/LinphoneUI/UIDeviceCell.m +++ b/Classes/LinphoneUI/UIDeviceCell.m @@ -36,6 +36,10 @@ } - (void)update { + if (!_device) { + LOGE(@"Can not update, because the device is null."); + return; + } [_securityButton setImage:[FastAddressBook imageForSecurityLevel:linphone_participant_device_get_security_level(_device)] forState:UIControlStateNormal]; _deviceLabel.text = [NSString stringWithUTF8String:linphone_participant_device_get_name(_device) ? :