diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m
index 8b65ed5c2..8ce2bd3fb 100644
--- a/Classes/AssistantView.m
+++ b/Classes/AssistantView.m
@@ -167,7 +167,8 @@ static UICompositeViewDescription *compositeDescription = nil;
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);
}
- (void)loadAssistantConfig:(NSString *)rcFilename {
NSString *fullPath = [@"file://" stringByAppendingString:[LinphoneManager bundleFile:rcFilename]];
@@ -189,22 +190,17 @@ static UICompositeViewDescription *compositeDescription = nil;
}
+ (NSString *)errorForStatus:(LinphoneAccountCreatorStatus)status {
- BOOL usePhoneNumber = [LinphoneManager.instance lpConfigBoolForKey:@"use_phone_number" inSection:@"assistant"];
switch (status) {
case LinphoneAccountCreatorEmailInvalid:
return NSLocalizedString(@"Invalid email.", nil);
case LinphoneAccountCreatorUsernameInvalid:
- return usePhoneNumber ? NSLocalizedString(@"Invalid phone number.", nil)
- : NSLocalizedString(@"Invalid username.", nil);
+ return NSLocalizedString(@"Invalid username.", nil);
case LinphoneAccountCreatorUsernameTooShort:
- return usePhoneNumber ? NSLocalizedString(@"Phone number too short.", nil)
- : NSLocalizedString(@"Username too short.", nil);
+ return NSLocalizedString(@"Username too short.", nil);
case LinphoneAccountCreatorUsernameTooLong:
- return usePhoneNumber ? NSLocalizedString(@"Phone number too long.", nil)
- : NSLocalizedString(@"Username too long.", nil);
+ return NSLocalizedString(@"Username too long.", nil);
case LinphoneAccountCreatorUsernameInvalidSize:
- return usePhoneNumber ? NSLocalizedString(@"Phone number length invalid.", nil)
- : NSLocalizedString(@"Username length invalid.", nil);
+ return NSLocalizedString(@"Username length invalid.", nil);
case LinphoneAccountCreatorPhoneNumberTooShort:
case LinphoneAccountCreatorPhoneNumberTooLong:
return nil; /* this is not an error, just user has to finish typing */
@@ -226,6 +222,7 @@ static UICompositeViewDescription *compositeDescription = nil;
return NSLocalizedString(@"Unsupported transport", nil);
case LinphoneAccountCreatorAccountCreated:
case LinphoneAccountCreatorAccountExist:
+ case LinphoneAccountCreatorAccountExistWithAlias:
case LinphoneAccountCreatorAccountNotCreated:
case LinphoneAccountCreatorAccountNotExist:
case LinphoneAccountCreatorAccountNotActivated:
@@ -276,21 +273,6 @@ static UICompositeViewDescription *compositeDescription = nil;
new_config = linphone_account_creator_configure(account_creator);
if (new_config) {
- BOOL usePhoneNumber = [LinphoneManager.instance lpConfigBoolForKey:@"use_phone_number"];
- if (usePhoneNumber) {
- char *user = linphone_proxy_config_normalize_phone_number(
- new_config, linphone_account_creator_get_username(account_creator));
- if (user) {
- LinphoneAddress *addr = linphone_address_clone(linphone_proxy_config_get_identity_address(new_config));
- linphone_address_set_username(addr, user);
- linphone_proxy_config_edit(new_config);
- linphone_proxy_config_set_identity_address(new_config, addr);
- linphone_proxy_config_done(new_config);
- linphone_address_destroy(addr);
- ms_free(user);
- }
- }
-
[lm configurePushTokenForProxyConfig:new_config];
linphone_core_set_default_proxy_config(LC, new_config);
// reload address book to prepend proxy config domain to contacts' phone number
@@ -318,8 +300,6 @@ static UICompositeViewDescription *compositeDescription = nil;
_backButton.hidden = (view == _welcomeView);
- [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"];
@@ -462,21 +442,6 @@ static UICompositeViewDescription *compositeDescription = nil;
phone_number_length = 0;
}
-- (void)displayUsernameAsPhoneOrUsername {
- BOOL usePhoneNumber = [LinphoneManager.instance lpConfigBoolForKey:@"use_phone_number"];
-
- NSString *label = usePhoneNumber ? NSLocalizedString(@"PHONE NUMBER", nil) : NSLocalizedString(@"USERNAME", nil);
- [self findLabel:ViewElement_Username_Label].text = label;
-
- UITextField *text = [self findTextField:ViewElement_Username];
- if (usePhoneNumber) {
- text.keyboardType = UIKeyboardTypePhonePad;
- [text addDoneButton];
- } else {
- text.keyboardType = UIKeyboardTypeDefault;
- }
-}
-
+ (void)cleanTextField:(UIView *)view {
if ([view isKindOfClass:UIAssistantTextField.class]) {
[(UIAssistantTextField *)view setText:@""];
@@ -719,20 +684,36 @@ static UICompositeViewDescription *compositeDescription = nil;
[errorView show];
}
+- (void)isAccountUsed:(LinphoneAccountCreatorStatus)status {
+ if (currentView == _createAccountView) {
+ if (status == LinphoneAccountCreatorAccountExist || status == LinphoneAccountCreatorAccountExistWithAlias) {
+ ViewElement ve = ([self findTextField:ViewElement_Username].isVisible) ? ViewElement_Username : ViewElement_Phone;
+ [[self findTextField:ve] showError:NSLocalizedString(@"This account already exists.", nil)];
+ [self findButton:ViewElement_NextButton].enabled = NO;
+ } else if (status == LinphoneAccountCreatorAccountNotExist) {
+ linphone_account_creator_create_account(account_creator);
+ } else {
+ [self genericError];
+ }
+ } else if (currentView == _linphoneLoginView) {
+ [self findTextField:ViewElement_PhoneCC].enabled =
+ [self findTextField:ViewElement_Phone].enabled =
+ [self findTextField:ViewElement_DisplayName].enabled =
+ [self findTextField:ViewElement_Password].enabled = (status == LinphoneAccountCreatorAccountExist);
+ if (status == LinphoneAccountCreatorAccountExistWithAlias) {
+ [self findButton:ViewElement_NextButton].enabled = YES;
+ } else {
+ [self shouldEnableNextButton];
+ }
+ }
+}
+
#pragma mark - Account creator callbacks
void assistant_is_account_used(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) {
AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator));
thiz.waitView.hidden = YES;
- if (status == LinphoneAccountCreatorAccountExist) {
- ViewElement ve = ([thiz findTextField:ViewElement_Username].isVisible) ? ViewElement_Username : ViewElement_Phone;
- [[thiz findTextField:ve] showError:NSLocalizedString(@"This account already exists.", nil)];
- [thiz findButton:ViewElement_NextButton].enabled = NO;
- } else if (status == LinphoneAccountCreatorAccountNotExist) {
- linphone_account_creator_create_account(thiz->account_creator);
- } else {
- [thiz genericError];
- }
+ [thiz isAccountUsed:status];
}
void assistant_create_account(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) {
@@ -749,6 +730,16 @@ void assistant_create_account(LinphoneAccountCreator *creator, LinphoneAccountCr
}
}
+void assistant_recover_phone_account(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) {
+ 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 genericError];
+ }
+}
+
void assistant_activate_account(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status) {
AssistantView *thiz = (__bridge AssistantView *)(linphone_account_creator_get_user_data(creator));
thiz.waitView.hidden = YES;
@@ -836,6 +827,11 @@ void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, Linph
- (void)textFieldDidEndEditing:(UITextField *)textField {
UIAssistantTextField *atf = (UIAssistantTextField *)textField;
[atf textFieldDidEndEditing:atf];
+
+ if (textField.tag == ViewElement_Username && currentView == _linphoneLoginView) {
+ linphone_account_creator_is_account_used(account_creator);
+ }
+
[self shouldEnableNextButton];
}
@@ -950,7 +946,12 @@ void assistant_activate_phone_number_link(LinphoneAccountCreator *creator, Linph
if (phone.length > 0) {
linphone_account_creator_link_phone_number_with_account(account_creator);
} else {
- [self configureProxyConfig];
+ if ((linphone_account_creator_get_phone_number(account_creator) != NULL)
+ && [self findTextField:ViewElement_Password].text.length == 0) {
+ linphone_account_creator_recover_phone_account(account_creator);
+ } else {
+ [self configureProxyConfig];
+ }
}
});
}
diff --git a/Classes/Base.lproj/AssistantViewScreens.xib b/Classes/Base.lproj/AssistantViewScreens.xib
index fbe8e52c3..8bea0f8db 100644
--- a/Classes/Base.lproj/AssistantViewScreens.xib
+++ b/Classes/Base.lproj/AssistantViewScreens.xib
@@ -743,7 +743,7 @@ Once it is done, come back here and click on the button.
-
-
+
@@ -866,7 +866,7 @@ Once it is done, come back here and click on the button.
-
+
@@ -880,7 +880,7 @@ Once it is done, come back here and click on the button.
-
+
diff --git a/Classes/FirstLoginView.m b/Classes/FirstLoginView.m
index feb0662f8..defce70dc 100644
--- a/Classes/FirstLoginView.m
+++ b/Classes/FirstLoginView.m
@@ -154,6 +154,7 @@ static UICompositeViewDescription *compositeDescription = nil;
return NSLocalizedString(@"Unsupported transport", nil);
case LinphoneAccountCreatorAccountCreated:
case LinphoneAccountCreatorAccountExist:
+ case LinphoneAccountCreatorAccountExistWithAlias:
case LinphoneAccountCreatorAccountNotCreated:
case LinphoneAccountCreatorAccountNotExist:
case LinphoneAccountCreatorAccountNotActivated:
diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h
index bc49613bf..3de172972 100644
--- a/Classes/LinphoneManager.h
+++ b/Classes/LinphoneManager.h
@@ -18,7 +18,6 @@
*/
#import
-#import
#import
#import
#import
diff --git a/Classes/LinphoneUI/UIAssistantTextField.m b/Classes/LinphoneUI/UIAssistantTextField.m
index b463f1f3d..0d29ee3f4 100644
--- a/Classes/LinphoneUI/UIAssistantTextField.m
+++ b/Classes/LinphoneUI/UIAssistantTextField.m
@@ -13,6 +13,7 @@
INIT_WITH_COMMON_CF {
self.delegate = self;
+ self.enabled = self.isEnabled; //force refresh bg color
return self;
}
@@ -52,7 +53,8 @@ INIT_WITH_COMMON_CF {
}
- (void)setEnabled:(BOOL)enabled {
- self.backgroundColor = [self.backgroundColor colorWithAlphaComponent:enabled?1:0.5];
+ [super setEnabled:enabled];
+ self.backgroundColor = [self.backgroundColor colorWithAlphaComponent:enabled?1:0.3];
}
#pragma mark - UITextFieldDelegate Functions
diff --git a/Classes/LinphoneUI/UISpeakerButton.m b/Classes/LinphoneUI/UISpeakerButton.m
index ec073c572..976e62339 100644
--- a/Classes/LinphoneUI/UISpeakerButton.m
+++ b/Classes/LinphoneUI/UISpeakerButton.m
@@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#import
#import
#import "UISpeakerButton.h"
#import "Utils.h"
diff --git a/Resources/assistant_linphone_create.rc b/Resources/assistant_linphone_create.rc
index 130a83dbf..227344e7c 100644
--- a/Resources/assistant_linphone_create.rc
+++ b/Resources/assistant_linphone_create.rc
@@ -27,7 +27,7 @@
-1
64
1
- ^[a-z0-9_.\-]*$
- https://sip3.linphone.org:444/xmlrpc.php
+ ^[a-z0-9+_.\-]*$
+ https://sip3.linphone.org:444/wizard.php
diff --git a/Resources/assistant_linphone_existing.rc b/Resources/assistant_linphone_existing.rc
index e16a435df..4d9fd9481 100644
--- a/Resources/assistant_linphone_existing.rc
+++ b/Resources/assistant_linphone_existing.rc
@@ -27,7 +27,7 @@
-1
64
1
- ^[a-z0-9_.\-]*$
- https://sip3.linphone.org:444/xmlrpc.php
+ ^[a-z0-9+_.\-]*$
+ https://sip3.linphone.org:444/wizard.php
diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj
index 91db2122e..7be993c8a 100755
--- a/linphone.xcodeproj/project.pbxproj
+++ b/linphone.xcodeproj/project.pbxproj
@@ -4401,7 +4401,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -4490,7 +4489,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -4579,7 +4577,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_OBJC_ARC = YES;
@@ -4667,7 +4664,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_OBJC_ARC = YES;
diff --git a/linphone.xcodeproj/xcshareddata/xcschemes/linphone.xcscheme b/linphone.xcodeproj/xcshareddata/xcschemes/linphone.xcscheme
index bcc352bc2..0fc774fbc 100644
--- a/linphone.xcodeproj/xcshareddata/xcschemes/linphone.xcscheme
+++ b/linphone.xcodeproj/xcshareddata/xcschemes/linphone.xcscheme
@@ -1,6 +1,6 @@