From 5523ddf0f1379aeec5a9270d10978fc599455a72 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Thu, 4 May 2023 17:27:17 +0200 Subject: [PATCH] Read_only_native_address_book condition (Config RC) --- Classes/Base.lproj/ContactsListView.xib | 5 +++-- Classes/ContactsListView.h | 1 + Classes/ContactsListView.m | 11 ++++++++++- Resources/linphonerc | 5 +++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Classes/Base.lproj/ContactsListView.xib b/Classes/Base.lproj/ContactsListView.xib index a847387dc..ac7f39865 100644 --- a/Classes/Base.lproj/ContactsListView.xib +++ b/Classes/Base.lproj/ContactsListView.xib @@ -1,9 +1,9 @@ - + - + @@ -12,6 +12,7 @@ + diff --git a/Classes/ContactsListView.h b/Classes/ContactsListView.h index bdf6c424b..999d74e7f 100644 --- a/Classes/ContactsListView.h +++ b/Classes/ContactsListView.h @@ -53,6 +53,7 @@ typedef enum _ContactSelectionMode { ContactSelectionModeNone, ContactSelectionM @property(nonatomic, strong) IBOutlet UIButton *allButton; @property(nonatomic, strong) IBOutlet UIButton *linphoneButton; @property(nonatomic, strong) IBOutlet UIButton *addButton; +@property(nonatomic, strong) IBOutlet UIButton *deleteButton; @property(strong, nonatomic) IBOutlet UISearchBar *searchBar; @property(weak, nonatomic) IBOutlet UIImageView *selectedButtonImage; @property (weak, nonatomic) IBOutlet UIInterfaceStyleButton *toggleSelectionButton; diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 2b791f148..18f6b6c35 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -60,6 +60,7 @@ static BOOL addAddressFromOthers = FALSE; @synthesize allButton; @synthesize linphoneButton; @synthesize addButton; +@synthesize deleteButton; @synthesize topBar; typedef enum { ContactsAll, ContactsLinphone, ContactsMAX } ContactsCategory; @@ -237,7 +238,11 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)refreshButtons { - [addButton setHidden:![LinphoneManager.instance lpConfigBoolForKey:@"enable_native_address_book"]]; + [addButton setHidden:![LinphoneManager.instance lpConfigBoolForKey:@"enable_native_address_book"] || [LinphoneManager.instance lpConfigBoolForKey:@"read_only_native_address_book"]]; + if ([LinphoneManager.instance lpConfigBoolForKey:@"read_only_native_address_book"]) { + addButton.hidden = true; + deleteButton.hidden = true; + } [self changeView:[ContactSelection getSipFilterEnabled] ? ContactsLinphone : ContactsAll]; } @@ -287,6 +292,10 @@ static UICompositeViewDescription *compositeDescription = nil; if ([LinphoneManager.instance lpConfigBoolForKey:@"enable_native_address_book"]) { addButton.hidden = self.tableController.isEditing; } + if ([LinphoneManager.instance lpConfigBoolForKey:@"read_only_native_address_book"]) { + addButton.hidden = true; + deleteButton.hidden = true; + } } - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { diff --git a/Resources/linphonerc b/Resources/linphonerc index a4abe944d..39f857362 100644 --- a/Resources/linphonerc +++ b/Resources/linphonerc @@ -23,6 +23,11 @@ force_lime_chat_rooms=0 disable_chat_feature=0 disable_video_feature=0 +enable_native_address_book=1 +read_only_native_address_book=0 +only_show_sip_contacts_list=0 +hide_sip_contacts_list=0 + [in_app_purchase] #set to 1 if in-app purchases are to be shown in the application enabled=0