diff --git a/NextcloudTalk/NCSettingsController.h b/NextcloudTalk/NCSettingsController.h index 46123ff7..bc467360 100644 --- a/NextcloudTalk/NCSettingsController.h +++ b/NextcloudTalk/NCSettingsController.h @@ -53,6 +53,7 @@ extern NSString * const kCapabilityChatReadMarker; extern NSString * const kCapabilityStartCallFlag; extern NSString * const kCapabilityCirclesSupport; extern NSString * const kCapabilityChatReferenceId; +extern NSString * const kCapabilityPhonebookSearch; extern NSInteger const kDefaultChatMaxLength; extern NSString * const kMinimumRequiredTalkCapability; diff --git a/NextcloudTalk/NCSettingsController.m b/NextcloudTalk/NCSettingsController.m index 33eae549..27ede243 100644 --- a/NextcloudTalk/NCSettingsController.m +++ b/NextcloudTalk/NCSettingsController.m @@ -77,6 +77,7 @@ NSString * const kCapabilityChatReadMarker = @"chat-read-marker"; NSString * const kCapabilityStartCallFlag = @"start-call-flag"; NSString * const kCapabilityCirclesSupport = @"circles-support"; NSString * const kCapabilityChatReferenceId = @"chat-reference-id"; +NSString * const kCapabilityPhonebookSearch = @"phonebook-search"; NSInteger const kDefaultChatMaxLength = 1000; NSString * const kMinimumRequiredTalkCapability = kCapabilitySystemMessages; // Talk 4.0 is the minimum required version diff --git a/NextcloudTalk/NewRoomTableViewController.m b/NextcloudTalk/NewRoomTableViewController.m index 7dd726ba..b5158210 100644 --- a/NextcloudTalk/NewRoomTableViewController.m +++ b/NextcloudTalk/NewRoomTableViewController.m @@ -160,7 +160,7 @@ NSString * const NCSelectedContactForChatNotification = @"NCSelectedContactForCh self.navigationController.navigationBar.topItem.leftBarButtonItem = cancelButton; self.navigationController.navigationBar.topItem.leftBarButtonItem.accessibilityHint = NSLocalizedString(@"Cancel conversation creation", nil); - if ([[NCSettingsController sharedInstance] isContactSyncEnabled]) { + if ([[NCSettingsController sharedInstance] isContactSyncEnabled] && [[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityPhonebookSearch]) { UIBarButtonItem *moreOptionButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"more-action"] style:UIBarButtonItemStylePlain target:self @@ -189,8 +189,11 @@ NSString * const NCSelectedContactForChatNotification = @"NCSelectedContactForCh self.navigationItem.hidesSearchBarWhenScrolling = NO; } - [[NCContactsManager sharedInstance] searchInServerForAddressBookContacts:NO]; - [self getAddressBookContacts]; + if ([[NCSettingsController sharedInstance] isContactSyncEnabled] && [[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityPhonebookSearch]) { + [[NCContactsManager sharedInstance] searchInServerForAddressBookContacts:NO]; + [self getAddressBookContacts]; + } + [self getServerContacts]; } diff --git a/NextcloudTalk/SettingsViewController.m b/NextcloudTalk/SettingsViewController.m index e4ca6db9..0b14927c 100644 --- a/NextcloudTalk/SettingsViewController.m +++ b/NextcloudTalk/SettingsViewController.m @@ -180,7 +180,9 @@ typedef enum AboutSection { [options addObject:[NSNumber numberWithInt:kConfigurationSectionOptionBrowser]]; } // Contacts sync - [options addObject:[NSNumber numberWithInt:kConfigurationSectionOptionContactsSync]]; + if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityPhonebookSearch]) { + [options addObject:[NSNumber numberWithInt:kConfigurationSectionOptionContactsSync]]; + } return [NSArray arrayWithArray:options]; }