diff --git a/Classes/AssistantLinkView.h b/Classes/AssistantLinkView.h new file mode 100644 index 000000000..f7c5bba48 --- /dev/null +++ b/Classes/AssistantLinkView.h @@ -0,0 +1,29 @@ +// +// AssistantLinkView.h +// linphone +// +// Created by Gautier Pelloux-Prayer on 29/08/16. +// +// + +#import "PhoneMainView.h" +#import + +@interface AssistantLinkView : UIViewController +@property(weak, nonatomic) IBOutlet UIView *linkAccountView; +@property(weak, nonatomic) IBOutlet UIView *activateSMSView; + +@property(weak, nonatomic) IBOutlet UIButton *countryButton; +@property(weak, nonatomic) IBOutlet UITextField *countryCodeField; +@property(weak, nonatomic) IBOutlet UITextField *activationCodeField; +@property(weak, nonatomic) IBOutlet UIRoundBorderedButton *linkAccountButton; +@property(weak, nonatomic) IBOutlet UIRoundBorderedButton *checkValidationButton; +@property(weak, nonatomic) IBOutlet UIView *waitView; +@property(weak, nonatomic) IBOutlet UITextField *phoneField; + +- (IBAction)onLinkAccount:(id)sender; +- (IBAction)onCheckValidationButton:(id)sender; +- (IBAction)onCountryClick:(id)sender; +- (IBAction)onDialerClick:(id)sender; + +@end diff --git a/Classes/AssistantLinkView.m b/Classes/AssistantLinkView.m new file mode 100644 index 000000000..50ec9adce --- /dev/null +++ b/Classes/AssistantLinkView.m @@ -0,0 +1,221 @@ +// +// AssistantLinkView.m +// linphone +// +// Created by Gautier Pelloux-Prayer on 29/08/16. +// +// + +#import +#import + +#import "AssistantLinkView.h" + +@implementation AssistantLinkView { + LinphoneAccountCreator *account_creator; +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + + _linkAccountView.hidden = _activateSMSView.userInteractionEnabled = NO; + _activateSMSView.hidden = _linkAccountView.userInteractionEnabled = YES; + + account_creator = linphone_account_creator_new( + 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_link_phone_number_with_account( + linphone_account_creator_get_callbacks(account_creator), assistant_link_phone_number_with_account); + linphone_account_creator_cbs_set_activate_phone_number_link(linphone_account_creator_get_callbacks(account_creator), + assistant_activate_phone_number_link); + + LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); + if (cfg && strcmp("sip.linphone.org", linphone_proxy_config_get_domain(cfg)) == 0) { + linphone_account_creator_set_username( + account_creator, linphone_address_get_username(linphone_proxy_config_get_identity_address(cfg))); + const LinphoneAuthInfo *info = linphone_proxy_config_find_auth_info(cfg); + linphone_account_creator_set_password(account_creator, linphone_auth_info_get_passwd(info)); + linphone_account_creator_set_domain(account_creator, linphone_proxy_config_get_domain(cfg)); + } else { + LOGW(@"Default proxy is NOT a sip.linphone.org, aborting"); + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; + } + + CTTelephonyNetworkInfo *networkInfo = [CTTelephonyNetworkInfo new]; + CTCarrier *carrier = networkInfo.subscriberCellularProvider; + NSDictionary *country = [CountryListView countryWithIso:carrier.isoCountryCode]; + if (!country) { + // fetch phone locale + for (NSString *lang in [NSLocale preferredLanguages]) { + NSUInteger idx = [lang rangeOfString:@"-"].location; + idx = (idx == NSNotFound) ? idx = 0 : idx + 1; + if ((country = [CountryListView countryWithIso:[lang substringFromIndex:idx]]) != nil) + break; + } + } + + if (country) { + [self didSelectCountry:country]; + } +} + +- (void)viewDidDisappear:(BOOL)animated { + linphone_account_creator_unref(account_creator); + [super viewDidDisappear:animated]; +} + +#pragma mark - UICompositeViewDelegate Functions + +static UICompositeViewDescription *compositeDescription = nil; + ++ (UICompositeViewDescription *)compositeViewDescription { + if (compositeDescription == nil) { + compositeDescription = [[UICompositeViewDescription alloc] init:self.class + statusBar:StatusBarView.class + tabBar:nil + sideMenu:SideMenuView.class + fullscreen:false + isLeftFragment:NO + fragmentWith:nil]; + + compositeDescription.darkBackground = true; + } + return compositeDescription; +} + +- (UICompositeViewDescription *)compositeViewDescription { + return self.class.compositeViewDescription; +} + +#pragma mark - popup + +- (NSString *)stringForError:(const char *)err { +#define IS(x) (err && (strcmp(err, #x) == 0)) + if + IS(ERROR_ACCOUNT_ALREADY_ACTIVATED) + return NSLocalizedString(@"This account is already activated.", nil); + if + IS(ERROR_ACCOUNT_ALREADY_IN_USE) + return NSLocalizedString(@"This account is already in use.", nil); + if + IS(ERROR_ACCOUNT_DOESNT_EXIST) + return NSLocalizedString(@"This account does not exist.", nil); + if + IS(ERROR_ACCOUNT_NOT_ACTIVATED) + return NSLocalizedString(@"This account is not activated yet.", nil); + if + IS(ERROR_ALIAS_ALREADY_IN_USE) + return NSLocalizedString(@"This alias is already used.", nil); + if + IS(ERROR_ALIAS_DOESNT_EXIST) + return NSLocalizedString(@"This alias does not exist.", nil); + if + IS(ERROR_EMAIL_ALREADY_IN_USE) + return NSLocalizedString(@"This email address is already used.", nil); + if + IS(ERROR_EMAIL_DOESNT_EXIST) + return NSLocalizedString(@"This email does not exist.", nil); + if + IS(ERROR_KEY_DOESNT_MATCH) + return NSLocalizedString(@"The confirmation code is invalid.", nil); + if + IS(ERROR_PASSWORD_DOESNT_MATCH) + return NSLocalizedString(@"Passwords do not match.", nil); + if + IS(ERROR_PHONE_ISNT_E164) + return NSLocalizedString(@"Your phone number is invalid.", nil); + + if (!linphone_core_is_network_reachable(LC)) + return NSLocalizedString(@"There is no network connection available, enable " + @"WIFI or WWAN prior to configure an account", + nil); + + if (err) + LOGW(@"Unhandled error %s", err); + return NSLocalizedString(@"Unknown error, please try again later", nil); +} + +- (void)showErrorPopup:(const char *)err { + UIAlertView *errorView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Account configuration issue", nil) + message:[self stringForError:err] + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Cancel", nil) + otherButtonTitles:nil, nil]; + [errorView show]; +} + +#pragma mark - cbs + +void assistant_link_phone_number_with_account(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, + const char *resp) { + AssistantLinkView *thiz = (__bridge AssistantLinkView *)(linphone_account_creator_get_user_data(creator)); + thiz.waitView.hidden = YES; + if (status == LinphoneAccountCreatorOK) { + thiz.linkAccountView.hidden = thiz.activateSMSView.userInteractionEnabled = YES; + thiz.activateSMSView.hidden = thiz.linkAccountView.userInteractionEnabled = NO; + } else { + [thiz showErrorPopup:resp]; + } +} + +void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, + const char *resp) { + AssistantLinkView *thiz = (__bridge AssistantLinkView *)(linphone_account_creator_get_user_data(creator)); + thiz.waitView.hidden = YES; + if (status == LinphoneAccountCreatorOK) { + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; + } else { + [thiz showErrorPopup:resp]; + } +} + +#pragma mark - other +- (void)updateCountry:(BOOL)force { + NSDictionary *c = [CountryListView countryWithCountryCode:_countryCodeField.text]; + if (c || force) { + [_countryButton setTitle:c ? [c objectForKey:@"name"] : NSLocalizedString(@"Unknown country code", nil) + forState:UIControlStateNormal]; + } +} + +- (IBAction)onCountryCodeFieldChange:(id)sender { + [self updateCountry:NO]; +} + +- (IBAction)onCountryCodeFieldEnd:(id)sender { + [self updateCountry:YES]; +} + +- (IBAction)onCountryClick:(id)sender { + CountryListView *view = VIEW(CountryListView); + [view setDelegate:(id)self]; + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; +} + +- (IBAction)onLinkAccount:(id)sender { + _waitView.hidden = NO; + linphone_account_creator_set_phone_number(account_creator, _phoneField.text.UTF8String, + _countryCodeField.text.UTF8String); + linphone_account_creator_link_phone_number_with_account(account_creator); +} + +- (IBAction)onCheckValidationButton:(id)sender { + _waitView.hidden = NO; + linphone_account_creator_set_activation_code(account_creator, _activationCodeField.text.UTF8String); + linphone_account_creator_activate_phone_number_link(account_creator); +} + +- (IBAction)onDialerClick:(id)sender { + [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; +} + +#pragma mark - select country delegate + +- (void)didSelectCountry:(NSDictionary *)country { + [_countryButton setTitle:[country objectForKey:@"name"] forState:UIControlStateNormal]; + _countryCodeField.text = [country objectForKey:@"code"]; +} + +@end diff --git a/Classes/AssistantView.h b/Classes/AssistantView.h index 15372850a..fc6767511 100644 --- a/Classes/AssistantView.h +++ b/Classes/AssistantView.h @@ -24,6 +24,7 @@ #import "PhoneMainView.h" @interface AssistantView : UIViewController { + @private LinphoneAccountCreator *account_creator; UIView *currentView; @@ -35,6 +36,8 @@ long phone_number_length; } +@property(nonatomic) UICompositeViewDescription *outgoingView; + @property(nonatomic, strong) IBOutlet TPKeyboardAvoidingScrollView *contentView; @property(nonatomic, strong) IBOutlet UIView *waitView; @property(nonatomic, strong) IBOutlet UIButton *backButton; @@ -43,7 +46,6 @@ @property(nonatomic, strong) IBOutlet UIView *createAccountView; @property(nonatomic, strong) IBOutlet UIView *createAccountActivateEmailView; @property(nonatomic, strong) IBOutlet UIView *linphoneLoginView; -@property(strong, nonatomic) IBOutlet UIView *linkAccountView; @property(nonatomic, strong) IBOutlet UIView *loginView; @property(nonatomic, strong) IBOutlet UIView *remoteProvisioningLoginView; @property(strong, nonatomic) IBOutlet UIView *remoteProvisioningView; diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m index a1a32d414..0ba671027 100644 --- a/Classes/AssistantView.m +++ b/Classes/AssistantView.m @@ -23,11 +23,11 @@ #import #import "AssistantView.h" +#import "CountryListView.h" #import "LinphoneManager.h" #import "PhoneMainView.h" -#import "UITextField+DoneButton.h" #import "UIAssistantTextField.h" -#import "CountryListViewController.h" +#import "UITextField+DoneButton.h" #import #import @@ -115,6 +115,8 @@ static UICompositeViewDescription *compositeDescription = nil; [self changeView:_welcomeView back:FALSE animation:FALSE]; } mustRestoreView = NO; + + _outgoingView = DialerView.compositeViewDescription; } - (void)viewWillDisappear:(BOOL)animated { @@ -156,11 +158,6 @@ static UICompositeViewDescription *compositeDescription = nil; assistant_activate_account); linphone_account_creator_cbs_set_is_account_activated(linphone_account_creator_get_callbacks(account_creator), assistant_is_account_activated); - - linphone_account_creator_cbs_set_link_phone_number_with_account(linphone_account_creator_get_callbacks(account_creator), - assistant_link_phone_number_with_account); - linphone_account_creator_cbs_set_activate_phone_number_link(linphone_account_creator_get_callbacks(account_creator), - assistant_activate_phone_number_link); linphone_account_creator_cbs_set_recover_phone_account(linphone_account_creator_get_callbacks(account_creator), assistant_recover_phone_account); } @@ -364,7 +361,7 @@ static UICompositeViewDescription *compositeDescription = nil; if ([self findView:ViewElement_PhoneButton inView:currentView ofType:UIButton.class]) { CTTelephonyNetworkInfo *networkInfo = [CTTelephonyNetworkInfo new]; CTCarrier *carrier = networkInfo.subscriberCellularProvider; - NSDictionary *country = [CountryListViewController countryWithIso:carrier.isoCountryCode]; + NSDictionary *country = [CountryListView countryWithIso:carrier.isoCountryCode]; if (!IPAD) { UISwitch *emailSwitch = (UISwitch *)[self findView:ViewElement_EmailFormView inView:self.contentView ofType:UISwitch.class]; @@ -377,7 +374,7 @@ static UICompositeViewDescription *compositeDescription = nil; for (NSString* lang in [NSLocale preferredLanguages]) { NSUInteger idx = [lang rangeOfString:@"-"].location; idx = (idx == NSNotFound) ? idx = 0 : idx + 1; - if ((country = [CountryListViewController countryWithIso:[lang substringFromIndex:idx]]) != nil) + if ((country = [CountryListView countryWithIso:[lang substringFromIndex:idx]]) != nil) break; } } @@ -494,9 +491,7 @@ static UICompositeViewDescription *compositeDescription = nil; [createPhone showError:[AssistantView errorForStatus:LinphoneAccountCreatorPhoneNumberInvalid] when:^BOOL(NSString *inputEntry) { UIAssistantTextField* countryCodeField = [self findTextField:ViewElement_PhoneCC]; - NSString *prefix = (inputEntry.length > 0 && countryCodeField.text.length > 0) - ? [countryCodeField.text substringFromIndex:1] - : nil; + NSString *prefix = (inputEntry.length > 0) ? countryCodeField.text : nil; LinphoneAccountCreatorStatus s = linphone_account_creator_set_phone_number(account_creator, inputEntry.length > 0 ? inputEntry.UTF8String : NULL, prefix.UTF8String); if (s != LinphoneAccountCreatorOK) { @@ -610,7 +605,10 @@ static UICompositeViewDescription *compositeDescription = nil; switch (state) { case LinphoneRegistrationOk: { _waitView.hidden = true; - [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; + + [LinphoneManager.instance lpConfigSetInt:[NSDate new].timeIntervalSince1970 + forKey:@"must_link_account_time"]; + [PhoneMainView.instance popToView:_outgoingView]; break; } case LinphoneRegistrationNone: @@ -649,6 +647,8 @@ static UICompositeViewDescription *compositeDescription = nil; switch (status) { case LinphoneConfiguringSuccessful: // we successfully loaded a remote provisioned config, go to dialer + [LinphoneManager.instance lpConfigSetInt:[NSDate new].timeIntervalSince1970 + forKey:@"must_link_account_time"]; if (number_of_configs_before < bctbx_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]; @@ -734,9 +734,11 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)isAccountUsed:(LinphoneAccountCreatorStatus)status withResp:(const char *)resp { if (currentView == _linphoneLoginView) { if (status == LinphoneAccountCreatorAccountExistWithAlias) { + _outgoingView = DialerView.compositeViewDescription; [self configureProxyConfig]; } else if (status == LinphoneAccountCreatorAccountExist) { - [self changeView:_linkAccountView back:NO animation:YES]; + _outgoingView = AssistantLinkView.compositeViewDescription; + [self configureProxyConfig]; } else { [self showErrorPopup:resp]; } @@ -786,7 +788,8 @@ void assistant_recover_phone_account(LinphoneAccountCreator *creator, LinphoneAc } } -void assistant_activate_account(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, const char *response) { +void assistant_activate_account(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, + const char *resp) { AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator)); thiz.waitView.hidden = YES; if (status == LinphoneAccountCreatorAccountActivated) { @@ -816,7 +819,7 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc [alert addButtonWithTitle:NSLocalizedString(@"Skip verification", nil) block:^{ [thiz configureProxyConfig]; - [PhoneMainView.instance popToView:DialerView.compositeViewDescription]; + [PhoneMainView.instance popToView:thiz.outgoingView]; }]; [alert show]; } else { @@ -824,28 +827,6 @@ void assistant_is_account_activated(LinphoneAccountCreator *creator, LinphoneAcc } } -void assistant_link_phone_number_with_account(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, - const char *resp) { - AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator)); - thiz.waitView.hidden = YES; - if (status == LinphoneAccountCreatorOK) { - [thiz changeView:thiz.createAccountActivateSMSView back:FALSE animation:TRUE]; - } else { - [thiz showErrorPopup:resp]; - } -} - -void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, - const char *resp) { - AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator)); - thiz.waitView.hidden = YES; - if (status == LinphoneAccountCreatorOK) { - [thiz configureProxyConfig]; - } else { - [thiz showErrorPopup:resp]; - } -} - #pragma mark - UITextFieldDelegate Functions - (void)textFieldDidBeginEditing:(UITextField *)textField { @@ -1066,14 +1047,14 @@ void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, Linph - (IBAction)onCountryCodeClick:(id)sender { mustRestoreView = YES; - CountryListViewController *view = VIEW(CountryListViewController); + CountryListView *view = VIEW(CountryListView); [view setDelegate:(id)self]; [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; } - (void)updateCountry:(BOOL)force { UIAssistantTextField* countryCodeField = [self findTextField:ViewElement_PhoneCC]; - NSDictionary *c = [CountryListViewController countryWithCountryCode:countryCodeField.text]; + NSDictionary *c = [CountryListView countryWithCountryCode:countryCodeField.text]; if (c || force) { UIButton *phoneButton = (UIButton *)[self findView:ViewElement_PhoneButton inView:currentView ofType:UIButton.class]; diff --git a/Classes/Base.lproj/AssistantLinkView.xib b/Classes/Base.lproj/AssistantLinkView.xib new file mode 100644 index 000000000..bc934cda0 --- /dev/null +++ b/Classes/Base.lproj/AssistantLinkView.xib @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Classes/Base.lproj/AssistantViewScreens.xib b/Classes/Base.lproj/AssistantViewScreens.xib index bb784de7b..e010a72b3 100644 --- a/Classes/Base.lproj/AssistantViewScreens.xib +++ b/Classes/Base.lproj/AssistantViewScreens.xib @@ -1,9 +1,9 @@ - + - + @@ -19,7 +19,6 @@ - @@ -1036,151 +1035,6 @@ Once it is done, come back here and click on the button. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Classes/Base.lproj/CountryListViewController.xib b/Classes/Base.lproj/CountryListView.xib similarity index 97% rename from Classes/Base.lproj/CountryListViewController.xib rename to Classes/Base.lproj/CountryListView.xib index 101a9371f..9abd389b5 100755 --- a/Classes/Base.lproj/CountryListViewController.xib +++ b/Classes/Base.lproj/CountryListView.xib @@ -1,11 +1,10 @@ - + - - + diff --git a/Classes/CountryListViewController.h b/Classes/CountryListView.h similarity index 84% rename from Classes/CountryListViewController.h rename to Classes/CountryListView.h index 968364c30..76e49d4b9 100755 --- a/Classes/CountryListViewController.h +++ b/Classes/CountryListView.h @@ -1,5 +1,5 @@ // -// CountryListViewController.h +// CountryListView.h // Country List // // Created by Pradyumna Doddala on 18/12/13. @@ -13,7 +13,7 @@ - (void)didSelectCountry:(NSDictionary *)country; @end -@interface CountryListViewController : UIViewController +@interface CountryListView : UIViewController @property (nonatomic, weak) iddelegate; diff --git a/Classes/CountryListViewController.m b/Classes/CountryListView.m similarity index 96% rename from Classes/CountryListViewController.m rename to Classes/CountryListView.m index 151c92dff..6e1b45a5b 100755 --- a/Classes/CountryListViewController.m +++ b/Classes/CountryListView.m @@ -1,23 +1,23 @@ // -// CountryListViewController.m +// CountryListView.m // Country List // // Created by Pradyumna Doddala on 18/12/13. // Copyright (c) 2013 Pradyumna Doddala. All rights reserved. // -#import "CountryListViewController.h" +#import "CountryListView.h" #import "linphone/linphonecore_utils.h" -@interface CountryListViewController () +@interface CountryListView () @property (strong, nonatomic) IBOutlet UITableView *tableView; @property (strong, nonatomic) NSArray *searchResults; @end -@implementation CountryListViewController +@implementation CountryListView static NSMutableArray * dataRows = nil; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 532cd295e..7683c8e3f 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1446,6 +1446,8 @@ static LinphoneCoreVTable linphonec_vtable = { [self enableProxyPublish:YES]; + [self shouldPresentLinkPopup]; + LOGI(@"Linphone [%s] started on [%s]", linphone_core_get_version(), [[UIDevice currentDevice].model UTF8String]); // Post event @@ -1502,6 +1504,61 @@ static BOOL libStarted = FALSE; } } +void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, const char *resp) { + if (status == LinphoneAccountCreatorAccountExistWithAlias) { + [LinphoneManager.instance lpConfigSetInt:0 forKey:@"must_link_account_time"]; + } else { + LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); + if (cfg) { + DTAlertView *alert = [[DTAlertView alloc] + initWithTitle:NSLocalizedString(@"Link your account", nil) + message:[NSString + stringWithFormat:NSLocalizedString( + @"Link your Linphone.org account %s to your phone number.", + nil), + linphone_address_get_username( + linphone_proxy_config_get_identity_address(cfg))] + delegate:nil + cancelButtonTitle:nil + otherButtonTitles:NSLocalizedString(@"Maybe later", nil), nil]; + [alert addButtonWithTitle:NSLocalizedString(@"Let's go", nil) + block:^(void) { + [PhoneMainView.instance changeCurrentView:AssistantLinkView.compositeViewDescription]; + }]; + [alert show]; + + [LinphoneManager.instance + lpConfigSetInt:[[NSDate date] dateByAddingTimeInterval:[LinphoneManager.instance + lpConfigIntForKey:@"link_account_popup_time" + withDefault:84200]] + .timeIntervalSince1970 + forKey:@"must_link_account_time"]; + } + } +} + +- (void)shouldPresentLinkPopup { + LOGW(@"hello!"); + NSDate *nextTime = + [NSDate dateWithTimeIntervalSince1970:[self lpConfigIntForKey:@"must_link_account_time" withDefault:1]]; + NSDate *now = [NSDate date]; + if (nextTime.timeIntervalSince1970 > 0 && [now earlierDate:nextTime] == nextTime) { + LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC); + if (cfg) { + const char *username = linphone_address_get_username(linphone_proxy_config_get_identity_address(cfg)); + LinphoneAccountCreator *account_creator = linphone_account_creator_new( + 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_is_account_used(linphone_account_creator_get_callbacks(account_creator), + popup_link_account_cb); + linphone_account_creator_set_username(account_creator, username); + linphone_account_creator_is_account_used(account_creator); + } + } +} + - (void)createLinphoneCore { if (theLinphoneCore != nil) { diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index b3122151d..d4c2d0a7d 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -24,26 +24,28 @@ #import "TabBarView.h" #import "AboutView.h" -#import "ChatConversationView.h" +#import "AssistantLinkView.h" +#import "AssistantView.h" +#import "CallIncomingView.h" +#import "CallOutgoingView.h" +#import "CallSideMenuView.h" +#import "CallView.h" #import "ChatConversationCreateView.h" +#import "ChatConversationView.h" #import "ChatsListView.h" #import "ContactDetailsView.h" #import "ContactsListView.h" +#import "CountryListView.h" +#import "DTActionSheet.h" +#import "DTAlertView.h" #import "DialerView.h" +#import "FirstLoginView.h" #import "HistoryDetailsView.h" #import "HistoryListView.h" #import "ImageView.h" -#import "CallView.h" -#import "CallIncomingView.h" -#import "CallOutgoingView.h" -#import "FirstLoginView.h" #import "SettingsView.h" #import "SideMenuView.h" -#import "AssistantView.h" -#import "CallSideMenuView.h" #import "UIConfirmationDialog.h" -#import "DTAlertView.h" -#import "DTActionSheet.h" #import "Utils.h" #define DYNAMIC_CAST(x, cls) \ diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index 5c5064612..3e755f700 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -1,4 +1,6 @@ [app] +#time in second between each link account popup +link_account_popup_time=86400 #Hide in the assistant the button to configure an external SIP account. hide_assistant_custom_account=0 @@ -43,14 +45,13 @@ expiry_time_test=180 [sip] sip_random_port=0 +#whether SIP passwords must be encrypted in configuration storage file +store_ha1_passwd=0 [misc] #by default it is set to 30 by liblinphone history_max_size=-1 -#whether SIP passwords must be encrypted in configuration storage file -store_ha1_passwd=0 - [sound] dtmf_player_amp=0.007 echocancellation=0 diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 14a759bfd..95727d86d 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -79,8 +79,8 @@ 6306440E1BECB08500134C72 /* FirstLoginView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6306440C1BECB08500134C72 /* FirstLoginView.m */; }; 6308F9C51BF0DD6600D1234B /* XMLRPCHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 6308F9C41BF0DD6600D1234B /* XMLRPCHelper.m */; }; 630CF5571AF7CE1500539F7A /* UITextField+DoneButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 630CF5561AF7CE1500539F7A /* UITextField+DoneButton.m */; }; - 631098491D4660580041F2B3 /* CountryListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 631098481D4660580041F2B3 /* CountryListViewController.m */; }; - 631098521D4660630041F2B3 /* CountryListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 631098501D4660630041F2B3 /* CountryListViewController.xib */; }; + 631098491D4660580041F2B3 /* CountryListView.m in Sources */ = {isa = PBXBuildFile; fileRef = 631098481D4660580041F2B3 /* CountryListView.m */; }; + 631098521D4660630041F2B3 /* CountryListView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 631098501D4660630041F2B3 /* CountryListView.xib */; }; 63130FB21C1ED06900371918 /* SideMenuView~ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63130FB01C1ED06900371918 /* SideMenuView~ipad.xib */; }; 631348301B6F7B6600C6BDCB /* UIRoundBorderedButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6313482F1B6F7B6600C6BDCB /* UIRoundBorderedButton.m */; }; 631348321B6FA53300C6BDCB /* rootca.pem in Resources */ = {isa = PBXBuildFile; fileRef = 631348311B6FA53300C6BDCB /* rootca.pem */; }; @@ -91,6 +91,7 @@ 633756451B67D2B200E21BAD /* SideMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 633756431B67D2B100E21BAD /* SideMenuView.m */; }; 633888451BFB2C49001D5E7B /* HPGrowingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 633888421BFB2C49001D5E7B /* HPGrowingTextView.m */; }; 633888461BFB2C49001D5E7B /* HPTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = 633888441BFB2C49001D5E7B /* HPTextViewInternal.m */; }; + 633E41821D74259000320475 /* AssistantLinkView.m in Sources */ = {isa = PBXBuildFile; fileRef = 633E41801D74258F00320475 /* AssistantLinkView.m */; }; 633FED9C1D3CD5590014B822 /* add_field_default.png in Resources */ = {isa = PBXBuildFile; fileRef = 633FEBE21D3CD5570014B822 /* add_field_default.png */; }; 633FED9D1D3CD5590014B822 /* add_field_default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 633FEBE31D3CD5570014B822 /* add_field_default@2x.png */; }; 633FED9E1D3CD5590014B822 /* add_field_over.png in Resources */ = {isa = PBXBuildFile; fileRef = 633FEBE41D3CD5570014B822 /* add_field_over.png */; }; @@ -649,6 +650,7 @@ 63E27A5B1C51392A00D332AE /* libmatroska2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 63E27A471C50EA7A00D332AE /* libmatroska2.a */; }; 63E59A3F1ADE70D900646FB3 /* InAppProductsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E59A3E1ADE70D900646FB3 /* InAppProductsManager.m */; }; 63E802DB1C625AEF000D5509 /* (null) in Resources */ = {isa = PBXBuildFile; }; + 63EC8D391D7438660066547B /* AssistantLinkView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63EC8D3B1D7438660066547B /* AssistantLinkView.xib */; }; 63F024B91C88792D00EACF1C /* libbctoolbox-tester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 63F024B81C88792D00EACF1C /* libbctoolbox-tester.a */; }; 63F1DF441BCE618E00EDED90 /* UIAddressTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 63F1DF431BCE618E00EDED90 /* UIAddressTextField.m */; }; 63F1DF4B1BCE983200EDED90 /* CallConferenceTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63F1DF4A1BCE983200EDED90 /* CallConferenceTableView.m */; }; @@ -992,9 +994,9 @@ 6308F9C41BF0DD6600D1234B /* XMLRPCHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMLRPCHelper.m; path = Utils/XMLRPCHelper.m; sourceTree = ""; }; 630CF5551AF7CE1500539F7A /* UITextField+DoneButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextField+DoneButton.h"; sourceTree = ""; }; 630CF5561AF7CE1500539F7A /* UITextField+DoneButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITextField+DoneButton.m"; sourceTree = ""; }; - 631098471D4660580041F2B3 /* CountryListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CountryListViewController.h; sourceTree = ""; }; - 631098481D4660580041F2B3 /* CountryListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountryListViewController.m; sourceTree = ""; }; - 631098511D4660630041F2B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CountryListViewController.xib; sourceTree = ""; }; + 631098471D4660580041F2B3 /* CountryListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CountryListView.h; sourceTree = ""; }; + 631098481D4660580041F2B3 /* CountryListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountryListView.m; sourceTree = ""; }; + 631098511D4660630041F2B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CountryListView.xib; sourceTree = ""; }; 63130FB11C1ED06900371918 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Base.lproj/SideMenuView~ipad.xib"; sourceTree = ""; }; 6313482E1B6F7B6600C6BDCB /* UIRoundBorderedButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRoundBorderedButton.h; sourceTree = ""; }; 6313482F1B6F7B6600C6BDCB /* UIRoundBorderedButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIRoundBorderedButton.m; sourceTree = ""; }; @@ -1010,6 +1012,8 @@ 633888431BFB2C49001D5E7B /* HPTextViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HPTextViewInternal.h; sourceTree = ""; }; 633888441BFB2C49001D5E7B /* HPTextViewInternal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HPTextViewInternal.m; sourceTree = ""; }; 633E388219FFB0F400936D1C /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + 633E417F1D74258F00320475 /* AssistantLinkView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssistantLinkView.h; sourceTree = ""; }; + 633E41801D74258F00320475 /* AssistantLinkView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AssistantLinkView.m; sourceTree = ""; }; 633FEBE21D3CD5570014B822 /* add_field_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = add_field_default.png; sourceTree = ""; }; 633FEBE31D3CD5570014B822 /* add_field_default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "add_field_default@2x.png"; sourceTree = ""; }; 633FEBE41D3CD5570014B822 /* add_field_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = add_field_over.png; sourceTree = ""; }; @@ -1567,6 +1571,7 @@ 63E59A3D1ADE6ECB00646FB3 /* InAppProductsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InAppProductsManager.h; sourceTree = ""; }; 63E59A3E1ADE70D900646FB3 /* InAppProductsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InAppProductsManager.m; sourceTree = ""; }; 63EA4C941B50189D00922857 /* libmswebrtc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmswebrtc.a; path = "liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmswebrtc.a"; sourceTree = ""; }; + 63EC8D3A1D7438660066547B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AssistantLinkView.xib; sourceTree = ""; }; 63EEE4091BBA9B110087D3AF /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = usr/lib/libxml2.tbd; sourceTree = SDKROOT; }; 63EEE40B1BBA9B1B0087D3AF /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; 63EEE40D1BBA9B250087D3AF /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; @@ -1945,10 +1950,10 @@ children = ( 22E0A81D111C44E100B04932 /* AboutView.h */, 22E0A81C111C44E100B04932 /* AboutView.m */, - 5707425F1D5A09B8004B9C84 /* ShopView.m */, - 570742601D5A09B8004B9C84 /* ShopView.h */, 636316D31A1DEBCB0009B839 /* AboutView.xib */, - 570742561D5A0691004B9C84 /* ShopView.xib */, + 633E417F1D74258F00320475 /* AssistantLinkView.h */, + 633E41801D74258F00320475 /* AssistantLinkView.m */, + 63EC8D3B1D7438660066547B /* AssistantLinkView.xib */, D350F20B15A43BB100149E54 /* AssistantView.h */, D350F20C15A43BB100149E54 /* AssistantView.m */, D38187E015FE348A00C3EDCA /* AssistantView.xib */, @@ -1995,9 +2000,9 @@ D35497FB15875372000081D8 /* ContactsListView.h */, D35497FC15875372000081D8 /* ContactsListView.m */, D38187C015FE342800C3EDCA /* ContactsListView.xib */, - 631098471D4660580041F2B3 /* CountryListViewController.h */, - 631098481D4660580041F2B3 /* CountryListViewController.m */, - 631098501D4660630041F2B3 /* CountryListViewController.xib */, + 631098471D4660580041F2B3 /* CountryListView.h */, + 631098481D4660580041F2B3 /* CountryListView.m */, + 631098501D4660630041F2B3 /* CountryListView.xib */, 22F2508B107141E100AC9B3F /* DialerView.h */, 22F2508C107141E100AC9B3F /* DialerView.m */, D38187C415FE345B00C3EDCA /* DialerView.xib */, @@ -2037,6 +2042,9 @@ D35E759C159460B50066B1C1 /* SettingsView.h */, D35E759D159460B50066B1C1 /* SettingsView.m */, 636316D61A1DEC650009B839 /* SettingsView.xib */, + 570742601D5A09B8004B9C84 /* ShopView.h */, + 5707425F1D5A09B8004B9C84 /* ShopView.m */, + 570742561D5A0691004B9C84 /* ShopView.xib */, 633756371B67BAF400E21BAD /* SideMenuTableView.h */, 633756381B67BAF400E21BAD /* SideMenuTableView.m */, 633756421B67D2B100E21BAD /* SideMenuView.h */, @@ -3498,7 +3506,7 @@ 633FEDC91D3CD5590014B822 /* call_missed@2x.png in Resources */, 633FEEAE1D3CD55A0014B822 /* numpad_2_over@2x.png in Resources */, 633FEDB51D3CD5590014B822 /* call_alt_back_disabled@2x.png in Resources */, - 631098521D4660630041F2B3 /* CountryListViewController.xib in Resources */, + 631098521D4660630041F2B3 /* CountryListView.xib in Resources */, 633FEF271D3CD55A0014B822 /* route_bluetooth_selected@2x.png in Resources */, 633FEE111D3CD5590014B822 /* chat_list_indicator~ipad@2x.png in Resources */, 633FEEFC1D3CD55A0014B822 /* options_add_call_default.png in Resources */, @@ -3590,6 +3598,7 @@ 633FEDE31D3CD5590014B822 /* call_status_incoming@2x.png in Resources */, 633FEE821D3CD5590014B822 /* led_disconnected.png in Resources */, 633FEDB01D3CD5590014B822 /* call_add_disabled.png in Resources */, + 63EC8D391D7438660066547B /* AssistantLinkView.xib in Resources */, 633FEE971D3CD55A0014B822 /* micro_disabled@2x.png in Resources */, D38187CD15FE346700C3EDCA /* HistoryDetailsView.xib in Resources */, 633FEEA21D3CD55A0014B822 /* numpad_0~ipad@2x.png in Resources */, @@ -3889,7 +3898,7 @@ D3F26BF115986B73005F9CAB /* CallIncomingView.m in Sources */, D31B4B21159876C0002E6C72 /* UICompositeView.m in Sources */, D31AAF5E159B3919002C6B02 /* CallPausedTableView.m in Sources */, - 631098491D4660580041F2B3 /* CountryListViewController.m in Sources */, + 631098491D4660580041F2B3 /* CountryListView.m in Sources */, D32B9DFC15A2F131000B6DEC /* FastAddressBook.m in Sources */, D350F20E15A43BB100149E54 /* AssistantView.m in Sources */, D3F795D615A582810077328B /* ChatConversationView.m in Sources */, @@ -3913,6 +3922,7 @@ 6306440E1BECB08500134C72 /* FirstLoginView.m in Sources */, D3807FC315C28940005BE9BC /* DCRoundSwitchOutlineLayer.m in Sources */, D3807FC515C28940005BE9BC /* DCRoundSwitchToggleLayer.m in Sources */, + 633E41821D74259000320475 /* AssistantLinkView.m in Sources */, D3807FE815C2894A005BE9BC /* IASKAppSettingsViewController.m in Sources */, D3807FEA15C2894A005BE9BC /* IASKAppSettingsWebViewController.m in Sources */, D3807FEC15C2894A005BE9BC /* IASKSpecifierValuesViewController.m in Sources */, @@ -4062,12 +4072,12 @@ name = InfoPlist.strings; sourceTree = ""; }; - 631098501D4660630041F2B3 /* CountryListViewController.xib */ = { + 631098501D4660630041F2B3 /* CountryListView.xib */ = { isa = PBXVariantGroup; children = ( 631098511D4660630041F2B3 /* Base */, ); - name = CountryListViewController.xib; + name = CountryListView.xib; sourceTree = ""; }; 63130FB01C1ED06900371918 /* SideMenuView~ipad.xib */ = { @@ -4261,6 +4271,14 @@ name = ChatConversationCreateView.xib; sourceTree = ""; }; + 63EC8D3B1D7438660066547B /* AssistantLinkView.xib */ = { + isa = PBXVariantGroup; + children = ( + 63EC8D3A1D7438660066547B /* Base */, + ); + name = AssistantLinkView.xib; + sourceTree = ""; + }; 63F1DF531BCE986A00EDED90 /* UICallConferenceCell.xib */ = { isa = PBXVariantGroup; children = ( diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 9928d61e8..36a73fe52 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 9928d61e846845592cf1b0f5895511ac0b331aac +Subproject commit 36a73fe528a890cd8715a50288fe50d2d5fbdf59 diff --git a/submodules/linphone b/submodules/linphone index e4bc29cb9..2aa8e4693 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e4bc29cb99cf035cca84f00064f40caff333c6a5 +Subproject commit 2aa8e46934e7df2e5ac06bbdaf1e0ce4bcc913bc