Account creator changes
This commit is contained in:
parent
1db05c0178
commit
1cd6da3eea
11 changed files with 141 additions and 116 deletions
|
@ -436,7 +436,7 @@ public class LinphoneManager implements SensorEventListener {
|
|||
mTimer = new Timer("Linphone scheduler");
|
||||
mTimer.schedule(lTask, 0, 20);
|
||||
|
||||
initLiblinphone(mCore);
|
||||
initLiblinphone();
|
||||
} catch (Exception e) {
|
||||
Log.e(e, "[Manager] Cannot start linphone");
|
||||
}
|
||||
|
@ -445,8 +445,7 @@ public class LinphoneManager implements SensorEventListener {
|
|||
H264Helper.setH264Mode(H264Helper.MODE_AUTO, mCore);
|
||||
}
|
||||
|
||||
private synchronized void initLiblinphone(Core core) {
|
||||
mCore = core;
|
||||
private synchronized void initLiblinphone() {
|
||||
mAudioManager = new AndroidAudioManager(mContext);
|
||||
|
||||
mCore.setZrtpSecretsFile(mBasePath + "/zrtp_secrets");
|
||||
|
@ -543,16 +542,28 @@ public class LinphoneManager implements SensorEventListener {
|
|||
|
||||
/* Account linking */
|
||||
|
||||
public AccountCreator getAccountCreator() {
|
||||
if (mAccountCreator == null) {
|
||||
Log.w("[Manager] Account creator shouldn't be null !");
|
||||
mAccountCreator =
|
||||
mCore.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
|
||||
mAccountCreator.setListener(mAccountCreatorListener);
|
||||
}
|
||||
return mAccountCreator;
|
||||
}
|
||||
|
||||
public void isAccountWithAlias() {
|
||||
if (mCore.getDefaultProxyConfig() != null) {
|
||||
long now = new Timestamp(new Date().getTime()).getTime();
|
||||
if (mAccountCreator != null && LinphonePreferences.instance().getLinkPopupTime() == null
|
||||
AccountCreator accountCreator = getAccountCreator();
|
||||
if (LinphonePreferences.instance().getLinkPopupTime() == null
|
||||
|| Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) < now) {
|
||||
mAccountCreator.setUsername(
|
||||
accountCreator.reset();
|
||||
accountCreator.setUsername(
|
||||
LinphonePreferences.instance()
|
||||
.getAccountUsername(
|
||||
LinphonePreferences.instance().getDefaultAccountIndex()));
|
||||
mAccountCreator.isAccountExist();
|
||||
accountCreator.isAccountExist();
|
||||
}
|
||||
} else {
|
||||
LinphonePreferences.instance().setLinkPopupTime(null);
|
||||
|
|
|
@ -72,17 +72,22 @@ public class AccountConnectionAssistantActivity extends AssistantActivity {
|
|||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AccountCreator accountCreator = getAccountCreator();
|
||||
accountCreator.reset();
|
||||
mConnect.setEnabled(false);
|
||||
|
||||
if (mUsernameConnectionSwitch.isChecked()) {
|
||||
mAccountCreator.setUsername(mUsername.getText().toString());
|
||||
mAccountCreator.setPassword(mPassword.getText().toString());
|
||||
accountCreator.setUsername(mUsername.getText().toString());
|
||||
accountCreator.setPassword(mPassword.getText().toString());
|
||||
|
||||
createProxyConfigAndLeaveAssistant();
|
||||
} else {
|
||||
mAccountCreator.setUsername(mPhoneNumber.getText().toString());
|
||||
accountCreator.setPhoneNumber(
|
||||
mPhoneNumber.getText().toString(),
|
||||
mPrefix.getText().toString());
|
||||
accountCreator.setUsername(accountCreator.getPhoneNumber());
|
||||
|
||||
AccountCreator.Status status = mAccountCreator.recoverAccount();
|
||||
AccountCreator.Status status = accountCreator.recoverAccount();
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
Log.e(
|
||||
"[Account Connection Assistant] recoverAccount returned "
|
||||
|
@ -221,18 +226,18 @@ public class AccountConnectionAssistantActivity extends AssistantActivity {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
reloadLinphoneAccountCreatorConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mAccountCreator.addListener(mListener);
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
reloadLinphoneAccountCreatorConfig();
|
||||
}
|
||||
|
||||
getAccountCreator().addListener(mListener);
|
||||
|
||||
DialPlan dp = getDialPlanForCurrentCountry();
|
||||
displayDialPlan(dp);
|
||||
|
@ -246,7 +251,7 @@ public class AccountConnectionAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mAccountCreator.removeListener(mListener);
|
||||
getAccountCreator().removeListener(mListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,19 +21,18 @@ package org.linphone.assistant;
|
|||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import java.util.Locale;
|
||||
import org.linphone.LinphoneContext;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.activities.DialerActivity;
|
||||
import org.linphone.activities.LinphoneGenericActivity;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.Config;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.DialPlan;
|
||||
import org.linphone.core.Factory;
|
||||
|
@ -43,25 +42,11 @@ import org.linphone.settings.LinphonePreferences;
|
|||
|
||||
public abstract class AssistantActivity extends LinphoneGenericActivity
|
||||
implements CountryPicker.CountryPickedListener {
|
||||
static AccountCreator mAccountCreator;
|
||||
|
||||
protected ImageView mBack;
|
||||
private AlertDialog mCountryPickerDialog;
|
||||
|
||||
private CountryPicker mCountryPicker;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (mAccountCreator == null) {
|
||||
String url = LinphonePreferences.instance().getXmlrpcUrl();
|
||||
Core core = LinphoneManager.getCore();
|
||||
core.loadConfigFromXml(LinphonePreferences.instance().getDefaultDynamicConfigFile());
|
||||
mAccountCreator = core.createAccountCreator(url);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
@ -105,18 +90,17 @@ public abstract class AssistantActivity extends LinphoneGenericActivity
|
|||
}
|
||||
}
|
||||
|
||||
public AccountCreator getAccountCreator() {
|
||||
return LinphoneManager.getInstance().getAccountCreator();
|
||||
}
|
||||
|
||||
private void reloadAccountCreatorConfig(String path) {
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
core.loadConfigFromXml(path);
|
||||
if (mAccountCreator != null) {
|
||||
// Below two settings are applied to account creator when it is built.
|
||||
// Reloading Core config after won't change the account creator configuration,
|
||||
// hence the manual reload
|
||||
Config config = LinphonePreferences.instance().getConfig();
|
||||
mAccountCreator.setDomain(config.getString("assistant", "domain", null));
|
||||
mAccountCreator.setAlgorithm(config.getString("assistant", "algorithm", null));
|
||||
}
|
||||
AccountCreator accountCreator = getAccountCreator();
|
||||
accountCreator.reset();
|
||||
accountCreator.setLanguage(Locale.getDefault().getLanguage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,28 +115,41 @@ public abstract class AssistantActivity extends LinphoneGenericActivity
|
|||
}
|
||||
|
||||
void createProxyConfigAndLeaveAssistant() {
|
||||
createProxyConfigAndLeaveAssistant(false);
|
||||
}
|
||||
|
||||
void createProxyConfigAndLeaveAssistant(boolean isGenericAccount) {
|
||||
Core core = LinphoneManager.getCore();
|
||||
boolean useLinphoneDefaultValues =
|
||||
getString(R.string.default_domain).equals(mAccountCreator.getDomain());
|
||||
if (useLinphoneDefaultValues) {
|
||||
Log.i("[Assistant] Default domain found, reloading configuration");
|
||||
core.loadConfigFromXml(LinphonePreferences.instance().getLinphoneDynamicConfigFile());
|
||||
} else {
|
||||
Log.i("[Assistant] Third party domain found, keeping default values");
|
||||
getString(R.string.default_domain).equals(getAccountCreator().getDomain());
|
||||
|
||||
if (isGenericAccount) {
|
||||
if (useLinphoneDefaultValues) {
|
||||
Log.i(
|
||||
"[Assistant] Default domain found for generic connection, reloading configuration");
|
||||
core.loadConfigFromXml(
|
||||
LinphonePreferences.instance().getLinphoneDynamicConfigFile());
|
||||
} else {
|
||||
Log.i("[Assistant] Third party domain found, keeping default values");
|
||||
}
|
||||
}
|
||||
|
||||
ProxyConfig proxyConfig = mAccountCreator.createProxyConfig();
|
||||
ProxyConfig proxyConfig = getAccountCreator().createProxyConfig();
|
||||
|
||||
if (useLinphoneDefaultValues) {
|
||||
// Restore default values
|
||||
Log.i("[Assistant] Restoring default assistant configuration");
|
||||
core.loadConfigFromXml(LinphonePreferences.instance().getDefaultDynamicConfigFile());
|
||||
} else {
|
||||
// If this isn't a sip.linphone.org account, disable push notifications and enable
|
||||
// service notification, otherwise incoming calls won't work (most probably)
|
||||
Log.w("[Assistant] Unknown domain used, push probably won't work, enable service mode");
|
||||
LinphonePreferences.instance().setServiceNotificationVisibility(true);
|
||||
LinphoneContext.instance().getNotificationManager().startForeground();
|
||||
if (isGenericAccount) {
|
||||
if (useLinphoneDefaultValues) {
|
||||
// Restore default values
|
||||
Log.i("[Assistant] Restoring default assistant configuration");
|
||||
core.loadConfigFromXml(
|
||||
LinphonePreferences.instance().getDefaultDynamicConfigFile());
|
||||
} else {
|
||||
// If this isn't a sip.linphone.org account, disable push notifications and enable
|
||||
// service notification, otherwise incoming calls won't work (most probably)
|
||||
Log.w(
|
||||
"[Assistant] Unknown domain used, push probably won't work, enable service mode");
|
||||
LinphonePreferences.instance().setServiceNotificationVisibility(true);
|
||||
LinphoneContext.instance().getNotificationManager().startForeground();
|
||||
}
|
||||
}
|
||||
|
||||
if (proxyConfig == null) {
|
||||
|
@ -237,6 +234,9 @@ public abstract class AssistantActivity extends LinphoneGenericActivity
|
|||
case PhoneNumberOverused:
|
||||
message = getString(R.string.phone_number_overuse);
|
||||
break;
|
||||
case AccountNotExist:
|
||||
message = getString(R.string.account_doesnt_exist);
|
||||
break;
|
||||
default:
|
||||
message = getString(R.string.error_unknown);
|
||||
break;
|
||||
|
@ -302,7 +302,7 @@ public abstract class AssistantActivity extends LinphoneGenericActivity
|
|||
}
|
||||
|
||||
String phoneNumber = phoneNumberEditText.getText().toString();
|
||||
return mAccountCreator.setPhoneNumber(phoneNumber, prefix);
|
||||
return getAccountCreator().setPhoneNumber(phoneNumber, prefix);
|
||||
}
|
||||
|
||||
String getErrorFromPhoneNumberStatus(int status) {
|
||||
|
|
|
@ -67,7 +67,7 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
AccountCreator.UsernameStatus status =
|
||||
mAccountCreator.setUsername(s.toString());
|
||||
getAccountCreator().setUsername(s.toString());
|
||||
mUsernameError.setVisibility(
|
||||
status == AccountCreator.UsernameStatus.Ok
|
||||
? View.INVISIBLE
|
||||
|
@ -90,7 +90,7 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
AccountCreator.PasswordStatus status =
|
||||
mAccountCreator.setPassword(s.toString());
|
||||
getAccountCreator().setPassword(s.toString());
|
||||
mPasswordError.setVisibility(
|
||||
status == AccountCreator.PasswordStatus.Ok
|
||||
? View.INVISIBLE
|
||||
|
@ -148,7 +148,8 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
AccountCreator.EmailStatus status = mAccountCreator.setEmail(s.toString());
|
||||
AccountCreator.EmailStatus status =
|
||||
getAccountCreator().setEmail(s.toString());
|
||||
mEmailError.setVisibility(
|
||||
status == AccountCreator.EmailStatus.Ok
|
||||
? View.INVISIBLE
|
||||
|
@ -164,7 +165,7 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
public void onClick(View v) {
|
||||
enableButtonsAndFields(false);
|
||||
|
||||
AccountCreator.Status status = mAccountCreator.isAccountExist();
|
||||
AccountCreator.Status status = getAccountCreator().isAccountExist();
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
enableButtonsAndFields(true);
|
||||
Log.e(
|
||||
|
@ -188,7 +189,7 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
showAccountAlreadyExistsDialog();
|
||||
enableButtonsAndFields(true);
|
||||
} else if (status.equals(AccountCreator.Status.AccountNotExist)) {
|
||||
status = mAccountCreator.createAccount();
|
||||
status = getAccountCreator().createAccount();
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
Log.e(
|
||||
"[Email Account Creation Assistant] createAccount returned "
|
||||
|
@ -219,11 +220,6 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
reloadLinphoneAccountCreatorConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private void enableButtonsAndFields(boolean enable) {
|
||||
|
@ -249,7 +245,12 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mAccountCreator.addListener(mListener);
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
reloadLinphoneAccountCreatorConfig();
|
||||
}
|
||||
|
||||
getAccountCreator().addListener(mListener);
|
||||
|
||||
if (getResources().getBoolean(R.bool.pre_fill_email_in_assistant)) {
|
||||
Account[] accounts = AccountManager.get(this).getAccountsByType("com.google");
|
||||
|
@ -266,6 +267,6 @@ public class EmailAccountCreationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mAccountCreator.removeListener(mListener);
|
||||
getAccountCreator().removeListener(mListener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class EmailAccountValidationAssistantActivity extends AssistantActivity {
|
|||
setContentView(R.layout.assistant_email_account_validation);
|
||||
|
||||
TextView email = findViewById(R.id.send_email);
|
||||
email.setText(mAccountCreator.getEmail());
|
||||
email.setText(getAccountCreator().getEmail());
|
||||
|
||||
mFinishCreation = findViewById(R.id.assistant_check);
|
||||
mFinishCreation.setOnClickListener(
|
||||
|
@ -50,7 +50,7 @@ public class EmailAccountValidationAssistantActivity extends AssistantActivity {
|
|||
public void onClick(View v) {
|
||||
mFinishCreation.setEnabled(false);
|
||||
|
||||
AccountCreator.Status status = mAccountCreator.isAccountActivated();
|
||||
AccountCreator.Status status = getAccountCreator().isAccountActivated();
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
Log.e(
|
||||
"[Email Account Validation Assistant] activateAccount returned "
|
||||
|
@ -89,7 +89,7 @@ public class EmailAccountValidationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mAccountCreator.addListener(mListener);
|
||||
getAccountCreator().addListener(mListener);
|
||||
|
||||
// Prevent user to go back, it won't be able to come back here after...
|
||||
mBack.setEnabled(false);
|
||||
|
@ -98,6 +98,6 @@ public class EmailAccountValidationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mAccountCreator.removeListener(mListener);
|
||||
getAccountCreator().removeListener(mListener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.widget.TextView;
|
|||
import androidx.annotation.Nullable;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.AccountCreator;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.TransportType;
|
||||
import org.linphone.core.tools.Log;
|
||||
|
@ -63,33 +64,34 @@ public class GenericConnectionAssistantActivity extends AssistantActivity implem
|
|||
mDomain = findViewById(R.id.assistant_domain);
|
||||
mDomain.addTextChangedListener(this);
|
||||
mTransport = findViewById(R.id.assistant_transports);
|
||||
}
|
||||
|
||||
private void configureAccount() {
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
Log.i("[Generic Connection Assistant] Reloading configuration with default");
|
||||
reloadDefaultAccountCreatorConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private void configureAccount() {
|
||||
mAccountCreator.setUsername(mUsername.getText().toString());
|
||||
mAccountCreator.setDomain(mDomain.getText().toString());
|
||||
mAccountCreator.setPassword(mPassword.getText().toString());
|
||||
mAccountCreator.setDisplayName(mDisplayName.getText().toString());
|
||||
AccountCreator accountCreator = getAccountCreator();
|
||||
accountCreator.setUsername(mUsername.getText().toString());
|
||||
accountCreator.setDomain(mDomain.getText().toString());
|
||||
accountCreator.setPassword(mPassword.getText().toString());
|
||||
accountCreator.setDisplayName(mDisplayName.getText().toString());
|
||||
|
||||
switch (mTransport.getCheckedRadioButtonId()) {
|
||||
case R.id.transport_udp:
|
||||
mAccountCreator.setTransport(TransportType.Udp);
|
||||
accountCreator.setTransport(TransportType.Udp);
|
||||
break;
|
||||
case R.id.transport_tcp:
|
||||
mAccountCreator.setTransport(TransportType.Tcp);
|
||||
accountCreator.setTransport(TransportType.Tcp);
|
||||
break;
|
||||
case R.id.transport_tls:
|
||||
mAccountCreator.setTransport(TransportType.Tls);
|
||||
accountCreator.setTransport(TransportType.Tls);
|
||||
break;
|
||||
}
|
||||
|
||||
createProxyConfigAndLeaveAssistant();
|
||||
createProxyConfigAndLeaveAssistant(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,15 +69,16 @@ public class PhoneAccountCreationAssistantActivity extends AssistantActivity {
|
|||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AccountCreator accountCreator = getAccountCreator();
|
||||
enableButtonsAndFields(false);
|
||||
|
||||
if (mUseUsernameInsteadOfPhoneNumber.isChecked()) {
|
||||
mAccountCreator.setUsername(mUsername.getText().toString());
|
||||
accountCreator.setUsername(mUsername.getText().toString());
|
||||
} else {
|
||||
mAccountCreator.setUsername(mAccountCreator.getPhoneNumber());
|
||||
accountCreator.setUsername(accountCreator.getPhoneNumber());
|
||||
}
|
||||
|
||||
AccountCreator.Status status = mAccountCreator.isAccountExist();
|
||||
AccountCreator.Status status = accountCreator.isAccountExist();
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
Log.e(
|
||||
"[Phone Account Creation Assistant] isAccountExists returned "
|
||||
|
@ -178,7 +179,7 @@ public class PhoneAccountCreationAssistantActivity extends AssistantActivity {
|
|||
showAccountAlreadyExistsDialog();
|
||||
enableButtonsAndFields(true);
|
||||
} else if (status.equals(AccountCreator.Status.AccountNotExist)) {
|
||||
status = mAccountCreator.createAccount();
|
||||
status = getAccountCreator().createAccount();
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
Log.e(
|
||||
"[Phone Account Creation Assistant] createAccount returned "
|
||||
|
@ -209,18 +210,18 @@ public class PhoneAccountCreationAssistantActivity extends AssistantActivity {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
reloadLinphoneAccountCreatorConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mAccountCreator.addListener(mListener);
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
reloadLinphoneAccountCreatorConfig();
|
||||
}
|
||||
|
||||
getAccountCreator().addListener(mListener);
|
||||
|
||||
DialPlan dp = getDialPlanForCurrentCountry();
|
||||
displayDialPlan(dp);
|
||||
|
@ -234,7 +235,7 @@ public class PhoneAccountCreationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mAccountCreator.removeListener(mListener);
|
||||
getAccountCreator().removeListener(mListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -261,7 +262,7 @@ public class PhoneAccountCreationAssistantActivity extends AssistantActivity {
|
|||
if (status == AccountCreator.PhoneNumberStatus.Ok.toInt()) {
|
||||
if (mUseUsernameInsteadOfPhoneNumber.isChecked()) {
|
||||
AccountCreator.UsernameStatus usernameStatus =
|
||||
mAccountCreator.setUsername(mUsername.getText().toString());
|
||||
getAccountCreator().setUsername(mUsername.getText().toString());
|
||||
if (usernameStatus != AccountCreator.UsernameStatus.Ok) {
|
||||
mCreate.setEnabled(false);
|
||||
mError.setText(getErrorFromUsernameStatus(usernameStatus));
|
||||
|
@ -278,7 +279,7 @@ public class PhoneAccountCreationAssistantActivity extends AssistantActivity {
|
|||
if (mUseUsernameInsteadOfPhoneNumber.isChecked()) {
|
||||
username = mUsername.getText().toString();
|
||||
} else {
|
||||
username = mAccountCreator.getPhoneNumber();
|
||||
username = getAccountCreator().getPhoneNumber();
|
||||
}
|
||||
|
||||
if (username != null) {
|
||||
|
|
|
@ -63,6 +63,7 @@ public class PhoneAccountLinkingAssistantActivity extends AssistantActivity {
|
|||
ProxyConfig[] proxyConfigs = core.getProxyConfigList();
|
||||
if (proxyConfigIndex >= 0 && proxyConfigIndex < proxyConfigs.length) {
|
||||
ProxyConfig mProxyConfig = proxyConfigs[proxyConfigIndex];
|
||||
AccountCreator accountCreator = getAccountCreator();
|
||||
|
||||
Address identity = mProxyConfig.getIdentityAddress();
|
||||
if (identity == null) {
|
||||
|
@ -75,14 +76,15 @@ public class PhoneAccountLinkingAssistantActivity extends AssistantActivity {
|
|||
+ mProxyConfig.getDomain());
|
||||
unexpectedError();
|
||||
}
|
||||
mAccountCreator.setUsername(identity.getUsername());
|
||||
accountCreator.setUsername(identity.getUsername());
|
||||
|
||||
AuthInfo authInfo = mProxyConfig.findAuthInfo();
|
||||
if (authInfo == null) {
|
||||
Log.e("[Account Linking Assistant] Auth info not found");
|
||||
unexpectedError();
|
||||
}
|
||||
mAccountCreator.setHa1(authInfo.getHa1());
|
||||
accountCreator.setHa1(authInfo.getHa1());
|
||||
accountCreator.setAlgorithm((authInfo.getAlgorithm()));
|
||||
} else {
|
||||
Log.e(
|
||||
"[Account Linking Assistant] Proxy config index out of bounds: "
|
||||
|
@ -112,7 +114,7 @@ public class PhoneAccountLinkingAssistantActivity extends AssistantActivity {
|
|||
public void onClick(View v) {
|
||||
enableButtonsAndFields(false);
|
||||
|
||||
AccountCreator.Status status = mAccountCreator.isAliasUsed();
|
||||
AccountCreator.Status status = getAccountCreator().isAliasUsed();
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
Log.e(
|
||||
"[Phone Account Linking Assistant] isAliasUsed returned "
|
||||
|
@ -184,7 +186,7 @@ public class PhoneAccountLinkingAssistantActivity extends AssistantActivity {
|
|||
"[Phone Account Linking Assistant] onIsAliasUsed status is "
|
||||
+ status);
|
||||
if (status.equals(AccountCreator.Status.AliasNotExist)) {
|
||||
status = mAccountCreator.linkAccount();
|
||||
status = getAccountCreator().linkAccount();
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
Log.e(
|
||||
"[Phone Account Linking Assistant] linkAccount returned "
|
||||
|
@ -222,18 +224,18 @@ public class PhoneAccountLinkingAssistantActivity extends AssistantActivity {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
reloadLinphoneAccountCreatorConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mAccountCreator.addListener(mListener);
|
||||
Core core = LinphoneManager.getCore();
|
||||
if (core != null) {
|
||||
reloadLinphoneAccountCreatorConfig();
|
||||
}
|
||||
|
||||
getAccountCreator().addListener(mListener);
|
||||
|
||||
DialPlan dp = getDialPlanForCurrentCountry();
|
||||
displayDialPlan(dp);
|
||||
|
@ -247,7 +249,7 @@ public class PhoneAccountLinkingAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mAccountCreator.removeListener(mListener);
|
||||
getAccountCreator().removeListener(mListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -64,7 +64,7 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
|||
getResources().getInteger(R.integer.phone_number_validation_code_length);
|
||||
|
||||
TextView phoneNumber = findViewById(R.id.phone_number);
|
||||
phoneNumber.setText(mAccountCreator.getPhoneNumber());
|
||||
phoneNumber.setText(getAccountCreator().getPhoneNumber());
|
||||
|
||||
mSmsCode = findViewById(R.id.sms_code);
|
||||
mSmsCode.addTextChangedListener(
|
||||
|
@ -88,16 +88,17 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
|||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AccountCreator accountCreator = getAccountCreator();
|
||||
mFinishCreation.setEnabled(false);
|
||||
mAccountCreator.setActivationCode(mSmsCode.getText().toString());
|
||||
accountCreator.setActivationCode(mSmsCode.getText().toString());
|
||||
|
||||
AccountCreator.Status status;
|
||||
if (mIsLinking) {
|
||||
status = mAccountCreator.activateAlias();
|
||||
status = accountCreator.activateAlias();
|
||||
} else if (mIsLogin) {
|
||||
status = mAccountCreator.loginLinphoneAccount();
|
||||
status = accountCreator.loginLinphoneAccount();
|
||||
} else {
|
||||
status = mAccountCreator.activateAccount();
|
||||
status = accountCreator.activateAccount();
|
||||
}
|
||||
if (status != AccountCreator.Status.RequestOk) {
|
||||
Log.e(
|
||||
|
@ -173,7 +174,7 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mAccountCreator.addListener(mListener);
|
||||
getAccountCreator().addListener(mListener);
|
||||
|
||||
// Prevent user to go back, it won't be able to come back here after...
|
||||
mBack.setEnabled(false);
|
||||
|
@ -182,7 +183,7 @@ public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mAccountCreator.removeListener(mListener);
|
||||
getAccountCreator().removeListener(mListener);
|
||||
}
|
||||
|
||||
private void onError(AccountCreator.Status status) {
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
Vos amis pourront vous joindre plus facilement si vous associez votre compte à votre numéro de téléphone\n\nVous verrez dans votre carnet d\'adresses les contacts qui utilisent Linphone et vos amis sauront qu\'ils peuvent vous contacter.\n</string>
|
||||
<string name="phone_number_link_info_content_already_account">Vous ne pouvez associer votre numéro qu\'à un seul compte Linphone.\n\nSi vous avez déjà associé votre numéro à un autre compte mais préférez utiliser ce compte-ci, suivez la procédure d\'association et votre numéro sera automatiquement transféré à ce compte.</string>
|
||||
<string name="phone_number_overuse">Trop de SMS ont été envoyés vers ce numéro en un court laps de temps, veuillez attendre 24h avant de réessayer.</string>
|
||||
<string name="account_doesnt_exist">Ce compte n\'existe pas</string>
|
||||
<!--Status-->
|
||||
<string name="invalid_email">Mail non valide</string>
|
||||
<string name="account_already_exist">Ce compte existe déjà</string>
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
<string name="phone_number_link_info_content">\nYour friends will find you more easily if you link your account to your phone number\n\nYou will see in your address book who is using Linphone and your friends will know that they can reach you on Linphone as well.\n</string>
|
||||
<string name="phone_number_link_info_content_already_account">You can only use your phone number with one Linphone account.\n\nIf you had already linked your number to an other account but you prefer to use this one, simply link it now and your number will automatically be moved to this account.</string>
|
||||
<string name="phone_number_overuse">Too much SMS have been sent to this number in a short period of time, try again in 24 hours.</string>
|
||||
<string name="account_doesnt_exist">Account doesn\'t exist</string>
|
||||
|
||||
<!-- Status -->
|
||||
<string name="invalid_email">Invalid email</string>
|
||||
|
|
Loading…
Reference in a new issue