Fix magic search to also display contacts that were created through remote provisioning, not just LDAP or native

This commit is contained in:
QuentinArguillere 2022-11-03 11:44:30 +01:00
parent 7ddfff9c32
commit 1e1c0fd3d3
6 changed files with 16 additions and 11 deletions

View file

@ -136,7 +136,7 @@
address = [NSString stringWithUTF8String:uri];
contact = [[Contact alloc] initWithFriend:friend];
[contact setCreatedFromLdap:TRUE];
[contact setCreatedFromLdapOrProvisioning:TRUE];
[_ldapContactAddressBookMap setObject:contact forKey:address];
}
@ -221,7 +221,7 @@
BOOL greyCellForEncryptedChat = _isEncrypted ? capabilities > 1 : TRUE;
BOOL greyCellForGroupChat = _isGroupChat ? capabilities > 0 : TRUE;
cell.userInteractionEnabled = cell.greyView.hidden = greyCellForEncryptedChat && greyCellForGroupChat;
cell.displayNameLabel.text = [contact createdFromLdap] ? [contact displayName] : [FastAddressBook displayNameForAddress:addr];
cell.displayNameLabel.text = [contact createdFromLdapOrProvisioning] ? [contact displayName] : [FastAddressBook displayNameForAddress:addr];
char *str = linphone_address_as_string(addr);
cell.addressLabel.text = linphoneContact ? [NSString stringWithUTF8String:str] : phoneOrAddr;
ms_free(str);

View file

@ -35,7 +35,7 @@
@property(nonatomic, strong) NSMutableArray *sipAddresses;
@property(nonatomic, strong) NSMutableArray *emails;
@property(nonatomic, strong) NSMutableArray *phones;
@property BOOL createdFromLdap;
@property BOOL createdFromLdapOrProvisioning;
@property BOOL added;
- (void)setAvatar:(UIImage *)avatar;

View file

@ -36,7 +36,7 @@
_person = acncontact;
_friend = afriend ? linphone_friend_ref(afriend) : NULL;
_added = FALSE;
_createdFromLdap = FALSE;
_createdFromLdapOrProvisioning = FALSE;
_phones = [[NSMutableArray alloc] init];
_sipAddresses = [[NSMutableArray alloc] init];
_emails = [[NSMutableArray alloc] init];

View file

@ -160,7 +160,7 @@
/*first and last name only when editting */
return (self.tableView.isEditing) ? 1 : 0;
} else if (section == ContactSections_Sip) {
return _contact.createdFromLdap ? 0 : _contact.sipAddresses.count;
return _contact.createdFromLdapOrProvisioning ? 0 : _contact.sipAddresses.count;
} else if (section == ContactSections_Number) {
return _contact.phones.count;
} else if (section == ContactSections_Email) {
@ -283,7 +283,7 @@
if (section == ContactSections_Number) {
text = NSLocalizedString(@"Phone numbers", nil);
addEntryName = NSLocalizedString(@"Add new phone number", nil);
} else if (section == ContactSections_Sip && !_contact.createdFromLdap) {
} else if (section == ContactSections_Sip && !_contact.createdFromLdapOrProvisioning) {
text = NSLocalizedString(@"SIP addresses", nil);
addEntryName = NSLocalizedString(@"Add new SIP address", nil);
} else if (section == ContactSections_Email &&

View file

@ -119,8 +119,8 @@
_contact = acontact;
_emptyLabel.hidden = (_contact != NULL);
_avatarImage.hidden = !_emptyLabel.hidden;
_deleteButton.hidden = !_emptyLabel.hidden || [_contact createdFromLdap];
_editButton.hidden = !_emptyLabel.hidden || [_contact createdFromLdap];
_deleteButton.hidden = !_emptyLabel.hidden || [_contact createdFromLdapOrProvisioning];
_editButton.hidden = !_emptyLabel.hidden || [_contact createdFromLdapOrProvisioning];
[_avatarImage setImage:[FastAddressBook imageForContact:_contact] bordered:NO withRoundedRadius:YES];
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:_contact];
@ -284,7 +284,7 @@
if (IPAD && self.contact == NULL) {
_editButton.hidden = TRUE;
_deleteButton.hidden = TRUE;
} else if (self.contact != NULL && self.contact.createdFromLdap) {
} else if (self.contact != NULL && self.contact.createdFromLdapOrProvisioning) {
_editButton.hidden = TRUE;
_deleteButton.hidden = TRUE;
}
@ -314,7 +314,7 @@
}
}
if (self.contact != NULL && self.contact.createdFromLdap) {
if (self.contact != NULL && self.contact.createdFromLdapOrProvisioning) {
_editButton.hidden = TRUE;
_deleteButton.hidden = TRUE;
}

View file

@ -65,7 +65,7 @@ import linphonesw
if let friend = searchResult.friend {
if (searchResult.sourceFlags == MagicSearchSource.LdapServers.rawValue), let newContact = Contact(friend: friend.getCobject) {
// Contact comes from LDAP, creating a new one
newContact.createdFromLdap = true
newContact.createdFromLdapOrProvisioning = true
return newContact
}
if let addr = friend.address, let foundContact = getContactFromAddr(addr: addr) {
@ -86,6 +86,11 @@ import linphonesw
return foundContact
}
// Friend comes from provisioning
if let addr = searchResult.address, let friend = searchResult.friend, let newContact = Contact(friend: friend.getCobject) {
newContact.createdFromLdapOrProvisioning = true
return newContact
}
return nil
}