diff --git a/Classes/ChatConversationCreateView.m b/Classes/ChatConversationCreateView.m index 0483a5d0e..8774adccd 100644 --- a/Classes/ChatConversationCreateView.m +++ b/Classes/ChatConversationCreateView.m @@ -240,10 +240,10 @@ typedef enum { ContactsAll, ContactsLinphone, ContactsMAX } ContactsCategory; cell.controller = self; cell.uri = uri; LinphoneAddress *addr = NULL; - LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); - if (cfg && linphone_proxy_config_is_phone_number(cfg, uri.UTF8String)) { - char *phone = linphone_proxy_config_normalize_phone_number(cfg, uri.UTF8String); - addr = linphone_proxy_config_normalize_sip_uri(cfg, phone); + LinphoneAccount *account = linphone_core_get_default_account(LC); + if (account && linphone_account_is_phone_number(account, uri.UTF8String)) { + char *phone = linphone_account_normalize_phone_number(account, uri.UTF8String); + addr = linphone_account_normalize_sip_uri(account, phone); ms_free(phone); } else addr = linphone_address_new(uri.UTF8String); diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 4119c8a57..be1f6a24f 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -153,7 +153,7 @@ if (([username rangeOfString:@"@"].length > 0) && ([LinphoneManager.instance lpConfigBoolForKey:@"show_contacts_emails_preference"] == true)) { [_tableController addEmailField:username]; - } else if ((linphone_proxy_config_is_phone_number(NULL, [username UTF8String])) && + } else if ((linphone_account_is_phone_number(NULL, [username UTF8String])) && ([LinphoneManager.instance lpConfigBoolForKey:@"save_new_contacts_as_phone_number"] == true)) { [_tableController addPhoneField:username]; } else { diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 3a652ffcc..cb993f0a5 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -969,7 +969,7 @@ if (isDefault) { // if we removed the default proxy config, set another one instead if (linphone_core_get_proxy_config_list(LC) != NULL) { - linphone_core_set_default_proxy_index(LC, 0); + linphone_core_set_default_proxy_config(LC, (LinphoneProxyConfig *)(linphone_core_get_proxy_config_list(LC)->data)); } } [self transformLinphoneCoreToKeys]; diff --git a/Classes/LinphoneUI/UIContactDetailsCell.m b/Classes/LinphoneUI/UIContactDetailsCell.m index d3ce7071e..dd4acf9b1 100644 --- a/Classes/LinphoneUI/UIContactDetailsCell.m +++ b/Classes/LinphoneUI/UIContactDetailsCell.m @@ -45,9 +45,9 @@ - (void)setAddress:(NSString *)address { _addressLabel.text = _editTextfield.text = address; char *normAddr = (char *)_addressLabel.text.UTF8String; - LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); - if(_addressLabel.text && cfg && linphone_proxy_config_is_phone_number(cfg, _addressLabel.text.UTF8String)) { - normAddr = linphone_proxy_config_normalize_phone_number(cfg, + LinphoneAccount *account = linphone_core_get_default_account(LC); + if(_addressLabel.text && account && linphone_account_is_phone_number(account, _addressLabel.text.UTF8String)) { + normAddr = linphone_account_normalize_phone_number(account, _addressLabel.text.UTF8String); } LinphoneAddress *addr = linphone_core_interpret_url(LC, normAddr); @@ -66,12 +66,12 @@ self.linphoneImage.hidden = [LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"] || !((model && linphone_presence_model_get_basic_status(model) == LinphonePresenceBasicStatusOpen) || - (cfg && !linphone_proxy_config_is_phone_number(cfg, + (account && !linphone_account_is_phone_number(account, _addressLabel.text.UTF8String) && [FastAddressBook isSipURIValid:_addressLabel.text])); ContactDetailsView *contactDetailsView = VIEW(ContactDetailsView); self.inviteButton.hidden = !ENABLE_SMS_INVITE || [[contactDetailsView.contact sipAddresses] count] > 0 || !self.linphoneImage.hidden; - [self shouldHideEncryptedChatView:cfg && linphone_proxy_config_get_conference_factory_uri(cfg) && model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh)]; + [self shouldHideEncryptedChatView:account && linphone_account_params_get_conference_factory_uri(linphone_account_get_params(account)) && model && linphone_presence_model_has_capability(model, LinphoneFriendCapabilityLimeX3dh)]; } if (addr) { @@ -97,10 +97,10 @@ } char *normAddr = (char *)_addressLabel.text.UTF8String; - LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); - if (cfg && linphone_proxy_config_is_phone_number(cfg, + LinphoneAccount *account = linphone_core_get_default_account(LC); + if (account && linphone_account_is_phone_number(account, _addressLabel.text.UTF8String)) { - normAddr = linphone_proxy_config_normalize_phone_number(cfg, + normAddr = linphone_account_normalize_phone_number(account, _addressLabel.text.UTF8String); } LinphoneAddress *addr = linphone_core_interpret_url(LC, normAddr); @@ -109,7 +109,7 @@ Contact *contact = [FastAddressBook getContactWithAddress:(addr)]; if (contact) { - self.linphoneImage.hidden =[LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"] || ! ((contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model_for_uri_or_tel(contact.friend, _addressLabel.text.UTF8String)) == LinphonePresenceBasicStatusOpen) || (cfg && !linphone_proxy_config_is_phone_number(cfg, _addressLabel.text.UTF8String) && [FastAddressBook isSipURIValid:_addressLabel.text])); + self.linphoneImage.hidden =[LinphoneManager.instance lpConfigBoolForKey:@"hide_linphone_contacts" inSection:@"app"] || ! ((contact.friend && linphone_presence_model_get_basic_status(linphone_friend_get_presence_model_for_uri_or_tel(contact.friend, _addressLabel.text.UTF8String)) == LinphonePresenceBasicStatusOpen) || (account && !linphone_account_is_phone_number(account, _addressLabel.text.UTF8String) && [FastAddressBook isSipURIValid:_addressLabel.text])); } if (addr) { diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 9e58f69e3..57f88a018 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -516,7 +516,7 @@ LOGD(@"dumpContactsDisplayNamesToUserDefaults"); NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:kLinphoneMsgNotificationAppGroupId]; __block NSDictionary *oldDisplayNames = [defaults dictionaryForKey:@"addressBook"]; - LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); + LinphoneAccount *account = linphone_core_get_default_account(LC); __block NSMutableDictionary *displayNames = [[NSMutableDictionary dictionary] init]; [_addressBookMap enumerateKeysAndObjectsUsingBlock:^(NSString *name, Contact *contact, BOOL *stop) { @@ -524,7 +524,7 @@ NSString *key = name; LinphoneAddress *addr = linphone_address_new(name.UTF8String); - if (addr && linphone_proxy_config_is_phone_number(cfg, linphone_address_get_username(addr))) { + if (addr && linphone_account_is_phone_number(account, linphone_address_get_username(addr))) { if (oldDisplayNames[name] != nil && [FastAddressBook isSipURI:oldDisplayNames[name]]) { NSString *addrForTel = [NSString stringWithString:oldDisplayNames[name]]; /* we keep the link between tel number and sip addr to have the information quickly. @@ -583,7 +583,7 @@ if ([FastAddressBook isSipURI:uri]) { LinphoneAddress *addr = linphone_address_new(uri.UTF8String); - if (linphone_proxy_config_is_phone_number(linphone_core_get_default_proxy_config(LC), linphone_address_get_username(addr))) { + if (linphone_account_is_phone_number(linphone_core_get_default_account(LC), linphone_address_get_username(addr))) { telAddr = uri; } linphone_address_unref(addr); diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index dc72aef7c..054786af8 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -457,13 +457,13 @@ if (!value || [value isEqualToString:@""]) return NULL; - LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); + LinphoneAccount *account = linphone_core_get_default_account(LC); const char *normvalue; - normvalue = linphone_proxy_config_is_phone_number(cfg, value.UTF8String) - ? linphone_proxy_config_normalize_phone_number(cfg, value.UTF8String) + normvalue = linphone_account_is_phone_number(account, value.UTF8String) + ? linphone_account_normalize_phone_number(account, value.UTF8String) : value.UTF8String; - LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, normvalue); + LinphoneAddress *addr = linphone_account_normalize_sip_uri(account, normvalue); // first try to find a friend with the given address Contact *c = [FastAddressBook getContactWithAddress:addr]; @@ -484,10 +484,10 @@ // since user wants to escape plus, we assume it expects to have phone // numbers by default - if (addr && cfg) { - const char *username = linphone_proxy_config_get_dial_escape_plus(cfg) ? normvalue : value.UTF8String; - if (linphone_proxy_config_is_phone_number(cfg, username)) - linphone_address_set_username(addr, linphone_proxy_config_normalize_phone_number(cfg, username)); + if (addr && account) { + const char *username = linphone_account_params_get_dial_escape_plus_enabled(linphone_account_get_params(account)) ? normvalue : value.UTF8String; + if (linphone_account_is_phone_number(account, username)) + linphone_address_set_username(addr, linphone_account_normalize_phone_number(account, username)); } return addr; } diff --git a/Podfile b/Podfile index 6c7018096..8dfe253ea 100644 --- a/Podfile +++ b/Podfile @@ -5,7 +5,7 @@ source "https://github.com/CocoaPods/Specs.git" def all_pods if ENV['PODFILE_PATH'].nil? - pod 'linphone-sdk', '4.5.0' + pod 'linphone-sdk', '~> 5.0.0-alpha' else pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk end