From c1fe7e39ef1e38fe9d65b01f601caade618a2b18 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 29 Nov 2017 16:46:38 +0100 Subject: [PATCH 01/35] [Assistant] upgrade parameter to hide/show button on assistantView --- Classes/AssistantView.m | 4 +++- Resources/linphonerc-factory | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 823c86255..a992fd86d 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -449,12 +449,14 @@ static UICompositeViewDescription *compositeDescription = nil; BOOL show_logo = [LinphoneManager.instance lpConfigBoolForKey:@"show_assistant_logo_in_choice_view_preference"]; BOOL show_extern = ![LinphoneManager.instance lpConfigBoolForKey:@"hide_assistant_custom_account"]; BOOL show_new = ![LinphoneManager.instance lpConfigBoolForKey:@"hide_assistant_create_account"]; - + BOOL show_fetch_remote = ![LinphoneManager.instance lpConfigBoolForKey:@"show_remote_provisioning_in_assistant"]; + if (!placement_done) { // visibility _welcomeLogoImage.hidden = !show_logo; _gotoLoginButton.hidden = !show_extern; _gotoCreateAccountButton.hidden = !show_new; + _gotoRemoteProvisioningButton.hidden = !show_fetch_remote; // placement if (show_logo && show_new && !show_extern) { diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index dfd3c1443..defda1860 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -8,6 +8,11 @@ hide_assistant_custom_account=0 #Hide in the assistant the button to create a new SIP account hide_assistant_create_account=0 +#Hide in the assistant the logo +show_assistant_logo_in_choice_view_preference=0 + +#Hide in the assistant the button to fetch a remote configuration +show_remote_provisioning_in_assistant=0 #contact_display_username_only=1 #contact_filter_on_default_domain=1 From f8a8a224c1e16a59a956acff57f054f4b0176a87 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Fri, 1 Dec 2017 11:17:05 +0100 Subject: [PATCH 02/35] [Contact filter] fix contact sip filter --- Classes/ContactsListTableView.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index a9c8b55b4..f3a86337c 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -157,7 +157,8 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { if ([ContactSelection getSipFilter] || [ContactSelection emailFilterEnabled]) { add = false; - }else if ([FastAddressBook contactHasValidSipDomain:contact]) { + } + if ([FastAddressBook contactHasValidSipDomain:contact]) { add = true; }else if (contact.friend && linphone_presence_model_get_basic_status( From 0251b6e123e17b974d8dd19a5da31fff11d0920a Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Mon, 4 Dec 2017 16:07:02 +0100 Subject: [PATCH 03/35] [Camera permission] chech camera's permission on picture button on chat + update translation ressources for new alertview --- Classes/ImagePickerView.m | 9 +++++++-- Resources/ar.lproj/Localizable.strings | Bin 60792 -> 61264 bytes Resources/de.lproj/Localizable.strings | Bin 66400 -> 66870 bytes Resources/en.lproj/Localizable.strings | Bin 63890 -> 64360 bytes Resources/fr.lproj/Localizable.strings | Bin 65962 -> 66488 bytes Resources/ja.lproj/Localizable.strings | Bin 59726 -> 60196 bytes Resources/nl.lproj/Localizable.strings | Bin 63964 -> 64434 bytes Resources/ru.lproj/Localizable.strings | Bin 63410 -> 63880 bytes Resources/zh_TW.lproj/Localizable.strings | Bin 56706 -> 57176 bytes 9 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m index 7f8fa79e8..5d9398a02 100644 --- a/Classes/ImagePickerView.m +++ b/Classes/ImagePickerView.m @@ -18,7 +18,8 @@ */ #import - +#import +#import #import "ImagePickerView.h" #import "PhoneMainView.h" @@ -226,7 +227,11 @@ static UICompositeViewDescription *compositeDescription = nil; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { [sheet addButtonWithTitle:NSLocalizedString(@"Camera", nil) block:^() { - block(UIImagePickerControllerSourceTypeCamera); + if([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] == AVAuthorizationStatusAuthorized ){ + block(UIImagePickerControllerSourceTypeCamera); + }else{ + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Camera's permission", nil) message:NSLocalizedString(@"Camera not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; + } }]; } if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { diff --git a/Resources/ar.lproj/Localizable.strings b/Resources/ar.lproj/Localizable.strings index 1296a9a45c0f14e945199347fee055618f5bdb74..d40b2d25291439b885177404bb0c3918a9b759e9 100644 GIT binary patch delta 287 zcmexyi}}Jm<_!*#fw>H+3`Goy4C)NU3j>yRl5-jyFl?p&J@)=5iCL}VH0_hAOuLx*%70|8}B-0%kl7TQ4Y_kGTT|Q7p zGLnr7U{~QcO%JFifFTEHN}?Rlpj05Y6zHiGpfM$2UMAQfKyOX9KOxQx^z`KU?c&VV U3|x}~HNz(xD6njHk~F&l0AqbSH2?qr delta 14 Wcmca`kNL+f<_!*#nrm<}>6mC;`Q7fmn&bnIRD< z2U3y9fJ6P{LWy{gd7KJBo%swU3<{I^8$`JgW;jkRd?hTMjAW7m*ftdPlhY0fiI)Oh ylLAy%0<;mN251(@J(Cx=dI13UJTc7x delta 14 Vcmdni#qywyWdob^<~uS`F90uJ25kTU diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index 2154467a9b397cc1617197233ede16f7ed315270..2003a286646494989ea90dd7391c26787f57ef3e 100644 GIT binary patch delta 208 zcmbRAnfb*x<_)tXCo4#DIIA-hGbk_=Fr+dRG2}920(r$iGM^!jK?x{s3&ctc&J2k_ zIgpA(1}y3)GiJt57LZ~Ana8OB)S1sv!k{pju}qX3VTR-6z$?Pi$w($CfNeujKe=eN uka#K3H7P)KB|sZNYJg^e+%wtnh&VIQ_Q`>E!jm0ZqJTECZJs0f?LGjxqc7+H delta 14 WcmaFyjd{{%<_)tXHy23%xDNn3>IdQg diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index 6e4d4297bdc216ef33e3ba33ec5cc6ff3d9bf499..c60bc99ce89089278dd36f28cb796a886f758b33 100644 GIT binary patch delta 236 zcmZ40%(A1MWrK$F!%+OQ-s?KL90jf=8Cc|1= zQD8_0lDP~ofx1AvGN4|NZ2n|^R&h>}L<8HyMZ8Ppky859@_z`R_BOdziqNai!-O)iua7sV<&`Qzf) z$sZ(GcwuHJFyt}hPiA~5Zl1!R1T@VSh?N)|8Ipl86>OpcLkZAK1t33>0ig?I8(iQ^M+fJlM^I4gw+{}859@_7*ZLE7;+ghfxP0$imJl0i9jAmERg}53i)aA zlLMq!Kqk~HFyt}hGn4>LNn|Jm(iuQr5zwS6p#BsFC7`%15Gye_G9&|GD#!*PzXYgC z0mw(#qX4!YziE0vJpl|kKvNQdrlbOSrD8zGrvSMnU~VSZA^8k>lLg<2GXtGI`Ju4z RWShxRKR?`xC;O}IS2Uw diff --git a/Resources/zh_TW.lproj/Localizable.strings b/Resources/zh_TW.lproj/Localizable.strings index 83afe228731bd6167ae292757022acb3c1b72d82..d7bcef89c78521f54fbd0e726d56e08ad46751a7 100644 GIT binary patch delta 254 zcmZqL&3t1Y^9Bxa?_7pdh9ZVU26cvF1_g!!FfW%O6UZwDlKBjI3`#(8TOd|qa0aTw zqki()JMohzi1B1A0CnXvlmPW4GL!=83?Q!vXj&D}^b{oX92t^4`JyyR5WWCbyn%^c!Y F#{ky Date: Tue, 5 Dec 2017 10:55:44 +0100 Subject: [PATCH 04/35] [Chat perm] add alertView on chat add picture from library if no permission --- Classes/ImagePickerView.m | 7 ++++++- Resources/ar.lproj/Localizable.strings | Bin 61264 -> 61756 bytes Resources/de.lproj/Localizable.strings | Bin 66870 -> 67364 bytes Resources/en.lproj/Localizable.strings | Bin 64360 -> 64854 bytes Resources/fr.lproj/Localizable.strings | Bin 66488 -> 67050 bytes Resources/ja.lproj/Localizable.strings | Bin 60196 -> 60690 bytes Resources/nl.lproj/Localizable.strings | Bin 64434 -> 64928 bytes Resources/ru.lproj/Localizable.strings | Bin 63880 -> 64374 bytes Resources/zh_TW.lproj/Localizable.strings | Bin 57176 -> 57670 bytes 9 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m index 5d9398a02..cacd57211 100644 --- a/Classes/ImagePickerView.m +++ b/Classes/ImagePickerView.m @@ -20,6 +20,7 @@ #import #import #import +#import #import "ImagePickerView.h" #import "PhoneMainView.h" @@ -237,7 +238,11 @@ static UICompositeViewDescription *compositeDescription = nil; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { [sheet addButtonWithTitle:NSLocalizedString(@"Photo library", nil) block:^() { - block(UIImagePickerControllerSourceTypePhotoLibrary); + if([PHPhotoLibrary authorizationStatus] == PHAuthorizationStatusAuthorized ){ + block(UIImagePickerControllerSourceTypePhotoLibrary); + }else{ + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Camera's permission", nil) message:NSLocalizedString(@"Camera not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; + } }]; } [sheet addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil]; diff --git a/Resources/ar.lproj/Localizable.strings b/Resources/ar.lproj/Localizable.strings index d40b2d25291439b885177404bb0c3918a9b759e9..51afad6ca4ecb903a4e97bd84324c2ab6ceb004d 100644 GIT binary patch delta 66 zcmca`k9p4{<_(9WCi}1iOg>Q0HQ7T_1xQOxu8=GO(mc$04Ed8U-VmQGB&7frx07lC Ot9>BDwpmKr>Q2Wy1}b$#rdP%q0x@lX<08C--znO}3LRf{X2zwgri?DllX+6i?nQEx%bq HhVLZ+o=Ft~ delta 18 acmZ3|$Fi-9Wy1}b$pTU=n@`C_y#N47Xa~Ij diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index 2003a286646494989ea90dd7391c26787f57ef3e..bf88909cfea8d92f8cdfba34ab565b1cb3741aa2 100644 GIT binary patch delta 62 zcmaFyjrrOy<_$U0oB<3O4EYQt4Ed86N~%tNRwXt0l4KE*sK1o$HwN2`P;$4Cin J-Xpc<0RZXU7z6+S delta 17 Zcmccii}}Sj<_$U0la$ytC&+%g4**f*2&(`9 diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index c60bc99ce89089278dd36f28cb796a886f758b33..1745d8bbd1040c751cac6e4573f80d2437e3ccd9 100644 GIT binary patch delta 104 zcmdnd&ho08WrLCIRdJ|eP+%wk>H_J_XW-myFH`v(07lpyJOBUy delta 18 acmaFW&9bANWrLCIo3rE_o&f+%c?b3Y diff --git a/Resources/ja.lproj/Localizable.strings b/Resources/ja.lproj/Localizable.strings index 82c5ffced0b6e453b9a5984fb40104e150f32e48..579badcd689f8716aeb02adc49b55f9fc1d61fb1 100644 GIT binary patch delta 54 zcmZ2-jd{{7<_$}vCM#62F_$ppPrfOk$`~-&QAu(#mt+xKv|Z8`BD(p4WXMGT3BwXk delta 18 acmbPqi+Ra4<_$}vCOgQnZJr@hbpZfQ-v|Q$ diff --git a/Resources/nl.lproj/Localizable.strings b/Resources/nl.lproj/Localizable.strings index 5a7f11a34541c51e194bc3548cb02b5e8c133e7d..ffeb605ee71c19c8e1d2d0d8cfd543f75117a14c 100644 GIT binary patch delta 94 zcmdn=oq54;<_+7VC;K(AF_$ppPkt?_DjC3#!H~}Y3;e^M*CjoB<3O4EYQt4Ed8EN~%si)Fd@oNU8`)v|q{=B+9D5kjYRyxnD|t J^B<|6djRht7T5p) delta 18 acmezNjk)79^M*CjlNTtkZC)UI?JfXZ4GCcY diff --git a/Resources/zh_TW.lproj/Localizable.strings b/Resources/zh_TW.lproj/Localizable.strings index d7bcef89c78521f54fbd0e726d56e08ad46751a7..f0e67aa582bcea6204c8ab1d707a4764a3aea78a 100644 GIT binary patch delta 58 zcmcbykNMak<_)(bCQm3}n;cNYGFd=eWwKY1)MN+oBB&VK Date: Tue, 5 Dec 2017 14:26:54 +0100 Subject: [PATCH 05/35] [CNContact] check duplicated contact on edition --- Classes/ContactDetailsView.m | 43 +++++++++++++--- Classes/ContactsListView.m | 3 +- Classes/Utils/FastAddressBook.m | 60 +++++++++++++++++----- Resources/ar.lproj/Localizable.strings | Bin 61756 -> 62200 bytes Resources/de.lproj/Localizable.strings | Bin 67364 -> 67810 bytes Resources/en.lproj/Localizable.strings | Bin 64854 -> 65298 bytes Resources/fr.lproj/Localizable.strings | Bin 67050 -> 67496 bytes Resources/ja.lproj/Localizable.strings | Bin 60690 -> 61134 bytes Resources/nl.lproj/Localizable.strings | Bin 64928 -> 64878 bytes Resources/ru.lproj/Localizable.strings | Bin 64374 -> 64818 bytes Resources/zh_TW.lproj/Localizable.strings | Bin 57670 -> 58114 bytes linphone.xcodeproj/project.pbxproj | 4 ++ 12 files changed, 89 insertions(+), 21 deletions(-) diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 6d704500c..70da309b1 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -473,13 +473,18 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onEditClick:(id)event { if (_tableController.isEditing) { - [self setEditing:FALSE]; - [self saveData]; - _isAdding = FALSE; - self.tmpContact = NULL; - _avatarImage.hidden = FALSE; - _deleteButton.hidden = FALSE; - _editButton.hidden = FALSE; + if(![self hasDuplicateContactOf:_contact]){ + [self setEditing:FALSE]; + [self saveData]; + _isAdding = FALSE; + self.tmpContact = NULL; + _avatarImage.hidden = FALSE; + _deleteButton.hidden = FALSE; + _editButton.hidden = FALSE; + }else{ + LOGE(@"====>>>> Duplicated Contacts detected !!!"); + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Contact error", nil) message:NSLocalizedString(@"Contact duplicate", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; + } } else { [self modifyTmpContact:_contact]; [self setEditing:TRUE]; @@ -517,6 +522,30 @@ static UICompositeViewDescription *compositeDescription = nil; } } +- (BOOL) hasDuplicateContactOf:(Contact*) contactToCheck{ + CNContactStore *store = [[CNContactStore alloc] init]; + NSArray *keysToFetch = @[ + CNContactEmailAddressesKey, CNContactPhoneNumbersKey, + CNContactInstantMessageAddressesKey, CNInstantMessageAddressUsernameKey, + CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPostalAddressesKey, + CNContactIdentifierKey, CNContactImageDataKey, CNContactNicknameKey + ]; + CNMutableContact *mCNContact = + [[store unifiedContactWithIdentifier:contactToCheck.identifier keysToFetch:keysToFetch error:nil] mutableCopy]; + if(mCNContact == NULL){ + for(NSString *address in contactToCheck.sipAddresses){ + NSString *name = [FastAddressBook normalizeSipURI:address]; + if([LinphoneManager.instance.fastAddressBook.addressBookMap objectForKey:name]){ + return TRUE; + } + } + return FALSE; + }else{ + return FALSE; + } +} + + #pragma mark - Image picker delegate - (void)imagePickerDelegateImage:(UIImage *)image info:(NSDictionary *)info { diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index ea3c5b52b..76f541dcf 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -219,8 +219,7 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onEditionChangeClick:(id)sender { - allButton.hidden = linphoneButton.hidden = _selectedButtonImage.hidden = addButton.hidden = - self.tableController.isEditing; + allButton.hidden = linphoneButton.hidden = _selectedButtonImage.hidden = addButton.hidden = self.tableController.isEditing; } - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 23a47cb51..0a97e6af7 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -293,9 +293,6 @@ return ret; } -- (BOOL)deleteContact:(Contact *)contact { - return [self deleteCNContact:contact.person]; -} - (CNContact *)getCNContactFromContact:(Contact *)acontact { NSArray *keysToFetch = @[ @@ -312,20 +309,47 @@ } - (BOOL)deleteCNContact:(CNContact *)contact { + return TRUE;//[self deleteContact:] ; +} + +- (BOOL)deleteContact:(Contact *)contact { CNSaveRequest *saveRequest = [[CNSaveRequest alloc] init]; - [saveRequest deleteContact:[contact mutableCopy]]; - @try { - BOOL success = [store executeSaveRequest:saveRequest error:nil]; - NSLog(@"Success %d", success); - if(success) - [self fetchContactsInBackGroundThread]; - } @catch (NSException *exception) { - NSLog(@"description = %@", [exception description]); - return FALSE; + NSArray *keysToFetch = @[ + CNContactEmailAddressesKey, CNContactPhoneNumbersKey, + CNContactInstantMessageAddressesKey, CNInstantMessageAddressUsernameKey, + CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPostalAddressesKey, + CNContactIdentifierKey, CNContactImageDataKey, CNContactNicknameKey + ]; + CNMutableContact *mCNContact = + [[store unifiedContactWithIdentifier:contact.identifier + keysToFetch:keysToFetch + error:nil] mutableCopy]; + if(mCNContact != nil){ + [saveRequest deleteContact:mCNContact]; + @try { + BOOL success = [store executeSaveRequest:saveRequest error:nil]; + NSLog(@"Success %d", success); + [self removeFriend:contact ]; + [LinphoneManager.instance setContactsUpdated:TRUE]; + if([contact.sipAddresses count] > 0){ + for (NSString *sip in contact.sipAddresses) { + [_addressBookMap removeObjectForKey:([FastAddressBook normalizeSipURI:sip] ?: sip)]; + } + } + if([contact.phones count] > 0){ + for (NSString *phone in contact.phones) { + [_addressBookMap removeObjectForKey:([FastAddressBook normalizeSipURI:phone] ?: phone)]; + } + } + } @catch (NSException *exception) { + NSLog(@"description = %@", [exception description]); + return FALSE; + } } return TRUE; } + - (BOOL)deleteAllContacts { NSArray *keys = @[ CNContactPhoneNumbersKey ]; NSString *containerId = store.defaultContainerIdentifier; @@ -416,4 +440,16 @@ lists = lists->next; } } + +-(void)removeFriend:(Contact*) contact{ + BOOL enabled = [LinphoneManager.instance lpConfigBoolForKey:@"use_rls_presence"]; + const MSList *lists = linphone_core_get_friends_lists(LC); + while (lists) { + linphone_friend_list_remove_friend(lists->data, contact.friend); + linphone_friend_list_enable_subscriptions(lists->data, FALSE); + linphone_friend_list_enable_subscriptions(lists->data, enabled); + linphone_friend_list_update_subscriptions(lists->data); + lists = lists->next; + } +} @end diff --git a/Resources/ar.lproj/Localizable.strings b/Resources/ar.lproj/Localizable.strings index 51afad6ca4ecb903a4e97bd84324c2ab6ceb004d..2ffe410e66e60604b92b3818c41110e27e72f48e 100644 GIT binary patch delta 214 zcmdn9FDNrX+P64Qc$QFVr51_g#xh7^WOATJZF7Q`OBCDinY!OBo6na)4@+fo7Hf)hYo+ZGl*c!4XI%BkW@+nLd$`QP@0{ zp#rG97^oOzSvlCM3?Qq7ApdWAUxShMua^LC|d;N RGqS`^POx&>++#808~{hnGW-Al delta 18 acmaDfk!49A%LWgN$pY3sn}e(-oC5$!W(TDJ diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index bf88909cfea8d92f8cdfba34ab565b1cb3741aa2..bc8499f080de76ab25880c0b02bddf61e16dfc6c 100644 GIT binary patch delta 200 zcmccii+R#N<_#=nlXLVqSQ8nN8A>K^^c7chX2@sAV<=$&i!i7&6f-C=q%x#1WCF!9 zL2{EH`lf>Ps6tdI0Od*<3K(*LvdKVQB|z0mKs~lVti<3rIsdHaI{AV{ O$7Ba{zRdw?I6|49N^7lON7hXIE!<$&kX3IayFobn>dlT$7D-;!>gV z3<^M*QicMC9EMDw`b35jhExV6pr|bnD=~yJee0aRTKRtwVqk|B%X z0Z?55P+ciQ5m-kmP_|^cBMYM_YcWu9!DRk>;(|Fq!xb2Efy#i+VMqfy$&fjIbAx5p F830NhE|vfQ delta 22 ecmZ3{&+@99WkZAIYlQ-B~ZLYD_IRgN5`U%qj diff --git a/Resources/ja.lproj/Localizable.strings b/Resources/ja.lproj/Localizable.strings index 579badcd689f8716aeb02adc49b55f9fc1d61fb1..5e589d0b5dca13413d6f933a718b52a1575a9e78 100644 GIT binary patch delta 206 zcmbPqi}~DL<_$H*lQ-zHu;($9FeEZ0Pj(cPRCH#@XMpm7qUsFA35>su~5LY$-zlLk>_r8E8%kP`wgRmn{%0F*r_Mcw5vphoJ~4ng~=` z2{x|+sJ0lW5@dQg*z61-tArr~EUo|)&jgyN0M?NL)?3U_JlXK7@MH;T5!N)IY|-TZ Uo8l)=u(X>jXC}1yhUtmp0O6lF?f?J) delta 67 zcmaF&i+RCs<_+7VCkHgMF_$ppPkt?_IytFTYO;(}5nODhlr2bX^CPJp5|b0GSSA-( PSWSLoDztf->51b2qdXf~ diff --git a/Resources/ru.lproj/Localizable.strings b/Resources/ru.lproj/Localizable.strings index 3a7d21011b7661140b81d1a92637c08227314769..d12a7ff871a2806eb474277fe69b7fa6c9d6f748 100644 GIT binary patch delta 182 zcmezNjd{~A<_$fjlMD1Xm=hV2CtnnlRCH#@XUJnHVF2=hq&h<}g91Y;LkdGCke3OP zoBYr(6{JHIqCx>ESISVpkOP!W2I?vSs#XH(u?1o!2FJ+@Z-`DV+r(#{%1{ARQ4Ev^ znOF`sF9XObVaNcBD*(kaf#xUx%}4>lBA_|N48@Zd$_r2ClNOoGGbv?rkLjzU01??P Apa1{> delta 22 ecmdn=i}~9(<_$fjlLM^nCf_p`+C0O2)=>b2tP2MK diff --git a/Resources/zh_TW.lproj/Localizable.strings b/Resources/zh_TW.lproj/Localizable.strings index f0e67aa582bcea6204c8ab1d707a4764a3aea78a..5b7ed5d288d44cbf649da9a15a4151f0c648eff7 100644 GIT binary patch delta 196 zcmX?hh`H$)^9B+9$saU0SQ8nN8A>KUTq&;T%#hEJ$56rm7GY3lC}vP#NM%T2$OMXI zg5)OKH>QI0s6tdI0Od*<3K(*LvdKVQB|z0mKs~lVti<3r`TTy-$!zoZY*QI3fGUcC z@*oq-!RBQEStSe^U~vVYcqY&s1)v!zKv)Dcrx*xzfFcEx^(7Qp(}40tllRV!pL|E( KXLEx7vyA{fVll1& delta 14 WcmZoV#(eA$^9B+9%@+)eHUR)J7zSYg diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index c0ef95cd5..ccbe50984 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ 244523B01E8266CC0037A187 /* chat_error.png in Resources */ = {isa = PBXBuildFile; fileRef = 244523AD1E8266CC0037A187 /* chat_error.png */; }; 244523B11E8266CC0037A187 /* chat_read.png in Resources */ = {isa = PBXBuildFile; fileRef = 244523AE1E8266CC0037A187 /* chat_read.png */; }; 244523BE1E8D3A6C0037A187 /* chat_unsecure.png in Resources */ = {isa = PBXBuildFile; fileRef = 244523BC1E8D3A6C0037A187 /* chat_unsecure.png */; }; + 249660951FD6A35F001D55AA /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 249660941FD6A359001D55AA /* Photos.framework */; }; 24A3459E1D95797700881A5C /* UIShopTableCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 24A3459D1D95797700881A5C /* UIShopTableCell.xib */; }; 24A345A61D95798A00881A5C /* UIShopTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 24A345A51D95798A00881A5C /* UIShopTableCell.m */; }; 24E1C7C01F9A235600D3F981 /* Contacts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 24E1C7B91F9A235500D3F981 /* Contacts.framework */; }; @@ -945,6 +946,7 @@ 244523AD1E8266CC0037A187 /* chat_error.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_error.png; sourceTree = ""; }; 244523AE1E8266CC0037A187 /* chat_read.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_read.png; sourceTree = ""; }; 244523BC1E8D3A6C0037A187 /* chat_unsecure.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chat_unsecure.png; sourceTree = ""; }; + 249660941FD6A359001D55AA /* Photos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Photos.framework; path = System/Library/Frameworks/Photos.framework; sourceTree = SDKROOT; }; 24A3459D1D95797700881A5C /* UIShopTableCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIShopTableCell.xib; sourceTree = ""; }; 24A345A51D95798A00881A5C /* UIShopTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIShopTableCell.m; sourceTree = ""; }; 24A345A71D95799900881A5C /* UIShopTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIShopTableCell.h; sourceTree = ""; }; @@ -1849,6 +1851,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 249660951FD6A35F001D55AA /* Photos.framework in Frameworks */, 24E1C7C01F9A235600D3F981 /* Contacts.framework in Frameworks */, 8C5BCED61EB3859300A9AAEF /* mediastreamer_voip.framework in Frameworks */, 8C2595DF1DEDCC8E007A6424 /* CallKit.framework in Frameworks */, @@ -2210,6 +2213,7 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + 249660941FD6A359001D55AA /* Photos.framework */, 24E1C7B91F9A235500D3F981 /* Contacts.framework */, 8C3EAA191EB8D9C300B732B6 /* linphonetester.framework */, 8C5BCEC61EB3859200A9AAEF /* bctoolbox-tester.framework */, From 8b31a2337967b9d3e589abe32d48b6d4a2fec9cf Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Tue, 5 Dec 2017 15:20:12 +0100 Subject: [PATCH 06/35] [CNContact] fix crash memory issue --- Classes/Utils/FastAddressBook.m | 5 ++--- submodules/linphone | 2 +- submodules/mediastreamer2 | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 0a97e6af7..800c4c58a 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -129,7 +129,8 @@ } - (void) fetchContactsInBackGroundThread{ - + [_addressBookMap removeAllObjects]; + _addressBookMap = [NSMutableDictionary dictionary]; CNEntityType entityType = CNEntityTypeContacts; [store requestAccessForEntityType:entityType completionHandler:^(BOOL granted, NSError *_Nullable error) { BOOL success = FALSE; @@ -204,9 +205,7 @@ }else{ // Dosomte } - } - } if (normalizedPhone) ms_free(normalizedPhone); diff --git a/submodules/linphone b/submodules/linphone index 20efb4ad4..2b3d4ae3c 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 20efb4ad41357daf700fa393dbcae9fdb3ab2730 +Subproject commit 2b3d4ae3cfaf82e286fe16d8ae0bac57d7abf1a7 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index 3f94be991..16ee1217a 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3f94be991d4d7cf1f2e869e457c1a95eb9d518a5 +Subproject commit 16ee1217a9725bcde21ee5cd375da769b0177e38 From bdcc313831e6a604aa2ea41dfeb3b1759a4fa64f Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 6 Dec 2017 09:58:39 +0100 Subject: [PATCH 07/35] [CNContact] fix filter + speedup nav + gsu --- Classes/ContactDetailsView.m | 1 + Classes/ContactsListView.m | 5 +++-- submodules/linphone | 2 +- submodules/mediastreamer2 | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 70da309b1..3366da73c 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -473,6 +473,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onEditClick:(id)event { if (_tableController.isEditing) { + [LinphoneManager.instance setContactsUpdated:TRUE]; if(![self hasDuplicateContactOf:_contact]){ [self setEditing:FALSE]; [self saveData]; diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 76f541dcf..ada962c54 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -158,7 +158,6 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)changeView:(ContactsCategory)view { CGRect frame = _selectedButtonImage.frame; if (view == ContactsAll && !allButton.selected) { - [LinphoneManager.instance setContactsUpdated:TRUE]; frame.origin.x = allButton.frame.origin.x; [ContactSelection setSipFilter:nil]; [ContactSelection enableEmailFilter:FALSE]; @@ -166,13 +165,14 @@ static UICompositeViewDescription *compositeDescription = nil; linphoneButton.selected = FALSE; [tableController loadData]; } else if (view == ContactsLinphone && !linphoneButton.selected) { - [LinphoneManager.instance setContactsUpdated:TRUE]; frame.origin.x = linphoneButton.frame.origin.x; [ContactSelection setSipFilter:LinphoneManager.instance.contactFilter]; [ContactSelection enableEmailFilter:FALSE]; linphoneButton.selected = TRUE; allButton.selected = FALSE; [tableController loadData]; + //REQUIRED TO RELOAD WITH FILTER + [LinphoneManager.instance setContactsUpdated:TRUE]; } _selectedButtonImage.frame = frame; } @@ -205,6 +205,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onDeleteClick:(id)sender { NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"Do you want to delete selected contacts?", nil)]; + [LinphoneManager.instance setContactsUpdated:TRUE]; [UIConfirmationDialog ShowWithMessage:msg cancelMessage:nil confirmMessage:nil diff --git a/submodules/linphone b/submodules/linphone index 2b3d4ae3c..20efb4ad4 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 2b3d4ae3cfaf82e286fe16d8ae0bac57d7abf1a7 +Subproject commit 20efb4ad41357daf700fa393dbcae9fdb3ab2730 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index 16ee1217a..3f94be991 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit 16ee1217a9725bcde21ee5cd375da769b0177e38 +Subproject commit 3f94be991d4d7cf1f2e869e457c1a95eb9d518a5 From 52e9e9d31c35bcceb05df6508ea3807d278d5c6f Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 6 Dec 2017 10:18:12 +0100 Subject: [PATCH 08/35] [CNContact] fix filtered list --- Classes/ContactsListView.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index ada962c54..7966f3c90 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -158,6 +158,8 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)changeView:(ContactsCategory)view { CGRect frame = _selectedButtonImage.frame; if (view == ContactsAll && !allButton.selected) { + //REQUIRED TO RELOAD WITH FILTER + [LinphoneManager.instance setContactsUpdated:TRUE]; frame.origin.x = allButton.frame.origin.x; [ContactSelection setSipFilter:nil]; [ContactSelection enableEmailFilter:FALSE]; @@ -165,14 +167,14 @@ static UICompositeViewDescription *compositeDescription = nil; linphoneButton.selected = FALSE; [tableController loadData]; } else if (view == ContactsLinphone && !linphoneButton.selected) { + //REQUIRED TO RELOAD WITH FILTER + [LinphoneManager.instance setContactsUpdated:TRUE]; frame.origin.x = linphoneButton.frame.origin.x; [ContactSelection setSipFilter:LinphoneManager.instance.contactFilter]; [ContactSelection enableEmailFilter:FALSE]; linphoneButton.selected = TRUE; allButton.selected = FALSE; [tableController loadData]; - //REQUIRED TO RELOAD WITH FILTER - [LinphoneManager.instance setContactsUpdated:TRUE]; } _selectedButtonImage.frame = frame; } From 50983e8fa5dc90dfd6d8bff5855c7d6c33f3037e Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 6 Dec 2017 11:40:35 +0100 Subject: [PATCH 09/35] [CNContact] fiix checkbox display on contactList --- Classes/ContactsListTableView.m | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m index f3a86337c..40f8e7b3e 100644 --- a/Classes/ContactsListTableView.m +++ b/Classes/ContactsListTableView.m @@ -192,10 +192,7 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { [subAr insertObject:contact atIndex:idx]; } } - //} } - [super loadData]; - // since we refresh the tableview, we must perform this on main // thread dispatch_async(dispatch_get_main_queue(), ^(void) { @@ -209,6 +206,7 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { } [LinphoneManager.instance setLinphoneManagerAddressBookMap:addressBookMap]; } + [super loadData]; _ongoing = FALSE; } @@ -406,23 +404,15 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { } UIContactCell* cell = [self.tableView cellForRowAtIndexPath:indexPath]; [cell setContact:NULL]; - [[LinphoneManager.instance fastAddressBook] - deleteContact:contact]; - [tableView - deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] - withRowAnimation:UITableViewRowAnimationFade]; - [tableView endUpdates]; + [[LinphoneManager.instance fastAddressBook] deleteContact:contact]; + [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; + [tableView endUpdates]; - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(onAddressBookUpdate:) + [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(onAddressBookUpdate:) name:kLinphoneAddressBookUpdate object:nil]; - dispatch_async(dispatch_get_main_queue(), - ^{ - [self loadData]; - }); - } + [self loadData]; + } } - (void)removeSelectionUsing:(void (^)(NSIndexPath *))remover { @@ -438,10 +428,9 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) { } UIContactCell* cell = [self.tableView cellForRowAtIndexPath:indexPath]; [cell setContact:NULL]; - [[LinphoneManager.instance fastAddressBook] deleteContact:contact]; + [[LinphoneManager.instance fastAddressBook] deleteContact:contact]; - [NSNotificationCenter.defaultCenter - addObserver:self + [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(onAddressBookUpdate:) name:kLinphoneAddressBookUpdate object:nil]; From 10faf268d91edfb271135fc3c5a22294f36fa768 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Thu, 7 Dec 2017 10:03:21 +0100 Subject: [PATCH 10/35] [Chat] fix permission for camera and photos + build version updated --- Classes/ImagePickerView.m | 12 ++++++++---- linphone-Info.plist | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m index cacd57211..584f4088a 100644 --- a/Classes/ImagePickerView.m +++ b/Classes/ImagePickerView.m @@ -229,8 +229,12 @@ static UICompositeViewDescription *compositeDescription = nil; [sheet addButtonWithTitle:NSLocalizedString(@"Camera", nil) block:^() { if([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] == AVAuthorizationStatusAuthorized ){ - block(UIImagePickerControllerSourceTypeCamera); - }else{ + if([PHPhotoLibrary authorizationStatus] != PHAuthorizationStatusDenied ){ + block(UIImagePickerControllerSourceTypeCamera); + }else{ + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Photo's permission", nil) message:NSLocalizedString(@"Photo not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; + } + }else { [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Camera's permission", nil) message:NSLocalizedString(@"Camera not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; } }]; @@ -238,10 +242,10 @@ static UICompositeViewDescription *compositeDescription = nil; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { [sheet addButtonWithTitle:NSLocalizedString(@"Photo library", nil) block:^() { - if([PHPhotoLibrary authorizationStatus] == PHAuthorizationStatusAuthorized ){ + if([PHPhotoLibrary authorizationStatus] != PHAuthorizationStatusDenied ){ block(UIImagePickerControllerSourceTypePhotoLibrary); }else{ - [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Camera's permission", nil) message:NSLocalizedString(@"Camera not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Photo's permission", nil) message:NSLocalizedString(@"Photo not authorized", nil) delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Continue", nil] show]; } }]; } diff --git a/linphone-Info.plist b/linphone-Info.plist index 53b0d6bde..67db86bf4 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -53,7 +53,7 @@ CFBundleVersion - 9 + 10 ITSAppUsesNonExemptEncryption ITSEncryptionExportComplianceCode @@ -68,6 +68,8 @@ Make calls with your friends NSMicrophoneUsageDescription Use microphone to make audio calls + NSPhotoLibraryAddUsageDescription + Add photo you shoot by yourself NSPhotoLibraryUsageDescription Share photos with your friends and customize avatars NSVoIPUsageDescription From cd3ab3aeb7fd4371a5226b12a4d941fad80214d9 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Mon, 11 Dec 2017 14:58:40 +0100 Subject: [PATCH 11/35] [PushNotif] add keep_alive on start LC to workaround push notif on chat message --- Classes/LinphoneManager.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 8d15d0a13..1c3aad959 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -595,6 +595,8 @@ static void migrateWizardToAssistant(const char *entry, void *user_data) { reason:@"Linphone core not initialized yet" userInfo:nil]); } + //Force keep alive to workaround push notif on chat message + linphone_core_enable_keep_alive(theLinphoneCore, true); return theLinphoneCore; } From 25ae4525d709554a615497674208ae1539e3da15 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Tue, 12 Dec 2017 14:39:02 +0100 Subject: [PATCH 12/35] [Exception fix] fix exception on getLC from obrserver not remove --- Classes/PhoneMainView.m | 1 + .../InAppSettingsKit/Controllers/IASKAppSettingsViewController.m | 1 + 2 files changed, 2 insertions(+) diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 7a54ed38a..42e992a8b 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -202,6 +202,7 @@ static RootViewManager *rootViewManagerInstance = nil; - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [NSNotificationCenter.defaultCenter removeObserver:self]; + [NSNotificationCenter.defaultCenter removeObserver:self name:UIDeviceBatteryLevelDidChangeNotification object:nil]; [[UIDevice currentDevice] setBatteryMonitoringEnabled:NO]; } diff --git a/Classes/Utils/InAppSettingsKit/Controllers/IASKAppSettingsViewController.m b/Classes/Utils/InAppSettingsKit/Controllers/IASKAppSettingsViewController.m index 9fe942583..ec99769a9 100755 --- a/Classes/Utils/InAppSettingsKit/Controllers/IASKAppSettingsViewController.m +++ b/Classes/Utils/InAppSettingsKit/Controllers/IASKAppSettingsViewController.m @@ -234,6 +234,7 @@ CGRect IASKCGRectSwap(CGRect rect); - (void)viewDidDisappear:(BOOL)animated { [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillTerminateNotification object:[UIApplication sharedApplication]]; // hide the keyboard [self.currentFirstResponder resignFirstResponder]; From 38833faa318d01a15d7e3a96f6a5c215825843e4 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 15 Dec 2017 08:26:33 +0100 Subject: [PATCH 13/35] add tcp keepalive value in factory file --- Classes/LinphoneManager.m | 5 +++-- Resources/linphonerc-factory | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 1c3aad959..c4c794a2a 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -595,8 +595,6 @@ static void migrateWizardToAssistant(const char *entry, void *user_data) { reason:@"Linphone core not initialized yet" userInfo:nil]); } - //Force keep alive to workaround push notif on chat message - linphone_core_enable_keep_alive(theLinphoneCore, true); return theLinphoneCore; } @@ -1874,6 +1872,9 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach /** Should be called once per linphone_core_new() */ - (void)finishCoreConfiguration { + + //Force keep alive to workaround push notif on chat message + linphone_core_enable_keep_alive(theLinphoneCore, true); // get default config from bundle NSString *zrtpSecretsFileName = [LinphoneManager documentFile:@"zrtp_secrets"]; diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index defda1860..8d18bfd62 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -35,6 +35,8 @@ sip_random_port=0 #whether SIP passwords must be encrypted in configuration storage file store_ha1_passwd=0 deliver_imdn=1 +#to avoid app to not detect broken sockets when in long running task. +tcp_tls_keepalive=30000 [misc] #by default it is set to 30 by liblinphone From 2e3b4b7501b5133d6fba8a2e9e2d5e7bfc24356a Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 15 Dec 2017 10:59:43 +0100 Subject: [PATCH 14/35] remove unecesasry inmport --- Classes/ContactsListView.h | 1 - Classes/ContactsListView.m | 1 - Classes/LinphoneAppDelegate.h | 1 - Classes/LinphoneAppDelegate.m | 1 - 4 files changed, 4 deletions(-) diff --git a/Classes/ContactsListView.h b/Classes/ContactsListView.h index 9a14b6d56..a2d8fa54e 100644 --- a/Classes/ContactsListView.h +++ b/Classes/ContactsListView.h @@ -18,7 +18,6 @@ */ #import -#import #import "UICompositeView.h" #import "ContactsListTableView.h" diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 7966f3c90..41315fd42 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -18,7 +18,6 @@ */ #import "PhoneMainView.h" -#import @implementation ContactSelection diff --git a/Classes/LinphoneAppDelegate.h b/Classes/LinphoneAppDelegate.h index 5a72874fb..cb293eae3 100644 --- a/Classes/LinphoneAppDelegate.h +++ b/Classes/LinphoneAppDelegate.h @@ -19,7 +19,6 @@ #import #import -#import #import "LinphoneCoreSettingsStore.h" #import "ProviderDelegate.h" diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 7f0d024a0..dbae90a62 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -18,7 +18,6 @@ */ #import "LinphoneAppDelegate.h" -#import "AddressBook/ABPerson.h" #import "ContactDetailsView.h" #import "ContactsListView.h" #import "PhoneMainView.h" From c15c6648bc8e6c608e799bb876a92ee7accdc177 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 18 Dec 2017 15:39:42 +0100 Subject: [PATCH 15/35] avoid app to be suspended before being able to start long running task --- Classes/LinphoneAppDelegate.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index dbae90a62..1e373ac96 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -620,9 +620,8 @@ didInvalidatePushTokenForType:(NSString *)type { [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories]; } [LinphoneManager.instance setupNetworkReachabilityCallback]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self processRemoteNotification:payload.dictionaryPayload]; - }); + //to avoid IOS to suspend the app before being able to launch long running task + [self processRemoteNotification:payload.dictionaryPayload]; } - (void)pushRegistry:(PKPushRegistry *)registry From 506e3b54f9430fddda4282c5f3b53f59df2fda3c Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 20 Dec 2017 14:32:45 +0100 Subject: [PATCH 16/35] [IphoneX] Status Bar heigth management for iphone X --- Classes/Base.lproj/PhoneMainView.xib | 27 +++++---- .../LinphoneUI/Base.lproj/UICompositeView.xib | 55 ++++++++++--------- Classes/LinphoneUI/UICompositeView.m | 5 +- Classes/MainStoryboard.storyboard | 24 ++++---- linphone.xcodeproj/project.pbxproj | 4 ++ 5 files changed, 62 insertions(+), 53 deletions(-) diff --git a/Classes/Base.lproj/PhoneMainView.xib b/Classes/Base.lproj/PhoneMainView.xib index 13d8cc75c..ac7090844 100644 --- a/Classes/Base.lproj/PhoneMainView.xib +++ b/Classes/Base.lproj/PhoneMainView.xib @@ -1,8 +1,12 @@ - - + + + + + - + + @@ -24,23 +28,18 @@ - - + - - + + - - + - - + - - - + diff --git a/Classes/LinphoneUI/Base.lproj/UICompositeView.xib b/Classes/LinphoneUI/Base.lproj/UICompositeView.xib index 20bf9702e..093c2cb44 100644 --- a/Classes/LinphoneUI/Base.lproj/UICompositeView.xib +++ b/Classes/LinphoneUI/Base.lproj/UICompositeView.xib @@ -1,9 +1,13 @@ - - + + + + + - - + + + @@ -23,73 +27,72 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + diff --git a/Classes/LinphoneUI/UICompositeView.m b/Classes/LinphoneUI/UICompositeView.m index a48be7d61..716623fd1 100644 --- a/Classes/LinphoneUI/UICompositeView.m +++ b/Classes/LinphoneUI/UICompositeView.m @@ -387,7 +387,9 @@ return UIInterfaceOrientationPortrait; } -#define IPHONE_STATUSBAR_HEIGHT 20 +#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) +#define IS_IPHONE_X (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 812.0) +#define IPHONE_STATUSBAR_HEIGHT (IS_IPHONE_X ? 35 : 20) - (void)update:(UICompositeViewDescription *)description tabBar:(NSNumber *)tabBar @@ -571,6 +573,7 @@ // Compute frame for each elements CGRect viewFrame = self.view.frame; int origin = currentViewDescription.fullscreen ? 0 : IPHONE_STATUSBAR_HEIGHT; + // 1. status bar - fixed size on top CGRect statusBarFrame = self.statusBarView.frame; diff --git a/Classes/MainStoryboard.storyboard b/Classes/MainStoryboard.storyboard index d720f290a..c153f01fd 100644 --- a/Classes/MainStoryboard.storyboard +++ b/Classes/MainStoryboard.storyboard @@ -1,7 +1,12 @@ - - + + + + + - + + + @@ -15,15 +20,15 @@ - + - - + + - + @@ -39,9 +44,4 @@ - - - - - diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index ccbe50984..e427bb881 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -4516,6 +4516,7 @@ "$(SRCROOT)/Classes/Utils/XMLRPC/", ); INFOPLIST_FILE = "linphone-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)"; LINK_WITH_STANDARD_LIBRARIES = YES; @@ -4614,6 +4615,7 @@ "$(SRCROOT)/Classes/Utils/XMLRPC/", ); INFOPLIST_FILE = "linphone-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)"; LINK_WITH_STANDARD_LIBRARIES = YES; @@ -4712,6 +4714,7 @@ "$(SRCROOT)/Classes/Utils/XMLRPC/", ); INFOPLIST_FILE = "linphone-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)"; LINK_WITH_STANDARD_LIBRARIES = YES; @@ -4810,6 +4813,7 @@ "$(SRCROOT)/Classes/Utils/XMLRPC/", ); INFOPLIST_FILE = "linphone-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)"; LINK_WITH_STANDARD_LIBRARIES = YES; From 6491cce43c5c840940bcd30cbaca7cd3fe9b2e22 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 20 Dec 2017 15:35:08 +0100 Subject: [PATCH 17/35] [IphoneX] set HomeIndicator auto Hidden when not used --- Classes/PhoneMainView.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 42e992a8b..0f67e692f 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -206,8 +206,25 @@ static RootViewManager *rootViewManagerInstance = nil; [[UIDevice currentDevice] setBatteryMonitoringEnabled:NO]; } +/* IPHONE X specific : hide the HomeIndcator when not used */ +#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) +#define IS_IPHONE_X (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 812.0) +#define IPHONE_STATUSBAR_HEIGHT (IS_IPHONE_X ? 35 : 20) + - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; + if(IS_IPHONE_X){ + if(@available(iOS 11.0, *)) { + [self childViewControllerForHomeIndicatorAutoHidden]; + [self prefersHomeIndicatorAutoHidden]; + [self setNeedsUpdateOfHomeIndicatorAutoHidden]; + } + } + +} + +- (BOOL)prefersHomeIndicatorAutoHidden{ + return YES; } - (void)setVolumeHidden:(BOOL)hidden { From a1531bac766c42da1ded70677a28d4ddb4cf1a14 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Wed, 20 Dec 2017 15:54:44 +0100 Subject: [PATCH 18/35] [ProximitySensor] update proximitySensor management to fix specific case --- Classes/LinphoneManager.m | 1 + Classes/LinphoneUI/UIVideoButton.m | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index c4c794a2a..37509cc35 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -989,6 +989,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char if (state == LinphoneCallConnected && !mCallCenter) { /*only register CT call center CB for connected call*/ [self setupGSMInteraction]; + [self setSpeakerEnabled:FALSE]; } // Post event diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m index accf67675..6b1b36ea7 100644 --- a/Classes/LinphoneUI/UIVideoButton.m +++ b/Classes/LinphoneUI/UIVideoButton.m @@ -58,7 +58,7 @@ INIT_WITH_COMMON_CF { if (!linphone_core_video_display_enabled(LC)) return; - + [LinphoneManager.instance setSpeakerEnabled:FALSE]; [self setEnabled:FALSE]; [waitView startAnimating]; From 707ea1c6799a754116fc85995002ebc70d59eaa6 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Thu, 21 Dec 2017 14:03:02 +0100 Subject: [PATCH 19/35] [ProximitySensor] update algo --- Classes/CallView.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Classes/CallView.m b/Classes/CallView.m index 6a7914795..30f53101e 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -179,8 +179,9 @@ static UICompositeViewDescription *compositeDescription = nil; [super viewDidAppear:animated]; [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; - UIDevice.currentDevice.proximityMonitoringEnabled = !_speakerButton.enabled; - + //UIDevice.currentDevice.proximityMonitoringEnabled = !_speakerButton.enabled; + [[UIDevice currentDevice] setProximityMonitoringEnabled:TRUE]; + [PhoneMainView.instance setVolumeHidden:TRUE]; hiddenVolume = TRUE; @@ -192,7 +193,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - +[[UIDevice currentDevice] setProximityMonitoringEnabled:FALSE]; [self disableVideoDisplay:TRUE animated:NO]; if (hideControlsTimer != nil) { From 76165e82daee8b8c0b7f0488b05ba6a445ac64dc Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Thu, 21 Dec 2017 14:22:15 +0100 Subject: [PATCH 20/35] [IphoneX] update temporary VideoCallUI for iphoneX --- Classes/CallView.m | 4 +++- Classes/PhoneMainView.h | 2 ++ Classes/PhoneMainView.m | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Classes/CallView.m b/Classes/CallView.m index 30f53101e..f67ce1c92 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -358,7 +358,9 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { hideControlsTimer = nil; } - [PhoneMainView.instance fullScreen:!disabled]; + if(![PhoneMainView.instance isIphoneXDevice]){ + [PhoneMainView.instance fullScreen:!disabled]; + } [PhoneMainView.instance hideTabBar:!disabled]; if (!disabled) { diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index 3ac43c52a..4d3ad4783 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -106,4 +106,6 @@ - (void)updateApplicationBadgeNumber; + (PhoneMainView*) instance; +- (BOOL)isIphoneXDevice; + @end diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 0f67e692f..52beba1ed 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -211,9 +211,13 @@ static RootViewManager *rootViewManagerInstance = nil; #define IS_IPHONE_X (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 812.0) #define IPHONE_STATUSBAR_HEIGHT (IS_IPHONE_X ? 35 : 20) +- (BOOL)isIphoneXDevice{ + return IS_IPHONE_X; +} + - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - if(IS_IPHONE_X){ + if([self isIphoneXDevice]){ if(@available(iOS 11.0, *)) { [self childViewControllerForHomeIndicatorAutoHidden]; [self prefersHomeIndicatorAutoHidden]; From 0fe825571946cfb1c1167c27f2781f49e6bcf52c Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Thu, 21 Dec 2017 14:26:24 +0100 Subject: [PATCH 21/35] [ProximitySensor] clean source code --- Classes/CallView.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Classes/CallView.m b/Classes/CallView.m index f67ce1c92..4f416edb4 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -179,7 +179,6 @@ static UICompositeViewDescription *compositeDescription = nil; [super viewDidAppear:animated]; [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; - //UIDevice.currentDevice.proximityMonitoringEnabled = !_speakerButton.enabled; [[UIDevice currentDevice] setProximityMonitoringEnabled:TRUE]; [PhoneMainView.instance setVolumeHidden:TRUE]; @@ -220,7 +219,7 @@ static UICompositeViewDescription *compositeDescription = nil; [super viewDidDisappear:animated]; [[UIApplication sharedApplication] setIdleTimerDisabled:false]; - UIDevice.currentDevice.proximityMonitoringEnabled = NO; + [[UIDevice currentDevice] setProximityMonitoringEnabled:FALSE]; [PhoneMainView.instance fullScreen:false]; // Disable tap From 5881c68a47ff545b861a6d955ea0e5092b1d951f Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Fri, 22 Dec 2017 14:23:53 +0100 Subject: [PATCH 22/35] [GSU] git submodules updated [Switch submodule branch] --- Classes/ContactsListView.m | 1 + submodules/bctoolbox | 2 +- submodules/bcunit | 2 +- submodules/belcard | 2 +- submodules/belle-sip | 2 +- submodules/belr | 2 +- submodules/bzrtp | 2 +- submodules/cmake-builder | 2 +- submodules/mediastreamer2 | 2 +- submodules/mscodec2 | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 41315fd42..65e255cda 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -227,6 +227,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { searchBar.text = @""; [self searchBar:searchBar textDidChange:@""]; + [LinphoneManager.instance setContactsUpdated:TRUE]; [tableController loadData]; [searchBar resignFirstResponder]; } diff --git a/submodules/bctoolbox b/submodules/bctoolbox index ebc8b893e..86566bc39 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit ebc8b893e4aab92ff6ee49674d7c443045494a6c +Subproject commit 86566bc39e8860a34620f05895da9aea8ee57b82 diff --git a/submodules/bcunit b/submodules/bcunit index cf1aaa36c..d8d2f4b40 160000 --- a/submodules/bcunit +++ b/submodules/bcunit @@ -1 +1 @@ -Subproject commit cf1aaa36c5738c25e59c8fafbade388a0081cd53 +Subproject commit d8d2f4b40209e06b400f893cce58e4c6ba73341d diff --git a/submodules/belcard b/submodules/belcard index 7524da1a0..b9e1951be 160000 --- a/submodules/belcard +++ b/submodules/belcard @@ -1 +1 @@ -Subproject commit 7524da1a0548af6ee11ea910858af322161207c4 +Subproject commit b9e1951be4575c62e326d761a7f7c79c5cce9cb9 diff --git a/submodules/belle-sip b/submodules/belle-sip index 0b074bd60..d8c5e9e08 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 0b074bd601fd97ee3977faf61c438eeb806b3a41 +Subproject commit d8c5e9e08b3bd6640898e46850333f1ad900c8d2 diff --git a/submodules/belr b/submodules/belr index fdce52526..9364d69fb 160000 --- a/submodules/belr +++ b/submodules/belr @@ -1 +1 @@ -Subproject commit fdce52526089e88c98f19b0d36483cc3d31ef9bd +Subproject commit 9364d69fb16b058066a129f993558d764a6836cf diff --git a/submodules/bzrtp b/submodules/bzrtp index 49a0bb2c0..37adaa053 160000 --- a/submodules/bzrtp +++ b/submodules/bzrtp @@ -1 +1 @@ -Subproject commit 49a0bb2c0237237fc1b4213918dc9032817b25f1 +Subproject commit 37adaa0536432149a51332d8eb04973a3ba6bac9 diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 1e93fee2d..ed5a622a9 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 1e93fee2d0f72adb4e5a0b1ffeb422b84ab64618 +Subproject commit ed5a622a91da4014b18470e2ef4fcfc5d482dc36 diff --git a/submodules/mediastreamer2 b/submodules/mediastreamer2 index 3f94be991..927dda741 160000 --- a/submodules/mediastreamer2 +++ b/submodules/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3f94be991d4d7cf1f2e869e457c1a95eb9d518a5 +Subproject commit 927dda7418fef78d92e1c3da18854841de9da605 diff --git a/submodules/mscodec2 b/submodules/mscodec2 index 9e2397607..789c8a4ad 160000 --- a/submodules/mscodec2 +++ b/submodules/mscodec2 @@ -1 +1 @@ -Subproject commit 9e2397607933104f9361869ff9e309fbb99adaeb +Subproject commit 789c8a4adf83d719b0dc1ea58c7b77fefe39f5ac From 50a673a81fb70274837d53d7dba395ea11a9bbcb Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Fri, 22 Dec 2017 14:54:32 +0100 Subject: [PATCH 23/35] [Contacts] update list on search cancel icon click + build version updated [Switch submodule branch] [--force] --- Classes/ContactsListView.m | 1 + linphone-Info.plist | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 65e255cda..56dc3399e 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -245,6 +245,7 @@ static UICompositeViewDescription *compositeDescription = nil; // searchBar.text = [searchText uppercaseString]; [ContactSelection setNameOrEmailFilter:searchText]; if (searchText.length == 0) { + [LinphoneManager.instance setContactsUpdated:TRUE]; [tableController loadData]; } else { [tableController loadSearchedData]; diff --git a/linphone-Info.plist b/linphone-Info.plist index 67db86bf4..5829898a7 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -53,7 +53,7 @@ CFBundleVersion - 10 + 11 ITSAppUsesNonExemptEncryption ITSEncryptionExportComplianceCode From 5ceafb9590fef7792af70bff0ff61fbabc3479bd Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 28 Dec 2017 10:54:31 +0100 Subject: [PATCH 24/35] fix build --- submodules/mscodec2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/mscodec2 b/submodules/mscodec2 index 789c8a4ad..9e2397607 160000 --- a/submodules/mscodec2 +++ b/submodules/mscodec2 @@ -1 +1 @@ -Subproject commit 789c8a4adf83d719b0dc1ea58c7b77fefe39f5ac +Subproject commit 9e2397607933104f9361869ff9e309fbb99adaeb From bd12d899eab94021f7255058903340e313e5d4c5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 28 Dec 2017 17:34:55 +0100 Subject: [PATCH 25/35] Fix crash after setting turn username and password. --- Classes/LinphoneCoreSettingsStore.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 3d4659bc6..baa3c7f3c 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -808,14 +808,14 @@ if ([turn_username length] > 0) { const LinphoneAuthInfo *turnAuthInfo = nil; - if ([turn_password length] > 0) + if ([turn_password length] > 0){ turnAuthInfo = linphone_auth_info_new([turn_username UTF8String], NULL, [turn_password UTF8String], NULL, NULL, NULL); - else - turnAuthInfo = linphone_core_find_auth_info(LC, NULL, [turn_username UTF8String], NULL); - if (turnAuthInfo != NULL) linphone_core_add_auth_info(LC, turnAuthInfo); - linphone_nat_policy_set_stun_server_username(LNP, linphone_auth_info_get_username(turnAuthInfo)); + }else{ + turnAuthInfo = linphone_core_find_auth_info(LC, NULL, [turn_username UTF8String], NULL); + } + linphone_nat_policy_set_stun_server_username(LNP, [turn_username UTF8String]); } } else { linphone_nat_policy_enable_stun(LNP, FALSE); From a82de0f631ca4d1d1fb49f43156c9b4dd7fc94a5 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 2 Jan 2018 10:44:35 +0100 Subject: [PATCH 26/35] do not set notification category on every push received --- Classes/LinphoneAppDelegate.m | 148 +++++++++------------------------- Classes/LinphoneManager.m | 26 ------ 2 files changed, 38 insertions(+), 136 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 1e373ac96..827a5c3cc 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -76,7 +76,7 @@ - (void)applicationDidBecomeActive:(UIApplication *)application { LOGI(@"%@", NSStringFromSelector(_cmd)); - + [self registerForNotifications:[UIApplication sharedApplication]]; if (startedInBackground) { startedInBackground = FALSE; [PhoneMainView.instance startUp]; @@ -229,47 +229,46 @@ if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { // Call category UNNotificationAction *act_ans = - [UNNotificationAction actionWithIdentifier:@"Answer" - title:NSLocalizedString(@"Answer", nil) - options:UNNotificationActionOptionForeground]; + [UNNotificationAction actionWithIdentifier:@"Answer" + title:NSLocalizedString(@"Answer", nil) + options:UNNotificationActionOptionForeground]; UNNotificationAction *act_dec = [UNNotificationAction actionWithIdentifier:@"Decline" title:NSLocalizedString(@"Decline", nil) options:UNNotificationActionOptionNone]; UNNotificationCategory *cat_call = - [UNNotificationCategory categoryWithIdentifier:@"call_cat" - actions:[NSArray arrayWithObjects:act_ans, act_dec, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; - + [UNNotificationCategory categoryWithIdentifier:@"call_cat" + actions:[NSArray arrayWithObjects:act_ans, act_dec, nil] + intentIdentifiers:[[NSMutableArray alloc] init] + options:UNNotificationCategoryOptionCustomDismissAction]; // Msg category UNTextInputNotificationAction *act_reply = - [UNTextInputNotificationAction actionWithIdentifier:@"Reply" - title:NSLocalizedString(@"Reply", nil) - options:UNNotificationActionOptionNone]; + [UNTextInputNotificationAction actionWithIdentifier:@"Reply" + title:NSLocalizedString(@"Reply", nil) + options:UNNotificationActionOptionNone]; UNNotificationAction *act_seen = - [UNNotificationAction actionWithIdentifier:@"Seen" - title:NSLocalizedString(@"Mark as seen", nil) - options:UNNotificationActionOptionNone]; + [UNNotificationAction actionWithIdentifier:@"Seen" + title:NSLocalizedString(@"Mark as seen", nil) + options:UNNotificationActionOptionNone]; UNNotificationCategory *cat_msg = - [UNNotificationCategory categoryWithIdentifier:@"msg_cat" - actions:[NSArray arrayWithObjects:act_reply, act_seen, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; + [UNNotificationCategory categoryWithIdentifier:@"msg_cat" + actions:[NSArray arrayWithObjects:act_reply, act_seen, nil] + intentIdentifiers:[[NSMutableArray alloc] init] + options:UNNotificationCategoryOptionCustomDismissAction]; // Video Request Category UNNotificationAction *act_accept = - [UNNotificationAction actionWithIdentifier:@"Accept" - title:NSLocalizedString(@"Accept", nil) - options:UNNotificationActionOptionForeground]; + [UNNotificationAction actionWithIdentifier:@"Accept" + title:NSLocalizedString(@"Accept", nil) + options:UNNotificationActionOptionForeground]; UNNotificationAction *act_refuse = [UNNotificationAction actionWithIdentifier:@"Cancel" title:NSLocalizedString(@"Cancel", nil) options:UNNotificationActionOptionNone]; UNNotificationCategory *video_call = - [UNNotificationCategory categoryWithIdentifier:@"video_request" - actions:[NSArray arrayWithObjects:act_accept, act_refuse, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; + [UNNotificationCategory categoryWithIdentifier:@"video_request" + actions:[NSArray arrayWithObjects:act_accept, act_refuse, nil] + intentIdentifiers:[[NSMutableArray alloc] init] + options:UNNotificationCategoryOptionCustomDismissAction]; // ZRTP verification category UNNotificationAction *act_confirm = [UNNotificationAction actionWithIdentifier:@"Confirm" @@ -280,20 +279,21 @@ title:NSLocalizedString(@"Deny", nil) options:UNNotificationActionOptionNone]; UNNotificationCategory *cat_zrtp = - [UNNotificationCategory categoryWithIdentifier:@"zrtp_request" - actions:[NSArray arrayWithObjects:act_confirm, act_deny, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; + [UNNotificationCategory categoryWithIdentifier:@"zrtp_request" + actions:[NSArray arrayWithObjects:act_confirm, act_deny, nil] + intentIdentifiers:[[NSMutableArray alloc] init] + options:UNNotificationCategoryOptionCustomDismissAction]; + [UNUserNotificationCenter currentNotificationCenter].delegate = self; [[UNUserNotificationCenter currentNotificationCenter] - requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | - UNAuthorizationOptionBadge) - completionHandler:^(BOOL granted, NSError *_Nullable error) { - // Enable or disable features based on authorization. - if (error) { - LOGD(error.description); - } - }]; + requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | + UNAuthorizationOptionBadge) + completionHandler:^(BOOL granted, NSError *_Nullable error) { + // Enable or disable features based on authorization. + if (error) { + LOGD(error.description); + } + }]; NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, nil]; [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories]; } @@ -307,8 +307,6 @@ LinphoneManager *instance = [LinphoneManager instance]; BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"]; BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"]; - [self registerForNotifications:app]; - if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { self.del = [[ProviderDelegate alloc] init]; [LinphoneManager.instance setProviderDelegate:self.del]; @@ -549,76 +547,6 @@ didInvalidatePushTokenForType:(NSString *)type { forType:(NSString *)type { LOGI(@"PushKit : incoming voip notfication: %@", payload.dictionaryPayload); - if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { // Call category - UNNotificationAction *act_ans = - [UNNotificationAction actionWithIdentifier:@"Answer" - title:NSLocalizedString(@"Answer", nil) - options:UNNotificationActionOptionForeground]; - UNNotificationAction *act_dec = [UNNotificationAction actionWithIdentifier:@"Decline" - title:NSLocalizedString(@"Decline", nil) - options:UNNotificationActionOptionNone]; - UNNotificationCategory *cat_call = - [UNNotificationCategory categoryWithIdentifier:@"call_cat" - actions:[NSArray arrayWithObjects:act_ans, act_dec, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; - // Msg category - UNTextInputNotificationAction *act_reply = - [UNTextInputNotificationAction actionWithIdentifier:@"Reply" - title:NSLocalizedString(@"Reply", nil) - options:UNNotificationActionOptionNone]; - UNNotificationAction *act_seen = - [UNNotificationAction actionWithIdentifier:@"Seen" - title:NSLocalizedString(@"Mark as seen", nil) - options:UNNotificationActionOptionNone]; - UNNotificationCategory *cat_msg = - [UNNotificationCategory categoryWithIdentifier:@"msg_cat" - actions:[NSArray arrayWithObjects:act_reply, act_seen, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; - - // Video Request Category - UNNotificationAction *act_accept = - [UNNotificationAction actionWithIdentifier:@"Accept" - title:NSLocalizedString(@"Accept", nil) - options:UNNotificationActionOptionForeground]; - - UNNotificationAction *act_refuse = [UNNotificationAction actionWithIdentifier:@"Cancel" - title:NSLocalizedString(@"Cancel", nil) - options:UNNotificationActionOptionNone]; - UNNotificationCategory *video_call = - [UNNotificationCategory categoryWithIdentifier:@"video_request" - actions:[NSArray arrayWithObjects:act_accept, act_refuse, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; - - // ZRTP verification category - UNNotificationAction *act_confirm = [UNNotificationAction actionWithIdentifier:@"Confirm" - title:NSLocalizedString(@"Accept", nil) - options:UNNotificationActionOptionNone]; - - UNNotificationAction *act_deny = [UNNotificationAction actionWithIdentifier:@"Deny" - title:NSLocalizedString(@"Deny", nil) - options:UNNotificationActionOptionNone]; - UNNotificationCategory *cat_zrtp = - [UNNotificationCategory categoryWithIdentifier:@"zrtp_request" - actions:[NSArray arrayWithObjects:act_confirm, act_deny, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; - - [UNUserNotificationCenter currentNotificationCenter].delegate = self; - [[UNUserNotificationCenter currentNotificationCenter] - requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | - UNAuthorizationOptionBadge) - completionHandler:^(BOOL granted, NSError *_Nullable error) { - // Enable or disable features based on authorization. - if (error) { - LOGD(error.description); - } - }]; - NSSet *categories = [NSSet setWithObjects:cat_call, cat_msg, video_call, cat_zrtp, nil]; - [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories]; - } [LinphoneManager.instance setupNetworkReachabilityCallback]; //to avoid IOS to suspend the app before being able to launch long running task [self processRemoteNotification:payload.dictionaryPayload]; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 37509cc35..3d2932875 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1327,32 +1327,6 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut [[UIApplication sharedApplication] presentLocalNotificationNow:notif]; } } else { - // Msg category - UNTextInputNotificationAction *act_reply = - [UNTextInputNotificationAction actionWithIdentifier:@"Reply" - title:NSLocalizedString(@"Reply", nil) - options:UNNotificationActionOptionNone]; - UNNotificationAction *act_seen = - [UNNotificationAction actionWithIdentifier:@"Seen" - title:NSLocalizedString(@"Mark as seen", nil) - options:UNNotificationActionOptionNone]; - UNNotificationCategory *cat_msg = - [UNNotificationCategory categoryWithIdentifier:@"msg_cat" - actions:[NSArray arrayWithObjects:act_reply, act_seen, nil] - intentIdentifiers:[[NSMutableArray alloc] init] - options:UNNotificationCategoryOptionCustomDismissAction]; - - [[UNUserNotificationCenter currentNotificationCenter] - requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | - UNAuthorizationOptionBadge) - completionHandler:^(BOOL granted, NSError *_Nullable error) { - // Enable or disable features based on authorization. - if (error) { - LOGD(error.description); - } - }]; - NSSet *categories = [NSSet setWithObjects:cat_msg, nil]; - [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories]; UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init]; content.title = NSLocalizedString(@"Message received", nil); if ([LinphoneManager.instance lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) { From 31b1e1d5d72b54075c2feb17d6d989766d1e9686 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 2 Jan 2018 16:52:59 +0100 Subject: [PATCH 27/35] do not change audio route on call connected when bluetooth --- Classes/LinphoneManager.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 3d2932875..ee2c27304 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -989,7 +989,8 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char if (state == LinphoneCallConnected && !mCallCenter) { /*only register CT call center CB for connected call*/ [self setupGSMInteraction]; - [self setSpeakerEnabled:FALSE]; + if (!_bluetoothEnabled) + [self setSpeakerEnabled:FALSE]; } // Post event From 557eca08219aab3b415ffa3c92bb1d166b2c9c5c Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Wed, 3 Jan 2018 11:34:53 +0100 Subject: [PATCH 28/35] refactor code --- Classes/ProviderDelegate.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Classes/ProviderDelegate.m b/Classes/ProviderDelegate.m index 276273131..5f182c710 100644 --- a/Classes/ProviderDelegate.m +++ b/Classes/ProviderDelegate.m @@ -89,12 +89,11 @@ completion:^(NSError *error) { if (error) { LOGE(@"CallKit: cannot complete incoming call from [%@] caused by [%@]",handle,[error localizedDescription]); - if ( [error code] == CXErrorCodeIncomingCallErrorFilteredByDoNotDisturb - || [error code] == CXErrorCodeIncomingCallErrorFilteredByBlockList) { + if ([error code] == CXErrorCodeIncomingCallErrorFilteredByDoNotDisturb || + [error code] == CXErrorCodeIncomingCallErrorFilteredByBlockList) linphone_call_decline(call,LinphoneReasonBusy); /*to give a chance for other devices to answer*/ - } else { + else linphone_call_decline(call,LinphoneReasonUnknown); - } } linphone_call_unref(call); }]; From bf34895c91ad7df5f5438eaff1a7a08c5c82b64a Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 4 Jan 2018 11:09:16 +0100 Subject: [PATCH 29/35] update pushkit API --- Classes/LinphoneAppDelegate.m | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 827a5c3cc..222522dc1 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -536,30 +536,32 @@ #pragma mark - PushKit Functions +- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type { + LOGI(@"PushKit credentials updated"); + LOGI(@"voip token: %@", (credentials.token)); + dispatch_async(dispatch_get_main_queue(), ^{ + [LinphoneManager.instance setPushNotificationToken:credentials.token]; + }); +} + - (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(NSString *)type { LOGI(@"PushKit Token invalidated"); dispatch_async(dispatch_get_main_queue(), ^{[LinphoneManager.instance setPushNotificationToken:nil];}); } -- (void)pushRegistry:(PKPushRegistry *)registry - didReceiveIncomingPushWithPayload:(PKPushPayload *)payload - forType:(NSString *)type { - +#ifdef __IPHONE_11_0 +- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion { +#else +- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type { +#endif LOGI(@"PushKit : incoming voip notfication: %@", payload.dictionaryPayload); [LinphoneManager.instance setupNetworkReachabilityCallback]; //to avoid IOS to suspend the app before being able to launch long running task [self processRemoteNotification:payload.dictionaryPayload]; -} - -- (void)pushRegistry:(PKPushRegistry *)registry - didUpdatePushCredentials:(PKPushCredentials *)credentials - forType:(PKPushType)type { - LOGI(@"PushKit credentials updated"); - LOGI(@"voip token: %@", (credentials.token)); - dispatch_async(dispatch_get_main_queue(), ^{ - [LinphoneManager.instance setPushNotificationToken:credentials.token]; - }); +#ifdef __IPHONE_11_0 + dispatch_async(dispatch_get_main_queue(), ^{completion();}); +#endif } #pragma mark - UNUserNotifications Framework From b61c5f8a432985c80ff65ffe55eebf33b84c2a0a Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 4 Jan 2018 12:04:11 +0100 Subject: [PATCH 30/35] refactor code of push reception in order not to miss one --- Classes/LinphoneAppDelegate.m | 115 +++++++++++++++------------------- 1 file changed, 50 insertions(+), 65 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 222522dc1..fd4fd940a 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -422,79 +422,65 @@ } - (void)processRemoteNotification:(NSDictionary *)userInfo { + if (linphone_core_get_calls(LC)) // if there are calls, obviously our TCP socket shall be working + return; NSDictionary *aps = [userInfo objectForKey:@"aps"]; + if (!aps) + return; - if (aps != nil) { - NSDictionary *alert = [aps objectForKey:@"alert"]; - NSString *loc_key = [aps objectForKey:@"loc-key"]; - NSString *callId = [aps objectForKey:@"call-id"]; - if (alert != nil) { - loc_key = [alert objectForKey:@"loc-key"]; - /*if we receive a remote notification, it is probably because our TCP background socket was no more working. - As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE*/ - if (linphone_core_get_calls(LC) == NULL) { // if there are calls, obviously our TCP socket shall be working - //linphone_core_set_network_reachable(LC, FALSE); - if (!linphone_core_is_network_reachable(LC)) { - LinphoneManager.instance.connectivity = none; //Force connectivity to be discovered again - [LinphoneManager.instance setupNetworkReachabilityCallback]; - } - if (loc_key != nil) { + NSString *loc_key = [aps objectForKey:@"loc-key"]; + NSString *callId = [aps objectForKey:@"call-id"]; + if (!loc_key || !callId) + return; - callId = [userInfo objectForKey:@"call-id"]; - if (callId != nil) { - if ([callId isEqualToString:@""]){ - //Present apn pusher notifications for info - if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { - UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init]; - content.title = @"APN Pusher"; - content.body = @"Push notification received !"; - - UNNotificationRequest *req = [UNNotificationRequest requestWithIdentifier:@"call_request" content:content trigger:NULL]; - [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:req withCompletionHandler:^(NSError * _Nullable error) { - // Enable or disable features based on authorization. - if (error) { - LOGD(@"Error while adding notification request :"); - LOGD(error.description); - } - }]; - } else { - UILocalNotification *notification = [[UILocalNotification alloc] init]; - notification.repeatInterval = 0; - notification.alertBody = @"Push notification received !"; - notification.alertTitle = @"APN Pusher"; - [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; - } - } else { - [LinphoneManager.instance addPushCallId:callId]; - } - } else if ([callId isEqual: @""]) { - LOGE(@"PushNotification: does not have call-id yet, fix it !"); - } - } - } - } - - if (callId && [self addLongTaskIDforCallID:callId]) { - if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive && loc_key && - index > 0) { - if ([loc_key isEqualToString:@"IC_MSG"]) { - [LinphoneManager.instance startPushLongRunningTask:FALSE callId:callId]; - [self fixRing]; - } else if ([loc_key isEqualToString:@"IM_MSG"]) { - [LinphoneManager.instance startPushLongRunningTask:TRUE callId:callId]; - } - } - } + // if we receive a remote notification, it is probably because our TCP background socket was no more working. + // As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE + if (!linphone_core_is_network_reachable(LC)) { + LinphoneManager.instance.connectivity = none; //Force connectivity to be discovered again + [LinphoneManager.instance setupNetworkReachabilityCallback]; } + + if ([self addLongTaskIDforCallID:callId] && [UIApplication sharedApplication].applicationState != UIApplicationStateActive) { + if ([loc_key isEqualToString:@"IC_MSG"]) { + [LinphoneManager.instance startPushLongRunningTask:FALSE callId:callId]; + [self fixRing]; + } else if ([loc_key isEqualToString:@"IM_MSG"]) + [LinphoneManager.instance startPushLongRunningTask:TRUE callId:callId]; + } + + if ([callId isEqualToString:@""]) { + //Present apn pusher notifications for info + if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { + UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init]; + content.title = @"APN Pusher"; + content.body = @"Push notification received !"; + + UNNotificationRequest *req = [UNNotificationRequest requestWithIdentifier:@"call_request" content:content trigger:NULL]; + [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:req withCompletionHandler:^(NSError * _Nullable error) { + // Enable or disable features based on authorization. + if (error) { + LOGD(@"Error while adding notification request :"); + LOGD(error.description); + } + }]; + } else { + UILocalNotification *notification = [[UILocalNotification alloc] init]; + notification.repeatInterval = 0; + notification.alertBody = @"Push notification received !"; + notification.alertTitle = @"APN Pusher"; + [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; + } + } else + [LinphoneManager.instance addPushCallId:callId]; + LOGI(@"Notification %@ processed", userInfo.description); } - (BOOL)addLongTaskIDforCallID:(NSString *)callId { NSDictionary *dict = LinphoneManager.instance.pushDict; - if ([[dict allKeys] indexOfObject:callId] != NSNotFound) { + if ([[dict allKeys] indexOfObject:callId] != NSNotFound) return FALSE; - } LOGI(@"Adding long running task for call id : %@ with index : 1", callId); [dict setValue:[NSNumber numberWithInt:1] forKey:callId]; @@ -503,7 +489,6 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { LOGI(@"%@ : %@", NSStringFromSelector(_cmd), userInfo); - [self processRemoteNotification:userInfo]; } @@ -513,9 +498,9 @@ while (rooms) { const LinphoneAddress *room_from_address = linphone_chat_room_get_peer_address((LinphoneChatRoom *)rooms->data); char *room_from = linphone_address_as_string_uri_only(room_from_address); - if (room_from && strcmp(from, room_from) == 0) { + if (room_from && strcmp(from, room_from) == 0) return rooms->data; - } + rooms = rooms->next; } return NULL; From 7215bfcd496a92246b193b8ea9b29dee58cd5d59 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 4 Jan 2018 14:17:35 +0100 Subject: [PATCH 31/35] remove useless log --- Classes/LinphoneAppDelegate.m | 1 - 1 file changed, 1 deletion(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index fd4fd940a..1c0317f84 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -540,7 +540,6 @@ didInvalidatePushTokenForType:(NSString *)type { #else - (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type { #endif - LOGI(@"PushKit : incoming voip notfication: %@", payload.dictionaryPayload); [LinphoneManager.instance setupNetworkReachabilityCallback]; //to avoid IOS to suspend the app before being able to launch long running task [self processRemoteNotification:payload.dictionaryPayload]; From 84695a8d0f71c289171c99f3a7d48e9c86167f43 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 4 Jan 2018 14:46:15 +0100 Subject: [PATCH 32/35] Try to start background task sooner --- Classes/LinphoneAppDelegate.m | 19 +++++++++---------- Classes/LinphoneManager.m | 22 ---------------------- Classes/PhoneMainView.m | 2 +- linphone-Info.plist | 4 ++-- linphone.xcodeproj/project.pbxproj | 30 ++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 35 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 1c0317f84..b7566cd2b 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -430,10 +430,17 @@ return; NSString *loc_key = [aps objectForKey:@"loc-key"]; - NSString *callId = [aps objectForKey:@"call-id"]; - if (!loc_key || !callId) + NSString *callId = [aps objectForKey:@"call-id"] ?: @""; + if (!loc_key) return; + if ([self addLongTaskIDforCallID:callId] && [UIApplication sharedApplication].applicationState != UIApplicationStateActive) { + if ([loc_key isEqualToString:@"IC_MSG"]) + [LinphoneManager.instance startPushLongRunningTask:FALSE callId:callId]; + else if ([loc_key isEqualToString:@"IM_MSG"]) + [LinphoneManager.instance startPushLongRunningTask:TRUE callId:callId]; + } + // if we receive a remote notification, it is probably because our TCP background socket was no more working. // As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE if (!linphone_core_is_network_reachable(LC)) { @@ -441,14 +448,6 @@ [LinphoneManager.instance setupNetworkReachabilityCallback]; } - if ([self addLongTaskIDforCallID:callId] && [UIApplication sharedApplication].applicationState != UIApplicationStateActive) { - if ([loc_key isEqualToString:@"IC_MSG"]) { - [LinphoneManager.instance startPushLongRunningTask:FALSE callId:callId]; - [self fixRing]; - } else if ([loc_key isEqualToString:@"IM_MSG"]) - [LinphoneManager.instance startPushLongRunningTask:TRUE callId:callId]; - } - if ([callId isEqualToString:@""]) { //Present apn pusher notifications for info if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_9_x_Max) { diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index ee2c27304..346e59fb0 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2385,28 +2385,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { } if ([LinphoneManager.instance lpConfigBoolForKey:@"backgroundmode_preference"]) { - // register keepalive - if ([[UIApplication sharedApplication] - setKeepAliveTimeout:600 /*(NSTimeInterval)linphone_proxy_config_get_expires(proxyCfg)*/ - handler:^{ - LOGW(@"keepalive handler"); - mLastKeepAliveDate = [NSDate date]; - if (theLinphoneCore == nil) { - LOGW(@"It seems that Linphone BG mode was deactivated, just skipping"); - return; - } - [_iapManager check]; - if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) { - // For registration register - [self refreshRegisters]; - } - linphone_core_iterate(theLinphoneCore); - }]) { - - LOGI(@"keepalive handler succesfully registered"); - } else { - LOGI(@"keepalive handler cannot be registered"); - } shouldEnterBgMode = TRUE; } } diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 52beba1ed..ef6e913ef 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -509,7 +509,7 @@ static RootViewManager *rootViewManagerInstance = nil; - (void)startUp { @try { LinphoneManager *lm = LinphoneManager.instance; - LOGE(@"%s", linphone_global_state_to_string( + LOGI(@"%s", linphone_global_state_to_string( linphone_core_get_global_state(LC))); if (linphone_core_get_global_state(LC) != LinphoneGlobalOn) { [self changeCurrentView:DialerView.compositeViewDescription]; diff --git a/linphone-Info.plist b/linphone-Info.plist index 5829898a7..2a5808f57 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -24,7 +24,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.16.5 + 3.16.6 CFBundleURLTypes @@ -53,7 +53,7 @@ CFBundleVersion - 11 + 0 ITSAppUsesNonExemptEncryption ITSEncryptionExportComplianceCode diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index e427bb881..d10075176 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -828,6 +828,20 @@ remoteGlobalIDString = FAB8A0141CAC546A00C6DFC1; remoteInfo = KIFFrameworkConsumerTests; }; + 8C8686D41FFE675F0044501F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 630589F21B4E816900EFAE36 /* KIF.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8CD87D4C1EF5105800ACA260; + remoteInfo = LinphoneManager; + }; + 8C8686D61FFE675F0044501F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 630589F21B4E816900EFAE36 /* KIF.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 8CD87D541EF5105900ACA260; + remoteInfo = LinphoneManagerTests; + }; F08F119119C09C6B007D70C2 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; @@ -2306,6 +2320,8 @@ 63058A071B4E816A00EFAE36 /* KIF.framework */, 633FC7C81CD7466400774B8B /* KIFFrameworkConsumer.app */, 633FC7CA1CD7466400774B8B /* KIFFrameworkConsumerTests.xctest */, + 8C8686D51FFE675F0044501F /* LinphoneManager.framework */, + 8C8686D71FFE675F0044501F /* LinphoneManagerTests.xctest */, ); name = Products; sourceTree = ""; @@ -3230,6 +3246,20 @@ remoteRef = 633FC7C91CD7466400774B8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 8C8686D51FFE675F0044501F /* LinphoneManager.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = LinphoneManager.framework; + remoteRef = 8C8686D41FFE675F0044501F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8C8686D71FFE675F0044501F /* LinphoneManagerTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = LinphoneManagerTests.xctest; + remoteRef = 8C8686D61FFE675F0044501F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ From d146c4ffe5d022df5d1d0e393d60e4a9db8cdec5 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 5 Jan 2018 11:19:12 +0100 Subject: [PATCH 33/35] add background task to core iteration --- Classes/LinphoneManager.m | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 346e59fb0..dfcacb693 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1744,7 +1744,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach linphone_proxy_config_expires(proxy, 0); } linphone_core_set_network_reachable(theLinphoneCore, true); - linphone_core_iterate(theLinphoneCore); + [LinphoneManager.instance iterate]; LOGI(@"Network connectivity changed to type [%s]", (newConnectivity == wifi ? "wifi" : "wwan")); lm.connectivity = newConnectivity; } @@ -1834,7 +1834,14 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach // scheduling loop - (void)iterate { + UIBackgroundTaskIdentifier coreIterateTaskId = 0; + coreIterateTaskId = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ + LOGW(@"Background task for core iteration launching expired."); + [[UIApplication sharedApplication] endBackgroundTask:coreIterateTaskId]; + }]; linphone_core_iterate(theLinphoneCore); + if (coreIterateTaskId != UIBackgroundTaskInvalid) + [[UIApplication sharedApplication] endBackgroundTask:coreIterateTaskId]; } - (void)audioSessionInterrupted:(NSNotification *)notification { @@ -2122,7 +2129,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat /*call iterate once immediately in order to initiate background connections with sip server or remote provisioning * grab, if any */ - linphone_core_iterate(theLinphoneCore); + [self iterate]; // start scheduler mIterateTimer = [NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(iterate) userInfo:nil repeats:YES]; @@ -2355,7 +2362,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { proxies = proxies->next; } // force registration update first, then update friend list subscription - linphone_core_iterate(theLinphoneCore); + [self iterate]; } const MSList *lists = linphone_core_get_friends_lists(LC); @@ -2403,7 +2410,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { /*stop the video preview*/ if (theLinphoneCore) { linphone_core_enable_video_preview(theLinphoneCore, FALSE); - linphone_core_iterate(theLinphoneCore); + [self iterate]; } linphone_core_stop_dtmf_stream(theLinphoneCore); From ec9a97651724f406cef14205451e0709f9ab5d04 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Fri, 5 Jan 2018 16:03:54 +0100 Subject: [PATCH 34/35] [addContact] fix sip addres appears twice when adding from history --- CHANGELOG.md | 1 + Classes/ContactDetailsView.m | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da549f8e3..b8c2d7493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Group changes to describe their impact on the project, as follows: ### Added - Support of IOS 11 +- new algorithm to adapt audio and video codec bitrates to the available bandwidth (https://wiki.linphone.org/xwiki/wiki/public/view/FAQ/How%20does%20adaptive%20bitrate%20algorithm%20work%20%3F/) ### Changed - Contact, CNContact implmentation. diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 3366da73c..4d26bbbb6 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -154,7 +154,6 @@ - (void)newContact:(NSString *)address { CNContact *contact = [[CNContact alloc] init]; Contact *mContact = [[Contact alloc] initWithCNContact:contact]; - [mContact setSipAddress:address atIndex:0]; [self selectContact:mContact andReload:NO]; [self addCurrentContactContactField:address]; // force to restart server subscription to add new contact into the list From 609cfb76c8296eb4f75ae3de3ca3245cae86b060 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Mon, 8 Jan 2018 15:42:14 +0100 Subject: [PATCH 35/35] update submodules --- submodules/bctoolbox | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/bctoolbox b/submodules/bctoolbox index 86566bc39..8a1d19db3 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit 86566bc39e8860a34620f05895da9aea8ee57b82 +Subproject commit 8a1d19db312444b0288db7dd62119c982d8beb1e diff --git a/submodules/linphone b/submodules/linphone index 20efb4ad4..9f33a1671 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 20efb4ad41357daf700fa393dbcae9fdb3ab2730 +Subproject commit 9f33a1671e9ad06e4bf327ed9bdf1796d61dbbf2