From d9149b6b2c0800f676d6fd049501b6ae8fc0554b Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 21 Sep 2017 10:15:44 +0200 Subject: [PATCH 1/3] fetching contacts is not required to ask for contact permission --- Classes/Utils/FastAddressBook.m | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index e7932a6e5..e9cf29f9d 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -123,33 +123,12 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info CNEntityType entityType = CNEntityTypeContacts; if([CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusNotDetermined) { CNContactStore * contactStore = [[CNContactStore alloc] init]; + LOGD(@"CNContactStore requesting authorization"); [contactStore requestAccessForEntityType:entityType completionHandler:^(BOOL granted, NSError * _Nullable error) { - if(granted){ - NSError* contactError; - store = [[CNContactStore alloc]init]; - [store containersMatchingPredicate:[CNContainer predicateForContainersWithIdentifiers: @[store.defaultContainerIdentifier]] error:&contactError]; - NSArray * keysToFetch =@[CNContactEmailAddressesKey, CNContactPhoneNumbersKey, CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPostalAddressesKey]; - CNContactFetchRequest * request = [[CNContactFetchRequest alloc]initWithKeysToFetch:keysToFetch]; - BOOL success = [store enumerateContactsWithFetchRequest:request error:&contactError usingBlock:^(CNContact * __nonnull contact, BOOL * __nonnull stop){}]; - if(success) { - LOGD(@"CNContactStore successfully synchronized"); - } - } + LOGD(@"CNContactStore authorization granted"); }]; } else if([CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized) { - NSError* contactError; - store = [[CNContactStore alloc]init]; - [store containersMatchingPredicate:[CNContainer predicateForContainersWithIdentifiers: @[store.defaultContainerIdentifier]] error:&contactError]; - NSArray * keysToFetch =@[CNContactEmailAddressesKey, CNContactPhoneNumbersKey, CNContactFamilyNameKey, CNContactGivenNameKey, CNContactPostalAddressesKey]; - CNContactFetchRequest * request = [[CNContactFetchRequest alloc]initWithKeysToFetch:keysToFetch]; - __block int number_of_contact=0; - LOGD(@"CNContactStore synchronizing"); - BOOL success = [store enumerateContactsWithFetchRequest:request error:&contactError usingBlock:^(CNContact * __nonnull contact, BOOL * __nonnull stop){ - number_of_contact++; - }]; - if(success) { - LOGD(@"CNContactStore [%i] contacts successfully synchronized",number_of_contact); - } + LOGD(@"CNContactStore authorization granted"); } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateAddressBook:) name:CNContactStoreDidChangeNotification object:nil]; } From 28b2914c0cad1709a9f4a688501821343c326d0a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 21 Sep 2017 10:18:12 +0200 Subject: [PATCH 2/3] update bcmatroska2 sub --- submodules/bcmatroska2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/bcmatroska2 b/submodules/bcmatroska2 index 46f30179f..f4b87c521 160000 --- a/submodules/bcmatroska2 +++ b/submodules/bcmatroska2 @@ -1 +1 @@ -Subproject commit 46f30179fcc9d00f35f7d0ef8eacce0a204e4d07 +Subproject commit f4b87c521a513b540f34a72ef82a52364929d0be From 261d0031c56335be9af63e263c8b86bf610998cd Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Mon, 25 Sep 2017 16:16:12 +0200 Subject: [PATCH 3/3] remove call to deprecated function --- Classes/CallView.m | 2 +- Classes/LinphoneUI/UICallButton.m | 2 +- Classes/LinphoneUI/UIVideoButton.m | 4 ++-- Classes/PhoneMainView.m | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Classes/CallView.m b/Classes/CallView.m index 0edbf1021..6a7914795 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -538,7 +538,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) { if (!linphone_call_params_video_enabled(linphone_call_get_current_params(call))) { const LinphoneCallParams *param = linphone_call_get_current_params(call); const LinphoneCallAppData *callAppData = - (__bridge const LinphoneCallAppData *)(linphone_call_get_user_pointer(call)); + (__bridge const LinphoneCallAppData *)(linphone_call_get_user_data(call)); if (state == LinphoneCallStreamsRunning && callAppData->videoRequested && linphone_call_params_low_bandwidth_enabled(param)) { // too bad video was not enabled because low bandwidth diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m index 4cf7991a7..434ab0863 100644 --- a/Classes/LinphoneUI/UICallButton.m +++ b/Classes/LinphoneUI/UICallButton.m @@ -63,7 +63,7 @@ if (address.length == 0) { LinphoneCallLog *log = linphone_core_get_last_outgoing_call_log(LC); if (log) { - LinphoneAddress *to = linphone_call_log_get_to(log); + const LinphoneAddress *to = linphone_call_log_get_to_address(log); const char *domain = linphone_address_get_domain(to); char *bis_address = NULL; LinphoneProxyConfig *def_proxy = linphone_core_get_default_proxy_config(LC); diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m index d644c0621..accf67675 100644 --- a/Classes/LinphoneUI/UIVideoButton.m +++ b/Classes/LinphoneUI/UIVideoButton.m @@ -19,7 +19,7 @@ #import "UIVideoButton.h" #include "LinphoneManager.h" -#import "Utils.h" +#import "Log.h" @implementation UIVideoButton { BOOL last_update_state; @@ -42,7 +42,7 @@ INIT_WITH_COMMON_CF { LinphoneCall *call = linphone_core_get_current_call(LC); if (call) { - LinphoneCallAppData *callAppData = (__bridge LinphoneCallAppData *)linphone_call_get_user_pointer(call); + LinphoneCallAppData *callAppData = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call); callAppData->videoRequested = TRUE; /* will be used later to notify user if video was not activated because of the linphone core*/ LinphoneCallParams *call_params = linphone_core_create_call_params(LC,call); diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index ea648a66c..8f2f694f2 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -20,6 +20,7 @@ #import #import #import "LinphoneAppDelegate.h" +#import "Log.h" #import "PhoneMainView.h" static RootViewManager *rootViewManagerInstance = nil; @@ -779,7 +780,7 @@ static RootViewManager *rootViewManagerInstance = nil; LinphoneCall *call = linphone_core_get_current_call(LC); if (call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) { - LinphoneCallAppData *callData = (__bridge LinphoneCallAppData *)linphone_call_get_user_pointer(call); + LinphoneCallAppData *callData = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call); if (callData != nil) { if (state == UIDeviceBatteryStateUnplugged) { if (level <= 0.2f && !callData->batteryWarningShown) {