Check "phonebook-search" capability.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2020-12-18 15:07:29 +01:00
Родитель 336fdbe5d4
Коммит afc68b25ad
4 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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];
}

Просмотреть файл

@ -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];
}