mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-03 20:46:28 +00:00
Fix magic search to also display contacts that were created through remote provisioning, not just LDAP or native
This commit is contained in:
parent
7ddfff9c32
commit
1e1c0fd3d3
6 changed files with 16 additions and 11 deletions
|
|
@ -136,7 +136,7 @@
|
||||||
address = [NSString stringWithUTF8String:uri];
|
address = [NSString stringWithUTF8String:uri];
|
||||||
|
|
||||||
contact = [[Contact alloc] initWithFriend:friend];
|
contact = [[Contact alloc] initWithFriend:friend];
|
||||||
[contact setCreatedFromLdap:TRUE];
|
[contact setCreatedFromLdapOrProvisioning:TRUE];
|
||||||
[_ldapContactAddressBookMap setObject:contact forKey:address];
|
[_ldapContactAddressBookMap setObject:contact forKey:address];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@
|
||||||
BOOL greyCellForEncryptedChat = _isEncrypted ? capabilities > 1 : TRUE;
|
BOOL greyCellForEncryptedChat = _isEncrypted ? capabilities > 1 : TRUE;
|
||||||
BOOL greyCellForGroupChat = _isGroupChat ? capabilities > 0 : TRUE;
|
BOOL greyCellForGroupChat = _isGroupChat ? capabilities > 0 : TRUE;
|
||||||
cell.userInteractionEnabled = cell.greyView.hidden = greyCellForEncryptedChat && greyCellForGroupChat;
|
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);
|
char *str = linphone_address_as_string(addr);
|
||||||
cell.addressLabel.text = linphoneContact ? [NSString stringWithUTF8String:str] : phoneOrAddr;
|
cell.addressLabel.text = linphoneContact ? [NSString stringWithUTF8String:str] : phoneOrAddr;
|
||||||
ms_free(str);
|
ms_free(str);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
@property(nonatomic, strong) NSMutableArray *sipAddresses;
|
@property(nonatomic, strong) NSMutableArray *sipAddresses;
|
||||||
@property(nonatomic, strong) NSMutableArray *emails;
|
@property(nonatomic, strong) NSMutableArray *emails;
|
||||||
@property(nonatomic, strong) NSMutableArray *phones;
|
@property(nonatomic, strong) NSMutableArray *phones;
|
||||||
@property BOOL createdFromLdap;
|
@property BOOL createdFromLdapOrProvisioning;
|
||||||
@property BOOL added;
|
@property BOOL added;
|
||||||
|
|
||||||
- (void)setAvatar:(UIImage *)avatar;
|
- (void)setAvatar:(UIImage *)avatar;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
_person = acncontact;
|
_person = acncontact;
|
||||||
_friend = afriend ? linphone_friend_ref(afriend) : NULL;
|
_friend = afriend ? linphone_friend_ref(afriend) : NULL;
|
||||||
_added = FALSE;
|
_added = FALSE;
|
||||||
_createdFromLdap = FALSE;
|
_createdFromLdapOrProvisioning = FALSE;
|
||||||
_phones = [[NSMutableArray alloc] init];
|
_phones = [[NSMutableArray alloc] init];
|
||||||
_sipAddresses = [[NSMutableArray alloc] init];
|
_sipAddresses = [[NSMutableArray alloc] init];
|
||||||
_emails = [[NSMutableArray alloc] init];
|
_emails = [[NSMutableArray alloc] init];
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@
|
||||||
/*first and last name only when editting */
|
/*first and last name only when editting */
|
||||||
return (self.tableView.isEditing) ? 1 : 0;
|
return (self.tableView.isEditing) ? 1 : 0;
|
||||||
} else if (section == ContactSections_Sip) {
|
} else if (section == ContactSections_Sip) {
|
||||||
return _contact.createdFromLdap ? 0 : _contact.sipAddresses.count;
|
return _contact.createdFromLdapOrProvisioning ? 0 : _contact.sipAddresses.count;
|
||||||
} else if (section == ContactSections_Number) {
|
} else if (section == ContactSections_Number) {
|
||||||
return _contact.phones.count;
|
return _contact.phones.count;
|
||||||
} else if (section == ContactSections_Email) {
|
} else if (section == ContactSections_Email) {
|
||||||
|
|
@ -283,7 +283,7 @@
|
||||||
if (section == ContactSections_Number) {
|
if (section == ContactSections_Number) {
|
||||||
text = NSLocalizedString(@"Phone numbers", nil);
|
text = NSLocalizedString(@"Phone numbers", nil);
|
||||||
addEntryName = NSLocalizedString(@"Add new phone number", 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);
|
text = NSLocalizedString(@"SIP addresses", nil);
|
||||||
addEntryName = NSLocalizedString(@"Add new SIP address", nil);
|
addEntryName = NSLocalizedString(@"Add new SIP address", nil);
|
||||||
} else if (section == ContactSections_Email &&
|
} else if (section == ContactSections_Email &&
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,8 @@
|
||||||
_contact = acontact;
|
_contact = acontact;
|
||||||
_emptyLabel.hidden = (_contact != NULL);
|
_emptyLabel.hidden = (_contact != NULL);
|
||||||
_avatarImage.hidden = !_emptyLabel.hidden;
|
_avatarImage.hidden = !_emptyLabel.hidden;
|
||||||
_deleteButton.hidden = !_emptyLabel.hidden || [_contact createdFromLdap];
|
_deleteButton.hidden = !_emptyLabel.hidden || [_contact createdFromLdapOrProvisioning];
|
||||||
_editButton.hidden = !_emptyLabel.hidden || [_contact createdFromLdap];
|
_editButton.hidden = !_emptyLabel.hidden || [_contact createdFromLdapOrProvisioning];
|
||||||
|
|
||||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact] bordered:NO withRoundedRadius:YES];
|
[_avatarImage setImage:[FastAddressBook imageForContact:_contact] bordered:NO withRoundedRadius:YES];
|
||||||
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:_contact];
|
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:_contact];
|
||||||
|
|
@ -284,7 +284,7 @@
|
||||||
if (IPAD && self.contact == NULL) {
|
if (IPAD && self.contact == NULL) {
|
||||||
_editButton.hidden = TRUE;
|
_editButton.hidden = TRUE;
|
||||||
_deleteButton.hidden = TRUE;
|
_deleteButton.hidden = TRUE;
|
||||||
} else if (self.contact != NULL && self.contact.createdFromLdap) {
|
} else if (self.contact != NULL && self.contact.createdFromLdapOrProvisioning) {
|
||||||
_editButton.hidden = TRUE;
|
_editButton.hidden = TRUE;
|
||||||
_deleteButton.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;
|
_editButton.hidden = TRUE;
|
||||||
_deleteButton.hidden = TRUE;
|
_deleteButton.hidden = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ import linphonesw
|
||||||
if let friend = searchResult.friend {
|
if let friend = searchResult.friend {
|
||||||
if (searchResult.sourceFlags == MagicSearchSource.LdapServers.rawValue), let newContact = Contact(friend: friend.getCobject) {
|
if (searchResult.sourceFlags == MagicSearchSource.LdapServers.rawValue), let newContact = Contact(friend: friend.getCobject) {
|
||||||
// Contact comes from LDAP, creating a new one
|
// Contact comes from LDAP, creating a new one
|
||||||
newContact.createdFromLdap = true
|
newContact.createdFromLdapOrProvisioning = true
|
||||||
return newContact
|
return newContact
|
||||||
}
|
}
|
||||||
if let addr = friend.address, let foundContact = getContactFromAddr(addr: addr) {
|
if let addr = friend.address, let foundContact = getContactFromAddr(addr: addr) {
|
||||||
|
|
@ -86,6 +86,11 @@ import linphonesw
|
||||||
return foundContact
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue