diff --git a/.gitmodules b/.gitmodules index eb4760cd1..d29905eee 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,7 +9,7 @@ url = git://git.linphone.org/speex [submodule "submodules/externals/opencore-amr"] path = submodules/externals/opencore-amr - url = git://git.linphone.org/opencore-amr + url = git://git.linphone.org/opencore-amr.git ignore = dirty [submodule "submodules/msamr"] path = submodules/msamr diff --git a/Classes/AboutView.m b/Classes/AboutView.m index bdd061eaa..884a34013 100644 --- a/Classes/AboutView.m +++ b/Classes/AboutView.m @@ -128,6 +128,6 @@ static UICompositeViewDescription *compositeDescription = nil; } - (IBAction)onDialerBackClick:(id)sender { - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; } @end diff --git a/Classes/AssistantView.h b/Classes/AssistantView.h index 524f22643..2ee58224c 100644 --- a/Classes/AssistantView.h +++ b/Classes/AssistantView.h @@ -29,7 +29,7 @@ UIView *nextView; NSMutableArray *historyViews; LinphoneProxyConfig *new_config; - LinphoneProxyConfig *previous_default_config; + int number_of_configs_before; } @property(nonatomic, strong) IBOutlet TPKeyboardAvoidingScrollView *contentView; diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index 2e35d179b..89317afc5 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -84,31 +84,24 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(registrationUpdateEvent:) - name:kLinphoneRegistrationUpdate - object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(configuringUpdate:) - name:kLinphoneConfiguringStateUpdate - object:nil]; - // we will set the new default proxy config in the assistant - previous_default_config = linphone_core_get_default_proxy_config([LinphoneManager getLc]); - linphone_core_set_default_proxy_config([LinphoneManager getLc], NULL); + [NSNotificationCenter.defaultCenter addObserver:self + selector:@selector(registrationUpdateEvent:) + name:kLinphoneRegistrationUpdate + object:nil]; + [NSNotificationCenter.defaultCenter addObserver:self + selector:@selector(configuringUpdate:) + name:kLinphoneConfiguringStateUpdate + object:nil]; new_config = NULL; [self resetTextFields]; [self changeView:_welcomeView back:FALSE animation:FALSE]; + number_of_configs_before = ms_list_size(linphone_core_get_proxy_config_list(LC)); } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - // if we quit assistant without creating a new proxy config, just restore the previous one - if (!linphone_core_get_default_proxy_config([LinphoneManager getLc])) { - linphone_core_set_default_proxy_config([LinphoneManager getLc], previous_default_config); - } + [NSNotificationCenter.defaultCenter removeObserver:self]; } - (void)fitContent { @@ -132,11 +125,10 @@ static UICompositeViewDescription *compositeDescription = nil; linphone_account_creator_unref(account_creator); account_creator = NULL; } - [[LinphoneManager instance] resetLinphoneCore]; + [LinphoneManager.instance resetLinphoneCore]; account_creator = linphone_account_creator_new( - [LinphoneManager getLc], - [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""] - .UTF8String); + LC, [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""] + .UTF8String); linphone_account_creator_set_user_data(account_creator, (__bridge void *)(self)); linphone_account_creator_cbs_set_existence_tested(linphone_account_creator_get_callbacks(account_creator), assistant_existence_tested); @@ -147,25 +139,25 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)loadAssistantConfig:(NSString *)rcFilename { NSString *fullPath = [@"file://" stringByAppendingString:[LinphoneManager bundleFile:rcFilename]]; - linphone_core_set_provisioning_uri([LinphoneManager getLc], fullPath.UTF8String); - [[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; + linphone_core_set_provisioning_uri(LC, fullPath.UTF8String); + [LinphoneManager.instance lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; [self resetLiblinphone]; } - (void)reset { - [[LinphoneManager instance] removeAllAccounts]; - [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"pushnotification_preference"]; + [LinphoneManager.instance removeAllAccounts]; + [LinphoneManager.instance lpConfigSetBool:FALSE forKey:@"pushnotification_preference"]; - LinphoneCore *lc = [LinphoneManager getLc]; + LinphoneCore *lc = LC; LCSipTransports transportValue = {5060, 5060, -1, -1}; if (linphone_core_set_sip_transports(lc, &transportValue)) { LOGE(@"cannot set transport"); } - [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"ice_preference"]; - [[LinphoneManager instance] lpConfigSetString:@"" forKey:@"stun_preference"]; + [LinphoneManager.instance lpConfigSetBool:FALSE forKey:@"ice_preference"]; + [LinphoneManager.instance lpConfigSetString:@"" forKey:@"stun_preference"]; linphone_core_set_stun_server(lc, NULL); linphone_core_set_firewall_policy(lc, LinphonePolicyNoFirewall); [self resetTextFields]; @@ -178,7 +170,7 @@ static UICompositeViewDescription *compositeDescription = nil; } + (NSString *)errorForStatus:(LinphoneAccountCreatorStatus)status { - BOOL usePhoneNumber = [[LinphoneManager instance] lpConfigBoolForKey:@"use_phone_number" inSection:@"assistant"]; + BOOL usePhoneNumber = [LinphoneManager.instance lpConfigBoolForKey:@"use_phone_number" inSection:@"assistant"]; switch (status) { case LinphoneAccountCreatorEmailInvalid: return NSLocalizedString(@"Invalid email.", nil); @@ -221,8 +213,8 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)configureProxyConfig { - LinphoneCore *lc = [LinphoneManager getLc]; - LinphoneManager *lm = [LinphoneManager instance]; + LinphoneCore *lc = LC; + LinphoneManager *lm = LinphoneManager.instance; // remove previous proxy config, if any if (new_config != NULL) { @@ -240,7 +232,7 @@ static UICompositeViewDescription *compositeDescription = nil; linphone_core_set_default_proxy_config(lc, new_config); // reload address book to prepend proxy config domain to contacts' phone number // todo: STOP doing that! - [[[LinphoneManager instance] fastAddressBook] reload]; + [[LinphoneManager.instance fastAddressBook] reload]; } } @@ -255,10 +247,9 @@ static UICompositeViewDescription *compositeDescription = nil; [self displayUsernameAsPhoneOrUsername]; if (view == _welcomeView) { - 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_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"]; if (!placement_done) { // visibility @@ -285,7 +276,7 @@ static UICompositeViewDescription *compositeDescription = nil; } // Animation - if (animation && [[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == true) { + if (animation && ANIMATED) { CATransition *trans = [CATransition animation]; [trans setType:kCATransitionPush]; [trans setDuration:0.35]; @@ -326,18 +317,10 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)fillDefaultValues { [self resetTextFields]; - LinphoneProxyConfig *current_conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]); - if (current_conf != NULL) { - if (linphone_proxy_config_find_auth_info(current_conf) != NULL) { - LOGI(@"A proxy config was set up with the remote provisioning, skip assistant"); - [self onDialerClick:nil]; - } - } - - LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config([LinphoneManager getLc]); + LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config(LC); const char *identity = linphone_proxy_config_get_identity(default_conf); if (identity) { - LinphoneAddress *default_addr = linphone_address_new(identity); + LinphoneAddress *default_addr = linphone_core_interpret_url(LC, identity); if (default_addr) { const char *domain = linphone_address_get_domain(default_addr); const char *username = linphone_address_get_username(default_addr); @@ -486,7 +469,7 @@ static UICompositeViewDescription *compositeDescription = nil; if ([inputEntry rangeOfString:@"://"].location == NSNotFound) { inputEntry = [NSString stringWithFormat:@"http://%@", inputEntry]; } - return (linphone_core_set_provisioning_uri([LinphoneManager getLc], inputEntry.UTF8String) != 0); + return (linphone_core_set_provisioning_uri(LC, inputEntry.UTF8String) != 0); } return TRUE; }]; @@ -523,7 +506,7 @@ static UICompositeViewDescription *compositeDescription = nil; switch (state) { case LinphoneRegistrationOk: { _waitView.hidden = true; - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; break; } case LinphoneRegistrationNone: @@ -543,7 +526,7 @@ static UICompositeViewDescription *compositeDescription = nil; otherButtonTitles:nil]; [alert addButtonWithTitle:@"Continue" block:^(void) { - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; }]; [alert show]; break; @@ -564,6 +547,12 @@ static UICompositeViewDescription *compositeDescription = nil; switch (status) { case LinphoneConfiguringSuccessful: + // we successfully loaded a remote provisioned config, go to dialer + if (number_of_configs_before < ms_list_size(linphone_core_get_proxy_config_list(LC))) { + LOGI(@"A proxy config was set up with the remote provisioning, skip assistant"); + [self onDialerClick:nil]; + } + if (nextView == nil) { [self fillDefaultValues]; } else { @@ -633,7 +622,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun [alert addButtonWithTitle:NSLocalizedString(@"Skip verification", nil) block:^{ [thiz configureProxyConfig]; - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; }]; [alert show]; } @@ -705,7 +694,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun nextView = _remoteProvisioningView; [self loadAssistantConfig:@"assistant_remote.rc"]; [self findTextField:ViewElement_URL].text = - [[LinphoneManager instance] lpConfigStringForKey:@"config-uri" inSection:@"misc"]; + [LinphoneManager.instance lpConfigStringForKey:@"config-uri" inSection:@"misc"]; } - (IBAction)onCreateAccountClick:(id)sender { @@ -730,7 +719,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun - (IBAction)onRemoteProvisioningLoginClick:(id)sender { _waitView.hidden = NO; - [[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; + [LinphoneManager.instance lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"]; [self configureProxyConfig]; } @@ -754,7 +743,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun } - (IBAction)onDialerClick:(id)sender { - [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; } @end diff --git a/Classes/Base.lproj/CallIncomingView.xib b/Classes/Base.lproj/CallIncomingView.xib index e18d31111..6651bf888 100644 --- a/Classes/Base.lproj/CallIncomingView.xib +++ b/Classes/Base.lproj/CallIncomingView.xib @@ -34,13 +34,6 @@ - + - + @@ -281,7 +281,7 @@ - + diff --git a/Classes/Base.lproj/CallOutgoingView.xib b/Classes/Base.lproj/CallOutgoingView.xib index c35efb243..6d3ac0234 100644 --- a/Classes/Base.lproj/CallOutgoingView.xib +++ b/Classes/Base.lproj/CallOutgoingView.xib @@ -10,6 +10,7 @@ + @@ -40,7 +41,7 @@ - + @@ -223,13 +224,6 @@ - + @@ -246,7 +247,7 @@ diff --git a/Classes/Base.lproj/CallView.xib b/Classes/Base.lproj/CallView.xib index 12237d2f5..8eda3cad7 100644 --- a/Classes/Base.lproj/CallView.xib +++ b/Classes/Base.lproj/CallView.xib @@ -716,8 +716,8 @@ - - + + diff --git a/Classes/Base.lproj/DialerView.xib b/Classes/Base.lproj/DialerView.xib index 3f30ab4d2..6cceee355 100644 --- a/Classes/Base.lproj/DialerView.xib +++ b/Classes/Base.lproj/DialerView.xib @@ -47,7 +47,7 @@ - + @@ -55,7 +55,7 @@ - + diff --git a/Classes/Base.lproj/DialerView~ipad.xib b/Classes/Base.lproj/DialerView~ipad.xib index af249e670..1b8acb03f 100644 --- a/Classes/Base.lproj/DialerView~ipad.xib +++ b/Classes/Base.lproj/DialerView~ipad.xib @@ -1,5 +1,5 @@ - + @@ -63,8 +63,8 @@ - - + + @@ -72,7 +72,7 @@ - + @@ -389,8 +389,8 @@ - - + + @@ -398,7 +398,7 @@ - + @@ -709,7 +709,7 @@ - + diff --git a/Classes/Base.lproj/SideMenuView.xib b/Classes/Base.lproj/SideMenuView.xib index 50397d262..9e99f1e38 100644 --- a/Classes/Base.lproj/SideMenuView.xib +++ b/Classes/Base.lproj/SideMenuView.xib @@ -1,8 +1,8 @@ - + - + @@ -31,10 +31,9 @@ -