migrate to new dialplan

This commit is contained in:
Benjamin Reis 2017-10-16 17:10:50 +02:00
parent ae4576e5e7
commit 90632ba856
4 changed files with 17 additions and 16 deletions

View file

@ -942,14 +942,14 @@ static UICompositeViewDescription *compositeDescription = nil;
NSString *tmp_phone =
[NSString stringWithUTF8String:linphone_account_creator_get_phone_number(account_creator)];
int ccc = -1;
LinphoneDialPlan dialplan = {0};
const LinphoneDialPlan *dialplan = NULL;
char *nationnal_significant_number = NULL;
ccc = linphone_dial_plan_lookup_ccc_from_e164(tmp_phone.UTF8String);
if (ccc > -1) { /*e164 like phone number*/
dialplan = *linphone_dial_plan_by_ccc_as_int(ccc);
nationnal_significant_number = strstr(tmp_phone.UTF8String, dialplan.ccc);
dialplan = linphone_dial_plan_by_ccc_as_int(ccc);
nationnal_significant_number = strstr(tmp_phone.UTF8String, linphone_dial_plan_get_country_calling_code(dialplan));
if (nationnal_significant_number) {
nationnal_significant_number += strlen(dialplan.ccc);
nationnal_significant_number += strlen(linphone_dial_plan_get_country_calling_code(dialplan));
}
}
[self changeView:_linphoneLoginView back:FALSE animation:TRUE];
@ -971,15 +971,15 @@ static UICompositeViewDescription *compositeDescription = nil;
ofType:[UITextField class]])
.text = @"";
linphone_account_creator_set_activation_code(account_creator, "");
if (dialplan.iso_country_code) {
if (linphone_dial_plan_get_iso_country_code(dialplan)) {
NSDictionary *country = [CountryListView
countryWithIso:[NSString stringWithUTF8String:dialplan.iso_country_code]];
countryWithIso:[NSString stringWithUTF8String:linphone_dial_plan_get_iso_country_code(dialplan)]];
[self didSelectCountry:country];
}
// Reset phone number in account_creator to be sure to let the user retry
if (nationnal_significant_number) {
linphone_account_creator_set_phone_number(account_creator, nationnal_significant_number,
dialplan.ccc);
linphone_dial_plan_get_country_calling_code(dialplan));
}
}];

View file

@ -7,7 +7,6 @@
//
#import "CountryListView.h"
#import "linphone/linphonecore_utils.h"
@interface CountryListView ()
@ -24,14 +23,16 @@ static NSMutableArray * dataRows = nil;
+ (NSArray*) getData {
if (!dataRows) {
dataRows = [[NSMutableArray alloc] init];
for (const LinphoneDialPlan* dial_plan=linphone_dial_plan_get_all(); dial_plan->country!=NULL; dial_plan++) {
const bctbx_list_t *dialPlans = linphone_dial_plan_get_all_list();
while (dialPlans) {
LinphoneDialPlan* dial_plan = (LinphoneDialPlan*)dialPlans->data;
[dataRows addObject:@{
@"name":[NSString stringWithUTF8String:dial_plan->country],
@"iso":[NSString stringWithUTF8String:dial_plan->iso_country_code],
@"code":[NSString stringWithFormat:@"+%s",dial_plan->ccc],
@"phone_length":@(dial_plan->nnl)
@"name":[NSString stringWithUTF8String:linphone_dial_plan_get_country(dial_plan)],
@"iso":[NSString stringWithUTF8String:linphone_dial_plan_get_iso_country_code(dial_plan)],
@"code":[NSString stringWithFormat:@"+%s",linphone_dial_plan_get_country_calling_code(dial_plan)],
@"phone_length":@(linphone_dial_plan_get_national_number_length(dial_plan))
}];
dialPlans = dialPlans->next;
}
}
return dataRows;

@ -1 +1 @@
Subproject commit 0b074bd601fd97ee3977faf61c438eeb806b3a41
Subproject commit e3b9709cc5c01250aa944a7cb6f8abbee885113f

@ -1 +1 @@
Subproject commit 7b59cd6ee63109d036ffe5d6c4777950a0a3b2f5
Subproject commit 894391c13b676093b126ccf47a4965c0fe00b720