diff --git a/.gitmodules b/.gitmodules index f49a12d25..93f76983a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,9 +43,6 @@ [submodule "submodules/belle-sip"] path = submodules/belle-sip url = git://git.linphone.org/belle-sip.git -[submodule "submodules/externals/antlr3"] - path = submodules/externals/antlr3 - url = git://git.linphone.org/antlr3.git [submodule "submodules/externals/opus"] path = submodules/externals/opus url = git://git.linphone.org/opus.git diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m index 8664358e4..78bc07182 100644 --- a/Classes/ChatConversationCreateTableView.m +++ b/Classes/ChatConversationCreateTableView.m @@ -16,7 +16,7 @@ @property(nonatomic, strong) NSMutableDictionary *contacts; @property(nonatomic, strong) NSDictionary *allContacts; -@property(nonatomic, strong) NSArray *sortedKeys; +@property(nonatomic, strong) NSMutableArray *contactsAddresses; @property(nonatomic, strong) NSArray *sortedAddresses; @end @@ -24,13 +24,10 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - self.allContacts = [[NSMutableDictionary alloc] initWithDictionary:LinphoneManager.instance.fastAddressBook.addressBookMap]; - self.sortedKeys = [[LinphoneManager.instance.fastAddressBook.addressBookMap allKeys] sortedArrayUsingSelector: @selector(compare:)]; self.sortedAddresses = [[LinphoneManager.instance.fastAddressBook.addressBookMap allKeys] sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { Contact* first = [_allContacts objectForKey:a]; Contact* second = [_allContacts objectForKey:b]; - if([[first.firstName lowercaseString] compare:[second.firstName lowercaseString]] == NSOrderedSame) return [[first.lastName lowercaseString] compare:[second.lastName lowercaseString]]; else @@ -43,7 +40,8 @@ } return; } - _contacts = [[NSMutableDictionary alloc] initWithCapacity:_allContacts.count]; + self.contacts = [[NSMutableDictionary alloc] initWithCapacity:_allContacts.count]; + self.contactsAddresses = [NSMutableArray array]; _contactsGroup = [[NSMutableArray alloc] init]; _allFilter = TRUE; @@ -88,16 +86,16 @@ _allContacts = [[NSDictionary alloc] initWithDictionary:LinphoneManager.instance.fastAddressBook.addressBookMap]; if (_allFilter) { - self.sortedKeys = [[LinphoneManager.instance.fastAddressBook.addressBookMap allKeys] sortedArrayUsingSelector: @selector(compare:)]; - self.sortedAddresses = [[LinphoneManager.instance.fastAddressBook.addressBookMap allKeys] sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { - Contact* first = [_allContacts objectForKey:a]; - Contact* second = [_allContacts objectForKey:b]; - - if([[first.firstName lowercaseString] compare:[second.firstName lowercaseString]] == NSOrderedSame) - return [[first.lastName lowercaseString] compare:[second.lastName lowercaseString]]; - else - return [[first.firstName lowercaseString] compare:[second.firstName lowercaseString]]; - }]; + [_contacts removeAllObjects]; + [_contactsAddresses removeAllObjects]; + for (NSString* key in _sortedAddresses){ + NSString *address = (NSString *)key; + NSString *name = [FastAddressBook displayNameForContact:[_allContacts objectForKey:key]]; + if ((filter.length == 0) || ([name.lowercaseString containsSubstring:filter.lowercaseString]) || + ([address.lowercaseString containsSubstring:filter.lowercaseString])) { + [_contacts setObject:name forKey:address] ; + [_contactsAddresses insertObject:address atIndex:[_contactsAddresses count]]; + } } else { NSMutableArray *keys = [[NSMutableArray alloc] init]; [_allContacts enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) { @@ -109,7 +107,6 @@ if (linphoneContact) [keys addObject:key]; }]; - self.sortedKeys = [keys sortedArrayUsingSelector: @selector(compare:)]; self.sortedAddresses = [keys sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { Contact* first = [_allContacts objectForKey:a]; Contact* second = [_allContacts objectForKey:b]; @@ -149,8 +146,11 @@ ms_free(uri); linphone_address_destroy(addr); } - if (nsuri.length > 0 && [_contacts valueForKey:nsuri] == nil) - [_contacts setObject:filter forKey:nsuri]; + + if (nsuri.length > 0 && [_contacts valueForKey:nsuri] == nil) { + [_contacts setObject:filter forKey:nsuri] ; + [_contactsAddresses insertObject:nsuri atIndex:[_contactsAddresses count]]; + } [self.tableView reloadData]; } @@ -162,7 +162,7 @@ } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.contacts count]; + return [self.contactsAddresses count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { diff --git a/Classes/Contact.m b/Classes/Contact.m index d7a5ad375..4974e1339 100644 --- a/Classes/Contact.m +++ b/Classes/Contact.m @@ -40,11 +40,14 @@ if (_person.instantMessageAddresses != NULL) { for (CNLabeledValue *sipAddr in _person.instantMessageAddresses) { NSString *username = sipAddr.value.username; - if (username) - [_sipAddresses addObject:username]; + NSString *service = sipAddr.value.service; + if (username && ([service isEqualToString:LinphoneManager.instance.contactSipField] || ([service isEqualToString:@"INSTANT_MESSAGING_NAME"] && [FastAddressBook isSipURI:username]))){ + [_sipAddresses addObject:username]; + } } } } + for (CNLabeledValue *email in _person.emailAddresses) { [_emails addObject:email.value]; } @@ -225,11 +228,11 @@ CNInstantMessageAddress *cNSipMsgAddr; if ([normSip containsString:@"@"]) cNSipMsgAddr = [[CNInstantMessageAddress alloc] - initWithUsername:normSip service:[normSip componentsSeparatedByString:@"@"][1]]; + initWithUsername:normSip service:@"SIP"];//service:[normSip componentsSeparatedByString:@"@"][1]]; else cNSipMsgAddr = [[CNInstantMessageAddress alloc] initWithUsername:normSip - service:normSip]; + service:@"SIP"]; CNLabeledValue *sipAddress = [CNLabeledValue labeledValueWithLabel:NULL value:cNSipMsgAddr]; NSMutableArray *> @@ -244,13 +247,13 @@ CNInstantMessageAddress *cNSipMsgAddr; if ([[FastAddressBook normalizeSipURI:normSip] containsString:@"@"]) cNSipMsgAddr = [[CNInstantMessageAddress alloc] - initWithUsername:sip - service:[[FastAddressBook normalizeSipURI:normSip] - componentsSeparatedByString:@"@"][1]]; + initWithUsername:sip service:@"SIP"]; + //service:[[FastAddressBook normalizeSipURI:normSip] + // componentsSeparatedByString:@"@"][1]]; else cNSipMsgAddr = - [[CNInstantMessageAddress alloc] initWithUsername:normSip - service:normSip]; + [[CNInstantMessageAddress alloc] initWithUsername:normSip service:@"SIP"]; + //service:normSip]; CNLabeledValue *sipAddress = [CNLabeledValue labeledValueWithLabel:NULL value:cNSipMsgAddr]; NSMutableArray *> @@ -351,12 +354,12 @@ cNSipMsgAddr = [[CNInstantMessageAddress alloc] initWithUsername:[normSip componentsSeparatedByString:@"@"][0] - service:[normSip - componentsSeparatedByString:@"@"][1]]; + service:@"SIP"]; + //service:[normSip componentsSeparatedByString:@"@"][1]]; else cNSipMsgAddr = [[CNInstantMessageAddress alloc] initWithUsername:normSip - service:normSip]; + service:@"SIP"]; CNLabeledValue *sipAddress = [CNLabeledValue labeledValueWithLabel:NULL value:cNSipMsgAddr]; diff --git a/Classes/ContactDetailsTableView.m b/Classes/ContactDetailsTableView.m index b771f340c..22cffd36c 100644 --- a/Classes/ContactDetailsTableView.m +++ b/Classes/ContactDetailsTableView.m @@ -75,12 +75,10 @@ - (void)addEntry:(UITableView *)tableview section:(NSInteger)section animated:(BOOL)animated value:(NSString *)value { bool added = FALSE; if (section == ContactSections_Number) { - if ([_contact.phones count] == - [_contact.person.phoneNumbers count]) + if ([_contact.phones count] == [_contact.person.phoneNumbers count]) added = [_contact addPhoneNumber:value]; } else if (section == ContactSections_Sip) { - if ([_contact.sipAddresses count] == - [_contact.person.instantMessageAddresses count]) + if ([_contact.sipAddresses count] == [self countSipAddressFromCNContact:_contact.person]) //[_contact.person.instantMessageAddresses count]) added = [_contact addSipAddress:value]; } else if (section == ContactSections_Email) { if ([_contact.emails count] == @@ -100,6 +98,21 @@ } } +-(NSInteger)countSipAddressFromCNContact:(CNContact*) mCNContact{ + NSInteger count = 0; + if (mCNContact.instantMessageAddresses != NULL) { + for (CNLabeledValue *sipAddr in mCNContact.instantMessageAddresses) { + NSString *username = sipAddr.value.username; + NSString *service = sipAddr.value.service; + if (username && ([service isEqualToString:LinphoneManager.instance.contactSipField] || ([service isEqualToString:@"INSTANT_MESSAGING_NAME"] && [FastAddressBook isSipURI:username]))){ + count ++; + } + } + } + return count; +} + + - (void)setContact:(Contact *)acontact { // if (acontact == _contact) // return; diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index 40f8e7b3e..e5a3eaf4b 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -24,11 +24,13 @@ #import "Utils.h" @implementation ContactsListTableView +NSArray *sortedAddresses; #pragma mark - Lifecycle Functions - (void)initContactsTableViewController { addressBookMap = [[OrderedDictionary alloc] init]; + sortedAddresses = [[NSArray alloc] init]; [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(onAddressBookUpdate:) @@ -129,16 +131,27 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { - (void)loadData { _ongoing = TRUE; - LOGI(@"Load contact list"); + LOGI(@"====>>>> Load contact list - Start"); NSString* previous = [PhoneMainView.instance getPreviousViewName]; addressBookMap = [LinphoneManager.instance getLinphoneManagerAddressBookMap]; BOOL updated = [LinphoneManager.instance getContactsUpdated]; if(([previous isEqualToString:@"ContactsDetailsView"] && updated) || updated || [addressBookMap count] == 0){ [LinphoneManager.instance setContactsUpdated:FALSE]; @synchronized(addressBookMap) { + NSDictionary *allContacts = [[NSMutableDictionary alloc] initWithDictionary:LinphoneManager.instance.fastAddressBook.addressBookMap]; + sortedAddresses = [[LinphoneManager.instance.fastAddressBook.addressBookMap allKeys] sortedArrayUsingComparator:^NSComparisonResult(id a, id b) { + Contact* first = [allContacts objectForKey:a]; + Contact* second = [allContacts objectForKey:b]; + if([[first.firstName lowercaseString] compare:[second.firstName lowercaseString]] == NSOrderedSame) + return [[first.lastName lowercaseString] compare:[second.lastName lowercaseString]]; + else + return [[first.firstName lowercaseString] compare:[second.firstName lowercaseString]]; + }]; + + + LOGI(@"====>>>> Load contact list - Start 2 !!"); //Set all contacts from ContactCell to nil - for (NSInteger j = 0; j < [self.tableView numberOfSections]; ++j) - { + for (NSInteger j = 0; j < [self.tableView numberOfSections]; ++j){ for (NSInteger i = 0; i < [self.tableView numberOfRowsInSection:j]; ++i) { [[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:j]] setContact:nil]; @@ -147,7 +160,7 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { // Reset Address book [addressBookMap removeAllObjects]; - for (NSString *addr in LinphoneManager.instance.fastAddressBook.addressBookMap) { + for (NSString *addr in sortedAddresses) { Contact *contact = nil; @synchronized(LinphoneManager.instance.fastAddressBook.addressBookMap) { contact = [LinphoneManager.instance.fastAddressBook.addressBookMap objectForKey:addr]; @@ -206,12 +219,13 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { } [LinphoneManager.instance setLinphoneManagerAddressBookMap:addressBookMap]; } + LOGI(@"====>>>> Load contact list - End"); [super loadData]; _ongoing = FALSE; } - (void)loadSearchedData { - LOGI(@"Load contact list"); + LOGI(@"Load search contact list"); @synchronized(addressBookMap) { //Set all contacts from ContactCell to nil for (NSInteger j = 0; j < [self.tableView numberOfSections]; ++j) @@ -221,14 +235,13 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { [[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:j]] setContact:nil]; } } - // Reset Address book [addressBookMap removeAllObjects]; NSMutableArray *subAr = [NSMutableArray new]; NSMutableArray *subArBegin = [NSMutableArray new]; NSMutableArray *subArContain = [NSMutableArray new]; [addressBookMap insertObject:subAr forKey:@"" selector:@selector(caseInsensitiveCompare:)]; - for (NSString *addr in LinphoneManager.instance.fastAddressBook.addressBookMap) { + for (NSString *addr in sortedAddresses) { @synchronized( LinphoneManager.instance.fastAddressBook.addressBookMap) { Contact *contact = diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index c1ab98458..30b0b2c53 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1740,7 +1740,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach device = [device stringByReplacingOccurrencesOfString:@" " withString:@"."]; linphone_core_set_user_agent(theLinphoneCore, device.UTF8String, LINPHONE_IOS_VERSION); - _contactSipField = [self lpConfigStringForKey:@"contact_im_type_value" withDefault:@"SIP"]; + _contactSipField = [self lpConfigStringForKey:@"contact_im_type_value" inSection:@"sip" withDefault:@"SIP"]; if (_fastAddressBook == nil) { _fastAddressBook = [[FastAddressBook alloc] init]; diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 800c4c58a..7378e20b6 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -145,7 +145,7 @@ CNContactFamilyNameKey, CNContactGivenNameKey, CNContactNicknameKey, CNContactPostalAddressesKey, CNContactIdentifierKey, CNInstantMessageAddressUsernameKey, CNContactInstantMessageAddressesKey, - CNInstantMessageAddressUsernameKey, CNContactImageDataKey + CNInstantMessageAddressUsernameKey, CNContactImageDataKey, CNContactOrganizationNameKey ]; CNContactFetchRequest *request = [[CNContactFetchRequest alloc] initWithKeysToFetch:keysToFetch]; diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index 1899e3b48..443c87f31 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -575,13 +575,15 @@ Contact *contact = [FastAddressBook getContactWithAddress:addr]; if (contact) { [ContactDisplay setDisplayNameLabel:label forContact:contact]; + addressLabel.text = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(addr)]; + addressLabel.hidden = FALSE; } else { label.text = [FastAddressBook displayNameForAddress:addr]; + if([LinphoneManager.instance lpConfigBoolForKey:@"display_phone_only" inSection:@"app"]) + addressLabel.hidden = TRUE; + else + addressLabel.text = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(addr)]; } - if([LinphoneManager.instance lpConfigStringForKey:@"display_phone_only" inSection:@"app"]) - addressLabel.text = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(addr)]; - else - addressLabel.hidden = TRUE; } diff --git a/README.md b/README.md index 5df3fa725..77337da66 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,20 @@ Interested in helping translate Linphone? Contribute [on Transifex](https://www. ## Report bugs and submit patchs If you want to dig through Linphone code or report a bug, please read `CONTRIBUTING.md` first. You should also read this `README` entirely ;-). - + ## How to be a beta tester ? - + Enter the Beta : - Download TestFlight from the App Store and log in it with your apple-id - - Send an email to linphone-iphone@belledonne-communications.com, with object : [Beta test - Request], where you precise your apple-id you logged in TestFlight with + - Send an email to linphone-iphone@belledonne-communications.com, with object : [Beta test - Request], where you precise your apple-id you logged in TestFlight with - You will receive an invitation code to the beta in the following days via your email associated to your apple-id - Enter the invitation code received into TestFlight - Download Linphone from TestFlight - And voilà ! TestFlight will send you a notification every time a new beta test is available. - + Send a crash report : - It is done automatically by TestFlight - + Report a bug : - Open Linphone - Go to Settings —> Advanced —> Send logs @@ -68,7 +68,10 @@ Linphone for iPhone depends on liblinphone SDK. This SDK is generated from makef ## Incorporating our SDK in your project -After the SDK has been built, add all the `.framework` files located in `liblinphone-sdk/apple-darwin/Frameworks` to your XCode project Embedded Frameworks. +After the SDK has been built, add all the `.framework` files located in `liblinphone-sdk/apple-darwin/Frameworks` to your XCode project Embedded Frameworks and linked binaries. +Make sure that your project FRAMEWORK_SEARCH_PATHS contains "$(PROJECT_DIR)/liblinphone-sdk/apple-darwin/Frameworks" +Make sure that your project HEADER_SEARCH_PATHS contains "$(SRCROOT)/liblinphone-sdk/apple-darwin/include" +Make sure that your project LD_RUNPATH_SEARCH_PATHS contains "$(inherited) @executable_path/Frameworks"; Add a Run Script step to your build steps, put it after your step to embed frameworks, set it to use our `deploy.sh` script located in `liblinphone-sdk/apple-darwin/Tools`. ## Licensing: GPL third parties versus non GPL third parties diff --git a/cmake_builder/CMakeLists.txt b/cmake_builder/CMakeLists.txt new file mode 100644 index 000000000..f226cc583 --- /dev/null +++ b/cmake_builder/CMakeLists.txt @@ -0,0 +1,24 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2017-2018 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ + +lcb_blacklist_dependencies("libxsd" "soci") # linphone do not need them for the moment + diff --git a/prepare.py b/prepare.py index 2fd3ebe44..6e42edf25 100755 --- a/prepare.py +++ b/prepare.py @@ -49,7 +49,11 @@ class IOSTarget(prepare.Target): self.config_file = 'configs/config-ios-' + arch + '.cmake' self.toolchain_file = 'toolchains/toolchain-ios-' + arch + '.cmake' self.output = 'liblinphone-sdk/' + arch + '-apple-darwin.ios' - self.external_source_path = os.path.join(current_path, 'submodules') + self.external_source_path = os.path.join(current_path, 'submodules') + external_builders_path = os.path.join(current_path, 'cmake_builder') + self.additional_args = [ + "-DLINPHONE_BUILDER_EXTERNAL_BUILDERS_PATH=" + external_builders_path + ] class IOSi386Target(IOSTarget): diff --git a/submodules/bctoolbox b/submodules/bctoolbox index d867082bb..e34db6796 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit d867082bb0ebe240c4e2d4e8bdb309b1a9eace75 +Subproject commit e34db6796ade971615d4b572bda87d9f699ea497 diff --git a/submodules/belle-sip b/submodules/belle-sip index 68f164801..fcc83e64c 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 68f1648017dde65edc8cd8054016fa3486a2955b +Subproject commit fcc83e64cba4a1900da405729389dd4708c92867 diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 5bbb321ae..e2fe49c93 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 5bbb321ae4cf522086220efd54bff31f8742f1d1 +Subproject commit e2fe49c934beb86505391bc39189e1d5cc8e2b8b diff --git a/submodules/linphone b/submodules/linphone index 8cd317c30..6cc3fb27d 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 8cd317c30a3410a16c1c964624b35d0a5e52b0b5 +Subproject commit 6cc3fb27dba032b7519a195795c0eb26b8945345 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index c72fb8e79..e20c2ed9a 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit c72fb8e7994f1ccb61f89d77fdc9425df53a4033 +Subproject commit e20c2ed9a7397e5d6cc9ed4cbf3539761ae35111