add config hide_linphone_contacts

This commit is contained in:
Danmei Chen 2020-03-24 11:40:31 +01:00
parent b0e83b970a
commit becd5e2b14
6 changed files with 22 additions and 5 deletions

View file

@ -167,7 +167,7 @@
if (!addr)
return cell;
cell.linphoneImage.hidden = !linphoneContact;
cell.linphoneImage.hidden = [LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"] || !linphoneContact;
cell.securityImage.hidden = !(model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh));
int capabilities = [[_addressesCached objectAtIndex:indexPath.row] intValue];
BOOL greyCellForEncryptedChat = _isEncrypted ? capabilities > 1 : TRUE;

View file

@ -74,6 +74,13 @@ static UICompositeViewDescription *compositeDescription = nil;
object:nil];
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
_chiffreOptionView.hidden = !(cfg && linphone_proxy_config_get_conference_factory_uri(cfg));
if ([LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"]) {
self.linphoneButton.hidden = TRUE;
self.selectedButtonImage.hidden = TRUE;
CGRect frame = _allButton.frame;
frame.origin.x = _linphoneButton.frame.origin.x;
_allButton.frame = frame;
}
}
- (void)viewUpdateEvent:(NSNotification *)notif {
@ -198,6 +205,9 @@ typedef enum { ContactsAll, ContactsLinphone, ContactsMAX } ContactsCategory;
[_tableController loadData];
}
_selectedButtonImage.frame = frame;
if ([LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"]) {
_allButton.selected = FALSE;
}
}
- (IBAction)onAllClick:(id)event {

View file

@ -139,6 +139,10 @@ static UICompositeViewDescription *compositeDescription = nil;
}
[self refreshButtons];
[_toggleSelectionButton setImage:[UIImage imageNamed:@"select_all_default.png"] forState:UIControlStateSelected];
if ([LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"]) {
self.linphoneButton.hidden = TRUE;
self.selectedButtonImage.hidden = TRUE;
}
}
- (void)viewDidAppear:(BOOL)animated {
@ -206,6 +210,9 @@ static UICompositeViewDescription *compositeDescription = nil;
[tableController loadData];
}
_selectedButtonImage.frame = frame;
if ([LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"]) {
allButton.selected = FALSE;
}
}
- (void)refreshButtons {

View file

@ -146,7 +146,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[_avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
Contact *contact = [FastAddressBook getContactWithAddress:addr];
const LinphonePresenceModel *model = contact.friend ? linphone_friend_get_presence_model(contact.friend) : NULL;
_linphoneImage.hidden =
_linphoneImage.hidden = [LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"] ||
! ((model && linphone_presence_model_get_basic_status(model) == LinphonePresenceBasicStatusOpen) || [FastAddressBook contactHasValidSipDomain:contact]);
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
[self shouldHideEncryptedChatView:cfg && linphone_proxy_config_get_conference_factory_uri(cfg) && model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh)];

View file

@ -79,7 +79,7 @@
_linphoneImage.hidden = TRUE;
if(_contact) {
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:_contact];
_linphoneImage.hidden =
_linphoneImage.hidden = [LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"] ||
! ((_contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(_contact.friend)) == LinphonePresenceBasicStatusOpen) || [FastAddressBook contactHasValidSipDomain:_contact]);
}
}

View file

@ -64,7 +64,7 @@
if (contact) {
const LinphonePresenceModel *model = contact.friend ? linphone_friend_get_presence_model_for_uri_or_tel(contact.friend, _addressLabel.text.UTF8String) : NULL;
self.linphoneImage.hidden =
self.linphoneImage.hidden = [LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"] ||
!((model && linphone_presence_model_get_basic_status(model) == LinphonePresenceBasicStatusOpen) ||
(cfg && !linphone_proxy_config_is_phone_number(cfg,
_addressLabel.text.UTF8String) &&
@ -109,7 +109,7 @@
Contact *contact = [FastAddressBook getContactWithAddress:(addr)];
if (contact) {
self.linphoneImage.hidden = ! ((contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model_for_uri_or_tel(contact.friend, _addressLabel.text.UTF8String)) == LinphonePresenceBasicStatusOpen) || (cfg && !linphone_proxy_config_is_phone_number(cfg, _addressLabel.text.UTF8String) && [FastAddressBook isSipURIValid:_addressLabel.text]));
self.linphoneImage.hidden =[LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"] || ! ((contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model_for_uri_or_tel(contact.friend, _addressLabel.text.UTF8String)) == LinphonePresenceBasicStatusOpen) || (cfg && !linphone_proxy_config_is_phone_number(cfg, _addressLabel.text.UTF8String) && [FastAddressBook isSipURIValid:_addressLabel.text]));
}
if (addr) {