fix my devices list

This commit is contained in:
Danmei Chen 2020-02-26 10:41:47 +01:00
parent 5fe9e65be6
commit ebc8f136f4
3 changed files with 4 additions and 18 deletions

View file

@ -132,7 +132,7 @@ static UICompositeViewDescription *compositeDescription = nil;
entry->myself ? cell.addressLabel.text = NSLocalizedString(@"Me", nil) : [ContactDisplay setDisplayNameLabel:cell.addressLabel forAddress:linphone_participant_get_address(entry->participant)];
cell.participant = entry->participant;
[cell update:(entry->numberOfDevices != 0) isMyself:entry->myself];
[cell update:(entry->numberOfDevices != 0)];
return cell;
}

View file

@ -31,5 +31,5 @@
- (IBAction)onSecurityCallClick:(id)sender;
- (id)initWithIdentifier:(NSString *)identifier;
- (void)update:(BOOL)listOpen isMyself:(BOOL)isMyself;
- (void)update:(BOOL)listOpen;
@end

View file

@ -38,23 +38,9 @@
return self;
}
- (void)update:(BOOL)listOpen isMyself:(BOOL)isMyself {
- (void)update:(BOOL)listOpen {
_devices = linphone_participant_get_devices(_participant);
if (isMyself) {
// remove my device
// TODO replaced by bctbx_list_remove_custom when server can remove device which has no app
bctbx_list_t *cur;
bctbx_list_t *elem = _devices;
while (elem != NULL) {
cur = elem;
elem = elem->next;
if ([[NSString stringWithUTF8String:linphone_participant_device_get_name(cur->data) ? :
linphone_address_as_string_uri_only(linphone_participant_device_get_address(cur->data))] isEqualToString:[[UIDevice currentDevice] name]]) {
_devices = bctbx_list_remove(_devices, cur->data);
break;
}
}
}
UIImage *image = [FastAddressBook imageForSecurityLevel:linphone_participant_get_security_level(_participant)];
if (bctbx_list_size(_devices) == 1) {
[_securityButton setImage:image forState:UIControlStateNormal];