Other assistant fixes

This commit is contained in:
Sylvain Berfini 2019-06-05 11:50:10 +02:00
parent 0c86dd40ea
commit 1822c51d3e
3 changed files with 98 additions and 64 deletions

View file

@ -10,6 +10,20 @@ Group changes to describe their impact on the project, as follows:
Fixed for any bug fixes.
Security to invite users to upgrade in case of vulnerabilities.
## [4.1.1] - 2019-06-05
### Changed
- Improved text based setting validation in preferences
- Auto refresh register when app leaves foreground if state is failed
### Fixed
- First call not sending video / displaying preview right after granting permission for camera
- Video call overlay return to app crash
- Core not choosing a new default proxy config after deleting the previous one
- Some contacts not being visible
- Phone number account creation "username too short" error message when not using alias
- H264 issue on some Huawei devices
## [4.1.0] - 2019-05-03
### Added

View file

@ -53,7 +53,7 @@ import org.linphone.settings.LinphonePreferences;
import org.linphone.utils.LinphoneUtils;
public class CreateAccountFragment extends Fragment
implements CompoundButton.OnCheckedChangeListener, OnClickListener, AccountCreatorListener {
implements CompoundButton.OnCheckedChangeListener, AccountCreatorListener {
private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]");
private EditText mPhoneNumberEdit,
@ -149,8 +149,35 @@ public class CreateAccountFragment extends Fragment
mPhoneNumberLayout.setVisibility(View.VISIBLE);
mPhoneNumberInfo.setOnClickListener(this);
mSelectCountry.setOnClickListener(this);
mPhoneNumberInfo.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
if (mLinkAccount) {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
.setMessage(
getString(R.string.phone_number_link_info_content)
+ "\n"
+ getString(
R.string
.phone_number_link_info_content_already_account))
.show();
} else {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
.setMessage(getString(R.string.phone_number_info_content))
.show();
}
}
});
mSelectCountry.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
AssistantActivity.instance().displayCountryChooser();
}
});
DialPlan c = AssistantActivity.instance().country;
if (c != null) {
@ -229,7 +256,17 @@ public class CreateAccountFragment extends Fragment
mEmailLayout.setVisibility(View.GONE);
mSkip.setVisibility(View.VISIBLE);
mSkip.setOnClickListener(this);
mSkip.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
if (getArguments().getBoolean("LinkFromPref")) {
AssistantActivity.instance().finish();
} else {
AssistantActivity.instance().success();
}
}
});
mCreateAccount.setText(getResources().getString(R.string.link_account));
mAssisstantTitle.setText(getResources().getString(R.string.link_account));
@ -241,7 +278,28 @@ public class CreateAccountFragment extends Fragment
addUsernameHandler(mUsernameEdit);
mCreateAccount.setEnabled(true);
mCreateAccount.setOnClickListener(this);
mCreateAccount.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
mCreateAccount.setEnabled(false);
if (mLinkAccount) {
addAlias();
} else {
if (mUseEmail.isChecked()) mAccountCreator.setPhoneNumber(null, null);
if (mAccountCreator.getUsername() != null
&& mAccountCreator.getUsername().length() > 0) {
mAccountCreator.isAccountExist();
} else {
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForUsernameStatus(
AccountCreator.UsernameStatus.TooShort),
AssistantActivity.instance());
mCreateAccount.setEnabled(true);
}
}
}
});
return view;
}
@ -252,14 +310,6 @@ public class CreateAccountFragment extends Fragment
mAccountCreator.setListener(null);
}
private String getUsername() {
if (mUsernameEdit != null) {
String username = mUsernameEdit.getText().toString();
return username.toLowerCase(Locale.getDefault());
}
return null;
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView.getId() == R.id.use_username) {
@ -304,54 +354,6 @@ public class CreateAccountFragment extends Fragment
}
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.select_country) {
AssistantActivity.instance().displayCountryChooser();
} else if (id == R.id.assistant_skip) {
if (getArguments().getBoolean("LinkFromPref")) {
AssistantActivity.instance().finish();
} else {
AssistantActivity.instance().success();
}
} else if (id == R.id.info_phone_number) {
if (mLinkAccount) {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
.setMessage(
getString(R.string.phone_number_link_info_content)
+ "\n"
+ getString(
R.string
.phone_number_link_info_content_already_account))
.show();
} else {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
.setMessage(getString(R.string.phone_number_info_content))
.show();
}
} else if (id == R.id.assistant_create) {
mCreateAccount.setEnabled(false);
if (mLinkAccount) {
addAlias();
} else {
if (mUseEmail.isChecked()) mAccountCreator.setPhoneNumber(null, null);
if (mAccountCreator.getUsername() != null
&& mAccountCreator.getUsername().length() > 0) {
mAccountCreator.isAccountExist();
} else {
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForUsernameStatus(
AccountCreator.UsernameStatus.TooShort),
AssistantActivity.instance());
mCreateAccount.setEnabled(true);
}
}
}
}
private boolean isEmailCorrect(String email) {
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
return emailPattern.matcher(email).matches();
@ -361,6 +363,14 @@ public class CreateAccountFragment extends Fragment
return password.length() >= 1;
}
private String getUsername() {
if (mUsernameEdit != null) {
String username = mUsernameEdit.getText().toString();
return username.toLowerCase(Locale.getDefault());
}
return null;
}
private void addAlias() {
mAccountCreator.setUsername(
LinphonePreferences.instance()
@ -757,8 +767,14 @@ public class CreateAccountFragment extends Fragment
}
} else {
mCreateAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
if (status.equals(Status.AccountActivated)) {
LinphoneUtils.displayErrorAlert(
getString(R.string.assistant_phone_number_unavailable),
AssistantActivity.instance());
} else {
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
}
}
}

View file

@ -441,7 +441,11 @@ public final class LinphoneUtils {
|| status.equals(AccountCreator.Status.AccountAlreadyActivated)
|| status.equals(AccountCreator.Status.AccountActivated)
|| status.equals(AccountCreator.Status.AccountNotCreated)
|| status.equals(AccountCreator.Status.RequestOk)) return "";
|| status.equals(AccountCreator.Status.RequestOk)) {
return ctxt.getString(R.string.unexpected_event)
.replace("%i", status.name())
.replace("%s", "account assistant");
}
}
return null;
}