Changes & fixes required for new SHA256 accounts and previously created MD5 ones
This commit is contained in:
parent
a9949c660c
commit
9cab87e847
3 changed files with 37 additions and 16 deletions
|
@ -40,7 +40,7 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
||||||
private ClipboardManager mClipboard;
|
private ClipboardManager mClipboard;
|
||||||
|
|
||||||
private int mActivationCodeLength;
|
private int mActivationCodeLength;
|
||||||
private boolean mIsLinking;
|
private boolean mIsLinking = false, mIsLogin = false;
|
||||||
private AccountCreatorListenerStub mListener;
|
private AccountCreatorListenerStub mListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,13 +50,14 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
||||||
setContentView(R.layout.assistant_phone_account_validation);
|
setContentView(R.layout.assistant_phone_account_validation);
|
||||||
|
|
||||||
if (getIntent() != null && getIntent().getBooleanExtra("isLoginVerification", false)) {
|
if (getIntent() != null && getIntent().getBooleanExtra("isLoginVerification", false)) {
|
||||||
findViewById(R.id.title_account_creation).setVisibility(View.VISIBLE);
|
findViewById(R.id.title_account_login).setVisibility(View.VISIBLE);
|
||||||
|
mIsLogin = true;
|
||||||
} else if (getIntent() != null
|
} else if (getIntent() != null
|
||||||
&& getIntent().getBooleanExtra("isLinkingVerification", false)) {
|
&& getIntent().getBooleanExtra("isLinkingVerification", false)) {
|
||||||
mIsLinking = true;
|
mIsLinking = true;
|
||||||
findViewById(R.id.title_account_linking).setVisibility(View.VISIBLE);
|
findViewById(R.id.title_account_linking).setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
findViewById(R.id.title_account_activation).setVisibility(View.VISIBLE);
|
findViewById(R.id.title_account_creation).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
mActivationCodeLength =
|
mActivationCodeLength =
|
||||||
|
@ -93,6 +94,8 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
||||||
AccountCreator.Status status;
|
AccountCreator.Status status;
|
||||||
if (mIsLinking) {
|
if (mIsLinking) {
|
||||||
status = mAccountCreator.activateAlias();
|
status = mAccountCreator.activateAlias();
|
||||||
|
} else if (mIsLogin) {
|
||||||
|
status = mAccountCreator.loginLinphoneAccount();
|
||||||
} else {
|
} else {
|
||||||
status = mAccountCreator.activateAccount();
|
status = mAccountCreator.activateAccount();
|
||||||
}
|
}
|
||||||
|
@ -101,7 +104,10 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
||||||
"[Phone Account Validation] "
|
"[Phone Account Validation] "
|
||||||
+ (mIsLinking
|
+ (mIsLinking
|
||||||
? "linkAccount"
|
? "linkAccount"
|
||||||
: "activateAccount" + " returned ")
|
: (mIsLogin
|
||||||
|
? "loginLinphoneAccount"
|
||||||
|
: "activateAccount")
|
||||||
|
+ " returned ")
|
||||||
+ status);
|
+ status);
|
||||||
mFinishCreation.setEnabled(true);
|
mFinishCreation.setEnabled(true);
|
||||||
showGenericErrorDialog(status);
|
showGenericErrorDialog(status);
|
||||||
|
@ -118,12 +124,7 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
||||||
if (status.equals(AccountCreator.Status.AccountActivated)) {
|
if (status.equals(AccountCreator.Status.AccountActivated)) {
|
||||||
createProxyConfigAndLeaveAssistant();
|
createProxyConfigAndLeaveAssistant();
|
||||||
} else {
|
} else {
|
||||||
mFinishCreation.setEnabled(true);
|
onError(status);
|
||||||
showGenericErrorDialog(status);
|
|
||||||
|
|
||||||
if (status.equals(AccountCreator.Status.WrongActivationCode)) {
|
|
||||||
// TODO do something so the server re-send a SMS
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,12 +136,20 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
||||||
LinphonePreferences.instance().setLinkPopupTime("");
|
LinphonePreferences.instance().setLinkPopupTime("");
|
||||||
goToLinphoneActivity();
|
goToLinphoneActivity();
|
||||||
} else {
|
} else {
|
||||||
mFinishCreation.setEnabled(true);
|
onError(status);
|
||||||
showGenericErrorDialog(status);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (status.equals(AccountCreator.Status.WrongActivationCode)) {
|
@Override
|
||||||
// TODO do something so the server re-send a SMS
|
public void onLoginLinphoneAccount(
|
||||||
}
|
AccountCreator creator, AccountCreator.Status status, String resp) {
|
||||||
|
Log.i(
|
||||||
|
"[Phone Account Validation] onLoginLinphoneAccount status is "
|
||||||
|
+ status);
|
||||||
|
if (status.equals(AccountCreator.Status.RequestOk)) {
|
||||||
|
createProxyConfigAndLeaveAssistant();
|
||||||
|
} else {
|
||||||
|
onError(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -175,4 +184,13 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
mAccountCreator.removeListener(mListener);
|
mAccountCreator.removeListener(mListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onError(AccountCreator.Status status) {
|
||||||
|
mFinishCreation.setEnabled(true);
|
||||||
|
showGenericErrorDialog(status);
|
||||||
|
|
||||||
|
if (status.equals(AccountCreator.Status.WrongActivationCode)) {
|
||||||
|
// TODO do something so the server re-send a SMS
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,6 +240,9 @@ public class AccountSettingsFragment extends SettingsFragment {
|
||||||
if (mAuthInfo != null) {
|
if (mAuthInfo != null) {
|
||||||
mAuthInfo.setHa1(null);
|
mAuthInfo.setHa1(null);
|
||||||
mAuthInfo.setPassword(newValue);
|
mAuthInfo.setPassword(newValue);
|
||||||
|
// Reset algorithm to generate correct hash depending on
|
||||||
|
// algorithm set in next to come 401
|
||||||
|
mAuthInfo.setAlgorithm(null);
|
||||||
Core core = LinphoneManager.getCore();
|
Core core = LinphoneManager.getCore();
|
||||||
if (core != null) {
|
if (core != null) {
|
||||||
core.addAuthInfo(mAuthInfo);
|
core.addAuthInfo(mAuthInfo);
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
android:paddingTop="10dp"/>
|
android:paddingTop="10dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title_account_activation"
|
android:id="@+id/title_account_login"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:text="@string/assistant_login_linphone"
|
android:text="@string/assistant_login_linphone"
|
||||||
style="@style/standard_text_font"
|
style="@style/standard_text_font"
|
||||||
|
|
Loading…
Reference in a new issue