Add new implementation of account creator
This commit is contained in:
parent
48f0eea1e1
commit
dfb3a62115
11 changed files with 224 additions and 202 deletions
|
@ -26,3 +26,8 @@ port=443
|
|||
[misc]
|
||||
log_collection_upload_server_url=https://www.linphone.org:444/lft.php
|
||||
file_transfer_server_url=https://www.linphone.org:444/lft.php
|
||||
|
||||
[proxy_default_values]
|
||||
reg_proxy=<sip:sip.linphone.org>
|
||||
realm=sip.linphone.org
|
||||
reg_identity=sip:user@sip.linphone.org
|
|
@ -434,14 +434,14 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
alert.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
LinphoneAccountCreator.Status status = accountCreator.setPassword(pass1.getText().toString());
|
||||
if (status.equals(LinphoneAccountCreator.Status.Ok)) {
|
||||
LinphoneAccountCreator.PasswordCheck status = accountCreator.setPassword(pass1.getText().toString());
|
||||
if (status.equals(LinphoneAccountCreator.PasswordCheck.Ok)) {
|
||||
if (pass1.getText().toString().compareTo(pass2.getText().toString()) == 0) {
|
||||
accountCreator.setUsername(mPrefs.getAccountUsername(n));
|
||||
accountCreator.setHa1(mPrefs.getAccountHa1(n));
|
||||
status = accountCreator.updatePassword(pass1.getText().toString());
|
||||
if (!status.equals(LinphoneAccountCreator.Status.Ok)) {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
LinphoneAccountCreator.RequestStatus req_status = accountCreator.updatePassword(pass1.getText().toString());
|
||||
if (!req_status.equals(LinphoneAccountCreator.RequestStatus.Ok)) {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(req_status)
|
||||
, LinphoneActivity.instance());
|
||||
} else {
|
||||
progress = ProgressDialog.show(LinphoneActivity.instance(), null, null);
|
||||
|
@ -458,7 +458,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
}
|
||||
return;
|
||||
}
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), LinphoneActivity.instance());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPasswordStatus(status), LinphoneActivity.instance());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -545,58 +545,58 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
progress.dismiss();
|
||||
if (status.equals(LinphoneAccountCreator.Status.Ok)) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.Ok)) {
|
||||
mPrefs.setAccountPassword(n, accountCreator.getPassword());
|
||||
PreferenceCategory account = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_sipaccount_key));
|
||||
((EditTextPreference) account.getPreference(2)).setText(mPrefs.getAccountPassword(n));
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.pref_password_changed), LinphoneActivity.instance());
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), LinphoneActivity.instance());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), LinphoneActivity.instance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,10 +159,6 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
|
||||
isTransferAllowed = getApplicationContext().getResources().getBoolean(R.bool.allow_transfers);
|
||||
|
||||
if(!BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) {
|
||||
BluetoothManager.getInstance().initBluetooth();
|
||||
}
|
||||
|
||||
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
|
||||
|
||||
try {
|
||||
|
|
|
@ -835,7 +835,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
resetCameraFromPreferences();
|
||||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setDomain(getString(R.string.default_domain));
|
||||
accountCreator.setListener(this);
|
||||
}
|
||||
|
||||
|
@ -1792,42 +1791,42 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountExist)) {
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist)) {
|
||||
accountCreator.isAccountLinked();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountNotLinked)) {
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotLinked)) {
|
||||
askLinkWithPhoneNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -589,59 +589,87 @@ public final class LinphoneUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static String errorForStatus(LinphoneAccountCreator.Status status) {
|
||||
public static String errorForPhoneNumberStatus(int status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.Status.EmailInvalid))
|
||||
return ctxt.getString(R.string.invalid_email);
|
||||
if (status.equals(LinphoneAccountCreator.Status.UsernameInvalid))
|
||||
return ctxt.getString(R.string.invalid_username);
|
||||
if (status.equals(LinphoneAccountCreator.Status.UsernameTooShort))
|
||||
return ctxt.getString(R.string.username_too_short);
|
||||
if (status.equals(LinphoneAccountCreator.Status.UsernameTooLong))
|
||||
return ctxt.getString(R.string.username_too_long);
|
||||
if (status.equals(LinphoneAccountCreator.Status.UsernameInvalidSize))
|
||||
return ctxt.getString(R.string.username_invalid_size);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PhoneNumberTooShort))
|
||||
return ctxt.getString(R.string.phone_number_too_short);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PhoneNumberTooLong))
|
||||
return ctxt.getString(R.string.phone_number_too_long);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PhoneNumberInvalid))
|
||||
return ctxt.getString(R.string.phone_number_invalid);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PasswordTooShort))
|
||||
return ctxt.getString(R.string.password_too_short);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PasswordTooLong))
|
||||
return ctxt.getString(R.string.password_too_long);
|
||||
if (status.equals(LinphoneAccountCreator.Status.DomainInvalid))
|
||||
return ctxt.getString(R.string.invalid_domain);
|
||||
if (status.equals(LinphoneAccountCreator.Status.RouteInvalid))
|
||||
return ctxt.getString(R.string.invalid_route);
|
||||
if (status.equals(LinphoneAccountCreator.Status.DisplayNameInvalid))
|
||||
return ctxt.getString(R.string.invalid_display_name);
|
||||
if (status.equals(LinphoneAccountCreator.Status.Failed))
|
||||
return ctxt.getString(R.string.request_failed);
|
||||
if (status.equals(LinphoneAccountCreator.Status.ErrorServer))
|
||||
return ctxt.getString(R.string.wizard_failed);
|
||||
if (status.equals(LinphoneAccountCreator.Status.TransportNotSupported))
|
||||
return ctxt.getString(R.string.transport_unsupported);
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountExist)
|
||||
|| status.equals(LinphoneAccountCreator.Status.AccountExistWithAlias))
|
||||
return ctxt.getString(R.string.account_already_exist);
|
||||
if (status.equals(LinphoneAccountCreator.Status.CountryCodeInvalid))
|
||||
if (LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()
|
||||
== (status & LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()))
|
||||
return ctxt.getString(R.string.country_code_invalid);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PhoneNumberUsedAccount)
|
||||
|| status.equals(LinphoneAccountCreator.Status.PhoneNumberUsedAlias))
|
||||
if (LinphoneAccountCreator.PhoneNumberCheck.TooShort.value()
|
||||
== (status & LinphoneAccountCreator.PhoneNumberCheck.TooShort.value()))
|
||||
return ctxt.getString(R.string.phone_number_too_short);
|
||||
if (LinphoneAccountCreator.PhoneNumberCheck.TooLong.value()
|
||||
== (status & LinphoneAccountCreator.PhoneNumberCheck.TooLong.value()))
|
||||
return ctxt.getString(R.string.phone_number_too_long);
|
||||
if (LinphoneAccountCreator.PhoneNumberCheck.Invalid.value()
|
||||
== (status & LinphoneAccountCreator.PhoneNumberCheck.Invalid.value()))
|
||||
return ctxt.getString(R.string.phone_number_invalid);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String errorForEmailStatus(LinphoneAccountCreator.EmailCheck status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.EmailCheck.InvalidCharacters)
|
||||
|| status.equals(LinphoneAccountCreator.EmailCheck.Malformed))
|
||||
return ctxt.getString(R.string.invalid_email);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String errorForUsernameStatus(LinphoneAccountCreator.UsernameCheck status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.InvalidCharacters))
|
||||
return ctxt.getString(R.string.invalid_username);
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.TooShort))
|
||||
return ctxt.getString(R.string.username_too_short);
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.TooLong))
|
||||
return ctxt.getString(R.string.username_too_long);
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.Invalid))
|
||||
return ctxt.getString(R.string.username_invalid_size);
|
||||
if (status.equals(LinphoneAccountCreator.UsernameCheck.InvalidCharacters))
|
||||
return ctxt.getString(R.string.invalid_display_name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String errorForPasswordStatus(LinphoneAccountCreator.PasswordCheck status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.PasswordCheck.TooShort))
|
||||
return ctxt.getString(R.string.password_too_short);
|
||||
if (status.equals(LinphoneAccountCreator.PasswordCheck.TooLong))
|
||||
return ctxt.getString(R.string.password_too_long);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String errorForRequestStatus(LinphoneAccountCreator.RequestStatus status) {
|
||||
Context ctxt = getContext();
|
||||
if (ctxt != null) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.Failed))
|
||||
return ctxt.getString(R.string.request_failed);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.ErrorServer))
|
||||
return ctxt.getString(R.string.wizard_failed);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias))
|
||||
return ctxt.getString(R.string.account_already_exist);
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasIsAccount)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AliasExist))
|
||||
return ctxt.getString(R.string.assistant_phone_number_unavailable);
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountNotExist))
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotExist))
|
||||
return ctxt.getString(R.string.assistant_error_bad_credentials);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PhoneNumberNotUsed))
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasNotExist))
|
||||
return ctxt.getString(R.string.phone_number_not_exist);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PhoneNumberNotUsed)
|
||||
|| status.equals(LinphoneAccountCreator.Status.AccountNotActivated)
|
||||
|| status.equals(LinphoneAccountCreator.Status.AccountAlreadyActivated)
|
||||
|| status.equals(LinphoneAccountCreator.Status.AccountActivated)
|
||||
|| status.equals(LinphoneAccountCreator.Status.AccountNotCreated)
|
||||
|| status.equals(LinphoneAccountCreator.Status.Ok))
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasNotExist)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountNotActivated)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountAlreadyActivated)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.AccountNotCreated)
|
||||
|| status.equals(LinphoneAccountCreator.RequestStatus.Ok))
|
||||
return "";
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -140,7 +140,6 @@ private static AssistantActivity instance;
|
|||
status.enableSideMenu(false);
|
||||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setDomain(getResources().getString(R.string.default_domain));
|
||||
accountCreator.setListener(this);
|
||||
|
||||
countryListAdapter = new CountryListAdapter(getApplicationContext());
|
||||
|
@ -694,8 +693,8 @@ private static AssistantActivity instance;
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
if(status.equals(LinphoneAccountCreator.Status.AccountExistWithAlias)){
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if(status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)){
|
||||
success();
|
||||
} else {
|
||||
isLink = true;
|
||||
|
@ -705,47 +704,47 @@ private static AssistantActivity instance;
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
|
|||
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc()
|
||||
, LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setDomain(getResources().getString(R.string.default_domain));
|
||||
accountCreator.setListener(this);
|
||||
|
||||
username = getArguments().getString("Username");
|
||||
|
@ -76,33 +75,33 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountNotActivated)) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountNotActivated)) {
|
||||
Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show();
|
||||
} else if (status.equals(LinphoneAccountCreator.Status.AccountActivated)) {
|
||||
} else if (status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)) {
|
||||
AssistantActivity.instance().saveCreatedAccount(username, password, null, null, getString(R.string.default_domain), null);
|
||||
AssistantActivity.instance().isAccountVerified(username);
|
||||
} else {
|
||||
|
@ -112,19 +111,19 @@ public class CreateAccountActivationFragment extends Fragment implements OnClick
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.linphone.LinphonePreferences;
|
|||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
||||
import org.linphone.core.LinphoneAccountCreator.Status;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
|
||||
import android.app.Fragment;
|
||||
|
@ -63,7 +62,6 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
|
||||
code_length = LinphonePreferences.instance().getCodeLength();
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc(), LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setDomain(getResources().getString(R.string.default_domain));
|
||||
accountCreator.setListener(this);
|
||||
accountCreator.setUsername(username);
|
||||
accountCreator.setPhoneNumber(phone, dialcode);
|
||||
|
@ -133,19 +131,19 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(Status.AccountActivated)) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountActivated)) {
|
||||
checkAccount.setEnabled(true);
|
||||
if (accountCreator.getUsername() != null) {
|
||||
AssistantActivity.instance().saveCreatedAccount(accountCreator.getUsername(), null , accountCreator.getHa1(), dialcode, getString(R.string.default_domain), null);
|
||||
|
@ -162,7 +160,7 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
AssistantActivity.instance().success();
|
||||
}
|
||||
}
|
||||
} else if (status.equals(LinphoneAccountCreator.Status.Failed)) {
|
||||
} else if (status.equals(LinphoneAccountCreator.RequestStatus.Failed)) {
|
||||
Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.assistant_error_confirmation_code), Toast.LENGTH_LONG).show();
|
||||
|
@ -171,16 +169,16 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if(status.equals(LinphoneAccountCreator.Status.Ok)){
|
||||
if(status.equals(LinphoneAccountCreator.RequestStatus.Ok)){
|
||||
LinphonePreferences.instance().setLinkPopupTime("");
|
||||
AssistantActivity.instance().hideKeyboard();
|
||||
AssistantActivity.instance().success();
|
||||
|
@ -188,26 +186,26 @@ public class CreateAccountCodeActivationFragment extends Fragment implements Lin
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.linphone.R;
|
|||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.LinphoneAccountCreator;
|
||||
import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
||||
import org.linphone.core.LinphoneAccountCreator.Status;
|
||||
import org.linphone.core.LinphoneAccountCreator.RequestStatus;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
|
||||
|
@ -88,7 +88,6 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
//Initialize accountCreator
|
||||
accountCreator = LinphoneCoreFactory.instance().createAccountCreator(LinphoneManager.getLc()
|
||||
, LinphonePreferences.instance().getXmlrpcUrl());
|
||||
accountCreator.setDomain(getResources().getString(R.string.default_domain));
|
||||
accountCreator.setListener(this);
|
||||
|
||||
instruction = (TextView) view.findViewById(R.id.message_create_account);
|
||||
|
@ -331,7 +330,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
if (!getResources().getBoolean(R.bool.isTablet) || getUsername().length() > 0) {
|
||||
accountCreator.isAccountUsed();
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(Status.UsernameTooShort)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForUsernameStatus(LinphoneAccountCreator.UsernameCheck.TooShort)
|
||||
, AssistantActivity.instance());
|
||||
createAccount.setEnabled(true);
|
||||
}
|
||||
|
@ -352,34 +351,34 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(
|
||||
LinphonePreferences.instance().getDefaultAccountIndex())
|
||||
);
|
||||
Status status = accountCreator.setPhoneNumber(
|
||||
int status = accountCreator.setPhoneNumber(
|
||||
phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode));
|
||||
boolean isOk = status.equals(LinphoneAccountCreator.Status.Ok);
|
||||
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value();
|
||||
if (isOk) {
|
||||
accountCreator.linkPhoneNumberWithAccount();
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForStatus(status));
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status), AssistantActivity.instance());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
|
||||
}
|
||||
}
|
||||
|
||||
private void createAccount() {
|
||||
if ((getResources().getBoolean(R.bool.isTablet) || !getResources().getBoolean(R.bool.use_phone_number_validation))
|
||||
&& useEmail.isChecked()) {
|
||||
Status emailStatus;
|
||||
Status passwordStatus;
|
||||
LinphoneAccountCreator.EmailCheck emailStatus;
|
||||
LinphoneAccountCreator.PasswordCheck passwordStatus;
|
||||
|
||||
passwordStatus = accountCreator.setPassword(passwordEdit.getText().toString());
|
||||
emailStatus = accountCreator.setEmail(emailEdit.getText().toString());
|
||||
|
||||
if (!emailOk) {
|
||||
LinphoneUtils.displayError(false, emailError, LinphoneUtils.errorForStatus(emailStatus));
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(emailStatus)
|
||||
LinphoneUtils.displayError(false, emailError, LinphoneUtils.errorForEmailStatus(emailStatus));
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForEmailStatus(emailStatus)
|
||||
, AssistantActivity.instance());
|
||||
} else if (!passwordOk) {
|
||||
LinphoneUtils.displayError(false, passwordError, LinphoneUtils.errorForStatus(passwordStatus));
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(passwordStatus)
|
||||
LinphoneUtils.displayError(false, passwordError, LinphoneUtils.errorForPasswordStatus(passwordStatus));
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPasswordStatus(passwordStatus)
|
||||
, AssistantActivity.instance());
|
||||
} else if (!confirmPasswordOk) {
|
||||
String msg;
|
||||
|
@ -395,11 +394,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
} else {
|
||||
if (phoneNumberEdit.length() > 0 || dialCode.length() > 1) {
|
||||
Status phoneStatus;
|
||||
int phoneStatus;
|
||||
boolean isOk;
|
||||
phoneStatus = accountCreator.setPhoneNumber(
|
||||
phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode));
|
||||
isOk = phoneStatus.equals(LinphoneAccountCreator.Status.Ok);
|
||||
isOk = phoneStatus == LinphoneAccountCreator.PhoneNumberCheck.Ok.value();
|
||||
if (!useUsername.isChecked() && accountCreator.getUsername() == null) {
|
||||
accountCreator.setUsername(accountCreator.getPhoneNumber());
|
||||
} else {
|
||||
|
@ -410,10 +409,10 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
if (isOk) {
|
||||
accountCreator.createAccount();
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(phoneStatus)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(phoneStatus)
|
||||
, AssistantActivity.instance());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError
|
||||
, LinphoneUtils.errorForStatus(phoneStatus));
|
||||
, LinphoneUtils.errorForPhoneNumberStatus(phoneStatus));
|
||||
}
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.assistant_create_account_part_1)
|
||||
|
@ -423,8 +422,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
createAccount.setEnabled(true);
|
||||
}
|
||||
|
||||
private LinphoneAccountCreator.Status getPhoneNumberStatus() {
|
||||
LinphoneAccountCreator.Status status = accountCreator.setPhoneNumber(
|
||||
private int getPhoneNumberStatus() {
|
||||
int status = accountCreator.setPhoneNumber(
|
||||
phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode));
|
||||
addressSip = accountCreator.getPhoneNumber();
|
||||
return status;
|
||||
|
@ -435,9 +434,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.setUsername(getUsername());
|
||||
|
||||
if (!useEmail.isChecked() && getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||
LinphoneAccountCreator.Status status = getPhoneNumberStatus();
|
||||
boolean isOk = status.equals(LinphoneAccountCreator.Status.Ok);
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForStatus(status));
|
||||
int status = getPhoneNumberStatus();
|
||||
boolean isOk = (status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
|
||||
|
||||
// Username or phone number
|
||||
if (getResources().getBoolean(R.bool.assistant_allow_username) && useUsername.isChecked()) {
|
||||
|
@ -445,7 +444,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
if (!isOk) {
|
||||
if (status.equals(LinphoneAccountCreator.Status.CountryCodeInvalid)) {
|
||||
if (status == LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()) {
|
||||
dialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
|
||||
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
} else {
|
||||
|
@ -517,14 +516,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
field.addTextChangedListener(new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {
|
||||
emailOk = false;
|
||||
Status status = accountCreator.setEmail(field.getText().toString());
|
||||
if (status.equals(Status.Ok)) {
|
||||
LinphoneAccountCreator.EmailCheck status = accountCreator.setEmail(field.getText().toString());
|
||||
if (status.equals(LinphoneAccountCreator.EmailCheck.Ok)) {
|
||||
emailOk = true;
|
||||
LinphoneUtils.displayError(emailOk, emailError, "");
|
||||
}
|
||||
else {
|
||||
LinphoneUtils.displayError(emailOk
|
||||
, emailError, LinphoneUtils.errorForStatus(status));
|
||||
, emailError, LinphoneUtils.errorForEmailStatus(status));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,14 +539,13 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
TextWatcher passwordListener = new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {
|
||||
passwordOk = false;
|
||||
Status status = accountCreator.setPassword(field1.getText().toString());
|
||||
LinphoneAccountCreator.PasswordCheck status = accountCreator.setPassword(field1.getText().toString());
|
||||
if (isPasswordCorrect(field1.getText().toString())) {
|
||||
passwordOk = true;
|
||||
LinphoneUtils.displayError(passwordOk, passwordError, "");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
LinphoneUtils.displayError(passwordOk
|
||||
, passwordError, LinphoneUtils.errorForStatus(status));
|
||||
, passwordError, LinphoneUtils.errorForPasswordStatus(status));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,11 +587,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final Status status) {
|
||||
if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final RequestStatus status) {
|
||||
if (status.equals(RequestStatus.AccountExist) || status.equals(RequestStatus.AccountExistWithAlias)) {
|
||||
if (useEmail.isChecked()) {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
} else {
|
||||
accountCreator.isPhoneNumberUsed();
|
||||
|
@ -604,8 +602,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, Status status) {
|
||||
if (status.equals(Status.AccountCreated)) {
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
if (status.equals(RequestStatus.AccountCreated)) {
|
||||
if (useEmail.isChecked() || !getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||
AssistantActivity.instance().displayAssistantConfirm(getUsername()
|
||||
, passwordEdit.getText().toString(), emailEdit.getText().toString());
|
||||
|
@ -616,21 +614,21 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(Status.Ok)) {
|
||||
if (status.equals(RequestStatus.Ok)) {
|
||||
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
|
||||
, phoneNumberEdit.getText().toString()
|
||||
, LinphoneUtils.getCountryCode(dialCode), false);
|
||||
|
@ -638,11 +636,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(Status.Ok)) {
|
||||
if (status.equals(RequestStatus.Ok)) {
|
||||
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
|
||||
, phoneNumberEdit.getText().toString()
|
||||
, LinphoneUtils.getCountryCode(dialCode), false);
|
||||
|
@ -650,11 +648,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(Status.AccountNotActivated)) {
|
||||
if (status.equals(RequestStatus.AccountNotActivated)) {
|
||||
if (getResources().getBoolean(R.bool.isTablet)
|
||||
|| !getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||
//accountCreator.activateAccount(); // Resend email TODO
|
||||
|
@ -663,17 +661,17 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(Status.Ok)) {
|
||||
if (status.equals(RequestStatus.Ok)) {
|
||||
AssistantActivity.instance().displayAssistantCodeConfirm(getUsername()
|
||||
, dialCode.getText().toString() , phoneNumberEdit.getText().toString(), false);
|
||||
} else {
|
||||
|
@ -685,21 +683,21 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator ac, Status status) {
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator ac, RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
return;
|
||||
}
|
||||
if (status.equals(Status.PhoneNumberUsedAccount) || status.equals(Status.PhoneNumberUsedAlias)) {
|
||||
if (status.equals(RequestStatus.AliasIsAccount) || status.equals(RequestStatus.AliasExist)) {
|
||||
if (accountCreator.getPhoneNumber() != null && accountCreator.getUsername() != null
|
||||
&& accountCreator.getPhoneNumber().compareTo(accountCreator.getUsername()) == 0) {
|
||||
accountCreator.isAccountActivated();
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
} else {
|
||||
|
@ -708,7 +706,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, Status status) {
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, RequestStatus status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.isAccountUsed();
|
||||
}
|
||||
|
||||
private LinphoneAccountCreator.Status getPhoneNumberStatus() {
|
||||
private int getPhoneNumberStatus() {
|
||||
return accountCreator.setPhoneNumber(phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode));
|
||||
}
|
||||
|
||||
|
@ -252,16 +252,16 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
|
||||
private void recoverAccount() {
|
||||
if (phoneNumberEdit.length() > 0 || dialCode.length() > 1) {
|
||||
LinphoneAccountCreator.Status status = getPhoneNumberStatus();
|
||||
boolean isOk = status.equals(LinphoneAccountCreator.Status.Ok);
|
||||
int status = getPhoneNumberStatus();
|
||||
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value();
|
||||
if (isOk) {
|
||||
accountCreator.isPhoneNumberUsed();
|
||||
} else {
|
||||
apply.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status),
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForPhoneNumberStatus(status),
|
||||
AssistantActivity.instance());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError,
|
||||
LinphoneUtils.errorForStatus(status));
|
||||
LinphoneUtils.errorForPhoneNumberStatus(status));
|
||||
}
|
||||
} else {
|
||||
apply.setEnabled(true);
|
||||
|
@ -273,11 +273,11 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
public void onTextChanged2() {
|
||||
LinphoneAccountCreator.Status status = getPhoneNumberStatus();
|
||||
boolean isOk = status.equals(LinphoneAccountCreator.Status.Ok);
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForStatus(status));
|
||||
int status = getPhoneNumberStatus();
|
||||
boolean isOk = status == LinphoneAccountCreator.PhoneNumberCheck.Ok.value();
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
|
||||
if (!isOk) {
|
||||
if (status.equals(LinphoneAccountCreator.Status.CountryCodeInvalid)) {
|
||||
if ((1 == (status & LinphoneAccountCreator.PhoneNumberCheck.CountryCodeInvalid.value()))) {
|
||||
dialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
|
||||
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
} else {
|
||||
|
@ -321,51 +321,51 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
apply.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountExist) || status.equals(LinphoneAccountCreator.Status.AccountExistWithAlias)) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AccountExist) || status.equals(LinphoneAccountCreator.RequestStatus.AccountExistWithAlias)) {
|
||||
String phone = accountCreator.getPhoneNumber();
|
||||
String dial = null;
|
||||
if (phone != null && phone.length() > 0)
|
||||
dial = accountCreator.getPrefix(phone);
|
||||
AssistantActivity.instance().linphoneLogIn(login.getText().toString(), password.getText().toString(), null, dial, getResources().getBoolean(R.bool.assistant_account_validation_mandatory));
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), AssistantActivity.instance());
|
||||
}
|
||||
apply.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
apply.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.Status.ErrorServer)) {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(LinphoneAccountCreator.Status.Failed), AssistantActivity.instance());
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.ErrorServer)) {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(LinphoneAccountCreator.RequestStatus.Failed), AssistantActivity.instance());
|
||||
apply.setEnabled(true);
|
||||
} else {
|
||||
AssistantActivity.instance().displayAssistantCodeConfirm(accountCreator.getUsername(), phoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(dialCode), true);
|
||||
|
@ -373,25 +373,25 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsAccountLinked(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorIsPhoneNumberUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
if (AssistantActivity.instance() == null) {
|
||||
apply.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
if (status.equals(LinphoneAccountCreator.Status.PhoneNumberUsedAccount) || status.equals(LinphoneAccountCreator.Status.PhoneNumberUsedAlias)) {
|
||||
if (status.equals(LinphoneAccountCreator.RequestStatus.AliasIsAccount) || status.equals(LinphoneAccountCreator.RequestStatus.AliasExist)) {
|
||||
accountCreator.recoverPhoneAccount();
|
||||
} else {
|
||||
apply.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForRequestStatus(status), AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||
public void onAccountCreatorPasswordUpdated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.RequestStatus status) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue