diff --git a/res/drawable-xhdpi/info.png b/res/drawable-xhdpi/info.png
new file mode 100644
index 000000000..22ba01c96
Binary files /dev/null and b/res/drawable-xhdpi/info.png differ
diff --git a/res/layout-sw533dp-land/assistant_account_creation.xml b/res/layout-sw533dp-land/assistant_account_creation.xml
index 06a1061c2..14127030f 100644
--- a/res/layout-sw533dp-land/assistant_account_creation.xml
+++ b/res/layout-sw533dp-land/assistant_account_creation.xml
@@ -25,11 +25,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
+
+ android:orientation="vertical">
-
+ android:layout_height="wrap_content">
-
+
-
+
+
+
+
+ android:layout_marginTop="5dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_height="wrap_content" android:layout_column="0">
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="wrap_content" android:layout_column="0">
+
+
+
+
+
+
+
+
+
diff --git a/res/layout-sw533dp-land/assistant_linphone_login.xml b/res/layout-sw533dp-land/assistant_linphone_login.xml
index 1c9d8df64..31756ec07 100644
--- a/res/layout-sw533dp-land/assistant_linphone_login.xml
+++ b/res/layout-sw533dp-land/assistant_linphone_login.xml
@@ -21,18 +21,123 @@
android:paddingTop="10dp"
android:layout_gravity="center"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/assistant_account_creation.xml b/res/layout/assistant_account_creation.xml
index 165b138dc..fa2d37c04 100644
--- a/res/layout/assistant_account_creation.xml
+++ b/res/layout/assistant_account_creation.xml
@@ -10,6 +10,7 @@
android:orientation="vertical">
-
-
-
-
-
-
-
-
+ android:layout_height="wrap_content"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
@@ -226,6 +250,16 @@
+
+
+
+
+
-
-
-
-
diff --git a/res/raw/linphonerc_factory b/res/raw/linphonerc_factory
index 28f765950..63bc3f753 100644
--- a/res/raw/linphonerc_factory
+++ b/res/raw/linphonerc_factory
@@ -49,4 +49,3 @@ username_length=-1
username_max_length=64
username_min_length=1
username_regex=^[a-z0-9_.\-]*$
-xmlrpc_url=https://sip3.linphone.org:444/inapp.php
diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml
index f94202657..a3cb87fc9 100644
--- a/res/values/non_localizable_custom.xml
+++ b/res/values/non_localizable_custom.xml
@@ -10,10 +10,15 @@
false
true
+
+ true
+ 86400
+
- https://sip3.linphone.org:444/inapp.php
+ https://sip3.linphone.org:444/wizard.php
true
false
+
false
false
false
@@ -32,7 +37,7 @@
true
- true
+ false
5
86400
true
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 14bb442ca..0e1399a20 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -49,6 +49,8 @@
Connection
Decline
Conference
+ Link
+ Do you want to link the account %s with your phone number ?
the libre SIP client
@@ -57,6 +59,7 @@
Welcome
Assistant
Create account
+ Link account
Continue
Activate account
Finish configuration
@@ -104,6 +107,8 @@
Don\'t use phone number as username
Use email address for account validation
Log in with username
+ What is my phone number for?
+ A SMS code will be sent to your phone number to validate your account.
Invalid email
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index c225348a7..7c008a604 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -14,11 +14,6 @@
android:key="@string/pref_add_account_key"
android:persistent="false"/>
-
-
diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java
index 29c76c283..95d1debf0 100644
--- a/src/org/linphone/LinphoneActivity.java
+++ b/src/org/linphone/LinphoneActivity.java
@@ -32,6 +32,8 @@ import org.linphone.assistant.AssistantActivity;
import org.linphone.assistant.RemoteProvisioningLoginActivity;
import org.linphone.compatibility.Compatibility;
import org.linphone.core.CallDirection;
+import org.linphone.core.LinphoneAccountCreator;
+import org.linphone.core.LinphoneAccountCreatorImpl;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneAuthInfo;
import org.linphone.core.LinphoneCall;
@@ -100,7 +102,7 @@ import android.widget.Toast;
/**
* @author Sylvain Berfini
*/
-public class LinphoneActivity extends Activity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback {
+public class LinphoneActivity extends Activity implements OnClickListener, ContactPicked, ActivityCompat.OnRequestPermissionsResultCallback, LinphoneAccountCreator.LinphoneAccountCreatorListener {
public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
private static final int SETTINGS_ACTIVITY = 123;
private static final int CALL_ACTIVITY = 19;
@@ -202,10 +204,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
initButtons();
initSideMenu();
- if(getResources().getBoolean(R.bool.enable_in_app_purchase)){
- isTrialAccount();
- }
-
currentFragment = FragmentsAvailable.EMPTY;
if (savedInstanceState == null) {
changeCurrentFragment(FragmentsAvailable.DIALER, getIntent().getExtras());
@@ -628,6 +626,13 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class));
}
+ public void displayLinkPhoneNumber() {
+ Intent assistant = new Intent();
+ assistant.setClass(this, AssistantActivity.class);
+ assistant.putExtra("LinkPhoneNumber", true);
+ startActivity(assistant);
+ }
+
public void displayInapp() {
startActivity(new Intent(LinphoneActivity.this, InAppPurchaseActivity.class));
}
@@ -981,8 +986,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
private int mAlwaysChangingPhoneAngle = -1;
-
-
private class LocalOrientationEventListener extends OrientationEventListener {
public LocalOrientationEventListener(Context context) {
super(context);
@@ -1120,7 +1123,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
protected void onPause() {
getIntent().putExtra("PreviousActivity", 0);
- if(LinphonePreferences.instance().isFriendlistsubscriptionEnabled()){
+ if(LinphonePreferences.instance().isFriendlistsubscriptionEnabled() && LinphoneManager.getLc().getDefaultProxyConfig() != null){
LinphoneManager.getInstance().subscribeFriendList(!isApplicationBroughtToBackground(this));
}
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
@@ -1333,6 +1336,16 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
refreshAccounts();
+ if(getResources().getBoolean(R.bool.enable_in_app_purchase)){
+ isTrialAccount();
+ }
+
+ if(getResources().getBoolean(R.bool.use_phone_number_validation)) {
+ if (LinphonePreferences.instance().getLinkPopupTime() == null || (LinphonePreferences.instance().getLinkPopupTime() != null && !LinphonePreferences.instance().getLinkPopupTime().equals(""))){
+ isAccountWithAlias();
+ }
+ }
+
updateMissedChatCount();
if(LinphonePreferences.instance().isFriendlistsubscriptionEnabled()){
LinphoneManager.getInstance().subscribeFriendList(true);
@@ -1578,8 +1591,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
-
-
public void refreshAccounts(){
if (LinphoneManager.getLc().getProxyConfigList().length > 1) {
accountsList.setVisibility(View.VISIBLE);
@@ -1671,9 +1682,20 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
+ private void isAccountWithAlias(){
+ if(LinphoneManager.getLc().getDefaultProxyConfig() != null) {
+ LinphoneAccountCreator accountCreator;
+ accountCreator = new LinphoneAccountCreatorImpl(LinphoneManager.getLc(), getResources().getString(R.string.wizard_url));
+ accountCreator.setDomain(getResources().getString(R.string.default_domain));
+ accountCreator.setListener(this);
+ accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
+ accountCreator.isAccountUsed();
+ }
+ }
+
//Inapp Purchase
private void isTrialAccount() {
- if(LinphoneManager.getLc().getDefaultProxyConfig() != null) {
+ if(LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphonePreferences.instance().getInappPopupTime() != null) {
XmlRpcHelper helper = new XmlRpcHelper();
helper.isTrialAccountAsync(new XmlRpcListenerBase() {
@Override
@@ -1683,13 +1705,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
@Override
- public void onError(String error){}
+ public void onError(String error) {
+ }
}, LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()), LinphonePreferences.instance().getAccountHa1(LinphonePreferences.instance().getDefaultAccountIndex()));
}
}
private void getExpirationAccount() {
- if(LinphoneManager.getLc().getDefaultProxyConfig() != null) {
+ if(LinphoneManager.getLc().getDefaultProxyConfig() != null && LinphonePreferences.instance().getInappPopupTime() != null) {
XmlRpcHelper helper = new XmlRpcHelper();
helper.getAccountExpireAsync(new XmlRpcListenerBase() {
@Override
@@ -1708,16 +1731,19 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
@Override
- public void onError(String error){}
+ public void onError(String error) {
+ }
}, LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()), LinphonePreferences.instance().getAccountHa1(LinphonePreferences.instance().getDefaultAccountIndex()));
}
}
public void displayInappNotification(String date) {
- if (LinphonePreferences.instance().getLastDateNotificationShown() != null && timestampToHumanDate(Calendar.getInstance()).equals(LinphonePreferences.instance().getLastDateNotificationShown())) {
+ long now = Calendar.getInstance().getTimeInMillis();
+ if (LinphonePreferences.instance().getInappPopupTime() != null && Long.parseLong(LinphonePreferences.instance().getInappPopupTime()) < now) {
return;
} else {
- LinphonePreferences.instance().setLastDateNotificationShown(timestampToHumanDate(Calendar.getInstance()));
+ long newDate = now + (getResources().getInteger(R.integer.time_between_inapp_notification)*60);
+ LinphonePreferences.instance().setInappPopupTime(String.valueOf(newDate));
}
if(isTrialAccount){
LinphoneService.instance().displayInappNotification(String.format(getString(R.string.inapp_notification_trial_expire), date));
@@ -1742,6 +1768,65 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
return -1;
}
+
+ private void askLinkWithPhoneNumber(){
+ long now = Calendar.getInstance().getTimeInMillis();
+ long newDate = now + (getResources().getInteger(R.integer.popup_time_interval)*60);
+ Log.w(LinphonePreferences.instance().getLinkPopupTime());
+ Log.w(now);
+ if (LinphonePreferences.instance().getLinkPopupTime() != null && Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) > now) {
+ return;
+ } else {
+ LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
+ }
+ final Dialog dialog = displayDialog(String.format(getResources().getString(R.string.link_account_popup), LinphoneManager.getLc().getDefaultProxyConfig().getAddress().asStringUriOnly()));
+ Button delete = (Button) dialog.findViewById(R.id.delete_button);
+ delete.setText(getResources().getString(R.string.link));
+ Button cancel = (Button) dialog.findViewById(R.id.cancel);
+
+ delete.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ displayLinkPhoneNumber();
+ dialog.dismiss();
+ }
+ });
+
+ LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
+
+ cancel.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ dialog.dismiss();
+ }
+ });
+ dialog.show();
+ }
+
+ @Override
+ public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ if(status.equals(LinphoneAccountCreator.Status.AccountExist)){
+ askLinkWithPhoneNumber();
+ }
+ }
+
+ @Override
+ public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
+
+ @Override
+ public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {}
}
interface ContactPicked {
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index e025c5505..d63a66d2b 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -746,7 +746,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
mLc.setCallLogsDatabasePath(mCallLogDatabaseFile);
mLc.setFriendsDatabasePath(mFriendsDatabaseFile);
mLc.setUserCertificatesPath(mUserCertificatePath);
- subscribeFriendList(mPrefs.isFriendlistsubscriptionEnabled());
+ //subscribeFriendList(mPrefs.isFriendlistsubscriptionEnabled());
//mLc.setCallErrorTone(Reason.NotFound, mErrorToneFile);
enableDeviceRingtone(mPrefs.isDeviceRingtoneEnabled());
diff --git a/src/org/linphone/LinphonePreferences.java b/src/org/linphone/LinphonePreferences.java
index 7cc92ce45..6e129309f 100644
--- a/src/org/linphone/LinphonePreferences.java
+++ b/src/org/linphone/LinphonePreferences.java
@@ -1311,12 +1311,20 @@ public class LinphonePreferences {
return purchasables;
}
- public String getLastDateNotificationShown(){
- return getConfig().getString("app", "notification_date", null);
+ public String getInappPopupTime(){
+ return getConfig().getString("app", "inapp_popup_time", null);
}
- public void setLastDateNotificationShown(String date){
- getConfig().setString("app", "notification_date", date);
+ public void setInappPopupTime(String date){
+ getConfig().setString("app", "inapp_popup_time", date);
+ }
+
+ public void setLinkPopupTime(String date){
+ getConfig().setString("app", "link_popup_time", date);
+ }
+
+ public String getLinkPopupTime(){
+ return getConfig().getString("app", "link_popup_time", null);
}
public String getXmlRpcServerUrl() {
diff --git a/src/org/linphone/SettingsFragment.java b/src/org/linphone/SettingsFragment.java
index 7cc2d2e47..80d5241c6 100644
--- a/src/org/linphone/SettingsFragment.java
+++ b/src/org/linphone/SettingsFragment.java
@@ -35,7 +35,6 @@ import org.linphone.core.PayloadType;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
-import org.linphone.purchase.InAppPurchaseActivity;
import org.linphone.tools.OpenH264DownloadHelper;
import org.linphone.ui.LedPreference;
import org.linphone.ui.PreferencesListFragment;
@@ -65,7 +64,6 @@ import android.provider.Settings;
* @author Sylvain Berfini
*/
public class SettingsFragment extends PreferencesListFragment {
- private static final int STORE_INTENT = 2;
private LinphonePreferences mPrefs;
private Handler mHandler = new Handler();
private LinphoneCoreListenerBase mListener;
diff --git a/src/org/linphone/assistant/AssistantActivity.java b/src/org/linphone/assistant/AssistantActivity.java
index 7d2c1a9a4..ed0bb2079 100644
--- a/src/org/linphone/assistant/AssistantActivity.java
+++ b/src/org/linphone/assistant/AssistantActivity.java
@@ -61,6 +61,7 @@ import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import android.widget.Toast;
+
/**
* @author Sylvain Berfini
*/
@@ -71,7 +72,7 @@ private static AssistantActivity instance;
private AssistantFragmentsEnum firstFragment;
private Fragment fragment;
private LinphonePreferences mPrefs;
- private boolean accountCreated = false, newAccount = false;
+ private boolean accountCreated = false, newAccount = false, isLink = false;
private LinphoneCoreListenerBase mListener;
private LinphoneAddress address;
private StatusFragment status;
@@ -96,14 +97,19 @@ private static AssistantActivity instance;
setContentView(R.layout.assistant);
initUI();
- firstFragment = getResources().getBoolean(R.bool.assistant_use_linphone_login_as_first_fragment) ? AssistantFragmentsEnum.LINPHONE_LOGIN : AssistantFragmentsEnum.WELCOME;
- if (findViewById(R.id.fragment_container) != null) {
- if (savedInstanceState == null) {
- display(firstFragment);
- } else {
- currentFragment = (AssistantFragmentsEnum) savedInstanceState.getSerializable("CurrentFragment");
- }
- }
+ if(getIntent().getBooleanExtra("LinkPhoneNumber",false)){
+ isLink = true;
+ displayCreateAccount();
+ } else {
+ firstFragment = getResources().getBoolean(R.bool.assistant_use_linphone_login_as_first_fragment) ? AssistantFragmentsEnum.LINPHONE_LOGIN : AssistantFragmentsEnum.WELCOME;
+ if (findViewById(R.id.fragment_container) != null) {
+ if (savedInstanceState == null) {
+ display(firstFragment);
+ } else {
+ currentFragment = (AssistantFragmentsEnum) savedInstanceState.getSerializable("CurrentFragment");
+ }
+ }
+ }
if (savedInstanceState != null && savedInstanceState.containsKey("echoCanceller")) {
echoCancellerAlreadyDone = savedInstanceState.getBoolean("echoCanceller");
} else {
@@ -358,6 +364,9 @@ private static AssistantActivity instance;
public void displayCreateAccount() {
fragment = new CreateAccountFragment();
+ Bundle extra = new Bundle();
+ extra.putBoolean("LinkPhoneNumber", isLink);
+ fragment.setArguments(extra);
changeFragment(fragment);
currentFragment = AssistantFragmentsEnum.CREATE_ACCOUNT;
back.setVisibility(View.VISIBLE);
@@ -525,13 +534,15 @@ private static AssistantActivity instance;
back.setVisibility(View.INVISIBLE);
}
- public void displayAssistantCodeConfirm(String username, String phone, boolean recoverAccount) {
+ public void displayAssistantCodeConfirm(String username, String phone, String dialcode, boolean recoverAccount) {
CreateAccountCodeActivationFragment fragment = new CreateAccountCodeActivationFragment();
newAccount = true;
Bundle extras = new Bundle();
extras.putString("Username", username);
extras.putString("Phone", phone);
+ extras.putString("Dialcode", dialcode);
extras.putBoolean("RecoverAccount", recoverAccount);
+ extras.putBoolean("LinkAccount", isLink);
fragment.setArguments(extras);
changeFragment(fragment);
diff --git a/src/org/linphone/assistant/CountryListFragment.java b/src/org/linphone/assistant/CountryListFragment.java
index 3c49dfdb5..8e1344f0a 100644
--- a/src/org/linphone/assistant/CountryListFragment.java
+++ b/src/org/linphone/assistant/CountryListFragment.java
@@ -75,7 +75,7 @@ public class CountryListFragment extends Fragment implements AdapterView.OnItemC
public void onItemClick(AdapterView> parent, View view, int position, long id) {
Country c = (Country)view.getTag();
AssistantActivity.instance().country = c;
- AssistantActivity.instance().displayCreateAccount();
+ AssistantActivity.instance().onBackPressed();
}
@Override
diff --git a/src/org/linphone/assistant/CreateAccountCodeActivationFragment.java b/src/org/linphone/assistant/CreateAccountCodeActivationFragment.java
index e9535fee6..4c0c00de9 100644
--- a/src/org/linphone/assistant/CreateAccountCodeActivationFragment.java
+++ b/src/org/linphone/assistant/CreateAccountCodeActivationFragment.java
@@ -20,9 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import android.app.Fragment;
import android.os.Bundle;
-import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
+import org.linphone.mediastream.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@@ -34,23 +34,20 @@ import android.widget.Toast;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.R;
-import org.linphone.core.LinphoneXmlRpcRequest;
-import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener;
-import org.linphone.core.LinphoneXmlRpcRequestImpl;
-import org.linphone.core.LinphoneXmlRpcSession;
-import org.linphone.core.LinphoneXmlRpcSession;
-import org.linphone.core.LinphoneXmlRpcSessionImpl;
-import org.linphone.mediastream.Log;
+import org.linphone.core.LinphoneAccountCreator;
+import org.linphone.core.LinphoneAccountCreatorImpl;
-public class CreateAccountCodeActivationFragment extends Fragment {
- private String username, phone, ha1;
+
+import static org.linphone.core.LinphoneAccountCreator.*;
+
+public class CreateAccountCodeActivationFragment extends Fragment implements LinphoneAccountCreatorListener {
+ private String username, phone, dialcode, ha1;
private EditText code;
- private boolean recoverAccount;
+ private boolean recoverAccount = false, linkAccount = false;
private int code_length;
- private Handler mHandler = new Handler();
private Button checkAccount;
- private LinphoneXmlRpcSession xmlRpcSession;
-
+ private LinphoneAccountCreator accountCreator;
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -58,12 +55,16 @@ public class CreateAccountCodeActivationFragment extends Fragment {
username = getArguments().getString("Username");
phone = getArguments().getString("Phone");
+ dialcode = getArguments().getString("Dialcode");
recoverAccount = getArguments().getBoolean("RecoverAccount");
- code_length = LinphonePreferences.instance().getCodeLength();
+ linkAccount = getArguments().getBoolean("LinkAccount");
- if(username == null || username.length() == 0){
- username = phone;
- }
+ code_length = LinphonePreferences.instance().getCodeLength();
+ accountCreator = new LinphoneAccountCreatorImpl(LinphoneManager.getLc(), getResources().getString(R.string.wizard_url));
+ accountCreator.setDomain(getResources().getString(R.string.default_domain));
+ accountCreator.setListener(this);
+ accountCreator.setUsername(username);
+ accountCreator.setPhoneNumber(phone, dialcode);
code = (EditText) view.findViewById(R.id.assistant_code);
code.addTextChangedListener(new TextWatcher() {
@@ -89,56 +90,79 @@ public class CreateAccountCodeActivationFragment extends Fragment {
@Override
public void onClick(View v) {
checkAccount.setEnabled(false);
- activateAccount(phone, username, code.getText().toString(), false);
- }
- });
-
- xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), getString(R.string.wizard_url));
-
- return view;
- }
-
- private void activateAccount(final String phone, final String username, final String code, boolean suscribe) {
- final Runnable runNotOk = new Runnable() {
- public void run() {
- Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show();
- }
- };
- final Runnable runOk = new Runnable() {
- public void run() {
- checkAccount.setEnabled(true);
- AssistantActivity.instance().saveCreatedAccount(username, null, null, ha1, getString(R.string.default_domain), null);
- AssistantActivity.instance().isAccountVerified(username);
- }
- };
- final Runnable runNotReachable = new Runnable() {
- public void run() {
- Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
- }
- };
-
- LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("activate_phone_account", LinphoneXmlRpcRequest.ArgType.String);
- xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
- @Override
- public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
- if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
- String response = request.getStringResponse();
- if (response.contains("ERROR")) {
- mHandler.post(runNotOk);
- } else {
- ha1 = response;
- mHandler.post(runOk);
- }
- } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
- mHandler.post(runNotReachable);
+ accountCreator.setActivationCode(code.getText().toString());
+ if(linkAccount){
+ linkAccount();
+ } else {
+ activateAccount();
}
}
});
- xmlRpcRequest.addStringArg(phone);
- xmlRpcRequest.addStringArg(username);
- xmlRpcRequest.addStringArg(code);
- xmlRpcRequest.addStringArg(getString(R.string.default_domain));
- xmlRpcSession.sendRequest(xmlRpcRequest);
+
+ return view;
+ }
+
+ private void linkAccount(){
+ accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
+ accountCreator.setHa1(LinphonePreferences.instance().getAccountHa1(LinphonePreferences.instance().getDefaultAccountIndex()));
+ accountCreator.activatePhoneNumberLink();
+ }
+
+ private void activateAccount() {
+ if(accountCreator.getUsername() == null){
+ accountCreator.setUsername(accountCreator.getPhoneNumber());
+ }
+ accountCreator.activateAccount();
+ }
+
+ @Override
+ public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ }
+
+ @Override
+ public void onAccountCreatorAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ if(status.equals(Status.AccountActivated)){
+ checkAccount.setEnabled(true);
+ if(accountCreator.getUsername() != null){
+ AssistantActivity.instance().saveCreatedAccount(accountCreator.getUsername(), null , null, accountCreator.getHa1() , getString(R.string.default_domain), null);
+ AssistantActivity.instance().isAccountVerified(accountCreator.getUsername());
+ } else {
+ AssistantActivity.instance().saveCreatedAccount(accountCreator.getPhoneNumber(), null , null, accountCreator.getHa1() , getString(R.string.default_domain), null);
+ AssistantActivity.instance().isAccountVerified(accountCreator.getPhoneNumber());
+ }
+
+ } else if (status.equals(LinphoneAccountCreator.Status.Failed)){
+ Toast.makeText(getActivity(), getString(R.string.wizard_server_unavailable), Toast.LENGTH_LONG).show();
+ } else {
+ Toast.makeText(getActivity(), getString(R.string.assistant_account_not_validated), Toast.LENGTH_LONG).show();
+ }
+ }
+
+ @Override
+ public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+
+ }
+
+ @Override
+ public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+ if(status.equals(LinphoneAccountCreator.Status.Ok)){
+ LinphonePreferences.instance().setLinkPopupTime("");
+ AssistantActivity.instance().hideKeyboard();
+ AssistantActivity.instance().finish();
+ }
+ }
+
+ @Override
+ public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
+
+ }
+
+ @Override
+ public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
}
}
diff --git a/src/org/linphone/assistant/CreateAccountFragment.java b/src/org/linphone/assistant/CreateAccountFragment.java
index 85e6a9c41..9f2bdefec 100644
--- a/src/org/linphone/assistant/CreateAccountFragment.java
+++ b/src/org/linphone/assistant/CreateAccountFragment.java
@@ -17,31 +17,24 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.linphone.LinphoneManager;
+import org.linphone.LinphonePreferences;
import org.linphone.R;
import org.linphone.core.LinphoneAccountCreator;
import org.linphone.core.LinphoneAccountCreatorImpl;
import org.linphone.core.LinphoneProxyConfig;
-import org.linphone.core.LinphoneXmlRpcRequest;
-import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener;
-import org.linphone.core.LinphoneXmlRpcRequestImpl;
-import org.linphone.core.LinphoneXmlRpcSession;
-import org.linphone.core.LinphoneXmlRpcSessionImpl;
-import org.linphone.xmlrpc.XmlRpcHelper;
import org.linphone.mediastream.Log;
-import android.Manifest;
import android.accounts.Account;
import android.accounts.AccountManager;
+import android.app.AlertDialog;
import android.app.Fragment;
-import android.content.Context;
-import android.content.pm.PackageManager;
import android.os.Bundle;
-import android.os.Handler;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextWatcher;
@@ -57,6 +50,7 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import android.widget.Toast;
import static org.linphone.core.LinphoneAccountCreator.*;
@@ -64,92 +58,102 @@ import static org.linphone.core.LinphoneAccountCreator.*;
* @author Sylvain Berfini
*/
public class CreateAccountFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, LinphoneAccountCreatorListener {
- private Handler mHandler = new Handler();
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit, emailEdit, dialCode;
- private TextView phoneNumberError, usernameError, passwordError, passwordConfirmError, emailError, sipUri;
+ private TextView phoneNumberError, usernameError, passwordError, passwordConfirmError, emailError, assisstantTitle, sipUri;
+ private ImageView phoneNumberInfo;
private boolean phoneNumberOk = false;
private boolean usernameOk = false;
private boolean passwordOk = false;
private boolean emailOk = false;
private boolean confirmPasswordOk = false;
+ private boolean linkAccount = false;
private Button createAccount, selectCountry;
private CheckBox useUsername, useEmail;
- private LinearLayout phoneNumberLayout, usernameLayout, emailLayout;
+ private int countryCode;
+ private LinearLayout phoneNumberLayout, usernameLayout, emailLayout, passwordLayout, passwordConfirmLayout;
private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]");
- private LinphoneXmlRpcSession xmlRpcSession;
private CountryListFragment.Country country;
-
private LinphoneAccountCreator accountCreator;
-
- private String getUsername() {
- if(usernameEdit != null) {
- String username = usernameEdit.getText().toString();
- return username.toLowerCase(Locale.getDefault());
- }
- return null;
- }
- private String getPhoneNumber(){
- LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
- String countryCode = dialCode.getText().toString();
- if(countryCode != null && countryCode.startsWith("+")) {
- countryCode = countryCode.substring(1);
- }
- proxyConfig.setDialPrefix(countryCode);
- return proxyConfig.normalizePhoneNumber(phoneNumberEdit.getText().toString());
- }
-
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_account_creation, container, false);
+ //Initialize accountCreator
accountCreator = new LinphoneAccountCreatorImpl(LinphoneManager.getLc(), getResources().getString(R.string.wizard_url));
accountCreator.setDomain(getResources().getString(R.string.default_domain));
accountCreator.setListener(this);
+ createAccount = (Button) view.findViewById(R.id.assistant_create);
+
+ phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout);
+ usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
+ emailLayout = (LinearLayout) view.findViewById(R.id.email_layout);
+ passwordLayout = (LinearLayout) view.findViewById(R.id.password_layout);
+ passwordConfirmLayout = (LinearLayout) view.findViewById(R.id.password_confirm_layout);
+
+ useUsername = (CheckBox) view.findViewById(R.id.use_username);
+ useEmail = (CheckBox) view.findViewById(R.id.use_email);
+
+ usernameError = (TextView) view.findViewById(R.id.username_error);
+ usernameEdit = (EditText) view.findViewById(R.id.username);
+
phoneNumberError = (TextView) view.findViewById(R.id.phone_number_error);
phoneNumberEdit = (EditText) view.findViewById(R.id.phone_number);
- phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout);
- addPhoneNumberHandler(phoneNumberEdit, null);
-
- selectCountry = (Button) view.findViewById(R.id.select_country);
- selectCountry.setOnClickListener(this);
-
- dialCode = (EditText) view.findViewById(R.id.dial_code);
sipUri = (TextView) view.findViewById(R.id.sip_uri);
+ phoneNumberInfo = (ImageView) view.findViewById(R.id.info_phone_number);
- if(getResources().getBoolean(R.bool.assistant_allow_username)) {
- useUsername = (CheckBox) view.findViewById(R.id.use_username);
- useUsername.setVisibility(View.VISIBLE);
- useUsername.setOnCheckedChangeListener(this);
+ selectCountry = (Button) view.findViewById(R.id.select_country);
+ dialCode = (EditText) view.findViewById(R.id.dial_code);
+ assisstantTitle = (TextView) view.findViewById(R.id.assistant_title);
- usernameError = (TextView) view.findViewById(R.id.username_error);
- usernameEdit = (EditText) view.findViewById(R.id.username);
- usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
+ passwordError = (TextView) view.findViewById(R.id.password_error);
+ passwordEdit = (EditText) view.findViewById(R.id.password);
- addUsernameHandler(usernameEdit, null);
+ passwordConfirmError = (TextView) view.findViewById(R.id.confirm_password_error);
+ passwordConfirmEdit = (EditText) view.findViewById(R.id.confirm_password);
+
+ emailError = (TextView) view.findViewById(R.id.email_error);
+ emailEdit = (EditText) view.findViewById(R.id.email);
+
+ //Phone number
+ if(getResources().getBoolean(R.bool.use_phone_number_validation)){
+ //Automatically get the country code from the phone
+ TelephonyManager tm = (TelephonyManager) getActivity().getApplicationContext().getSystemService(getActivity().getApplicationContext().TELEPHONY_SERVICE);
+ String countryIso = tm.getNetworkCountryIso();
+ LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
+ countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase());
+
+ phoneNumberLayout.setVisibility(View.VISIBLE);
+
+ phoneNumberInfo.setOnClickListener(this);
+ addPhoneNumberHandler(phoneNumberEdit, null);
+ addPhoneNumberHandler(dialCode, null);
+ selectCountry.setOnClickListener(this);
+
+ String previousPhone = AssistantActivity.instance().phone_number;
+ if(previousPhone != null ){
+ phoneNumberEdit.setText(previousPhone);
+ }
+ setCountry(AssistantActivity.instance().country);
+
+ //Allow user to enter a username instead use the phone number as username
+ if(getResources().getBoolean(R.bool.assistant_allow_username) ) {
+ useUsername.setVisibility(View.VISIBLE);
+ useUsername.setOnCheckedChangeListener(this);
+ }
}
- if(getResources().getBoolean(R.bool.isTablet)){
+ //Password & email address
+ if (getResources().getBoolean(R.bool.isTablet) || !getResources().getBoolean(R.bool.use_phone_number_validation)){
useEmail.setVisibility(View.VISIBLE);
- useEmail = (CheckBox) view.findViewById(R.id.use_email);
useEmail.setOnCheckedChangeListener(this);
- passwordError = (TextView) view.findViewById(R.id.password_error);
- passwordEdit = (EditText) view.findViewById(R.id.password);
-
- passwordConfirmError = (TextView) view.findViewById(R.id.confirm_password_error);
- passwordConfirmEdit = (EditText) view.findViewById(R.id.confirm_password);
-
- emailError = (TextView) view.findViewById(R.id.email_error);
- emailEdit = (EditText) view.findViewById(R.id.email);
- emailLayout = (LinearLayout) view.findViewById(R.id.email_layout);
-
- addXMLRPCPasswordHandler(passwordEdit, null);
- addXMLRPCConfirmPasswordHandler(passwordEdit, passwordConfirmEdit, null);
- addXMLRPCEmailHandler(emailEdit, null);
+ addPasswordHandler(passwordEdit, null);
+ addConfirmPasswordHandler(passwordEdit, passwordConfirmEdit, null);
+ addEmailHandler(emailEdit, null);
if (getResources().getBoolean(R.bool.pre_fill_email_in_assistant)) {
Account[] accounts = AccountManager.get(getActivity()).getAccountsByType("com.google");
@@ -158,6 +162,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
if (isEmailCorrect(account.name)) {
String possibleEmail = account.name;
emailEdit.setText(possibleEmail);
+ accountCreator.setEmail(possibleEmail);
emailOk = true;
break;
}
@@ -165,77 +170,62 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
}
}
- String previousPhone = AssistantActivity.instance().phone_number;
- if(previousPhone != null ){
- phoneNumberEdit.setText(previousPhone);
- }
- setCountry(AssistantActivity.instance().country);
- updateApplyButton();
+ //Hide phone number and display username/email/password
+ if(!getResources().getBoolean(R.bool.use_phone_number_validation)){
+ useEmail.setVisibility(View.GONE);
+ useUsername.setVisibility(View.GONE);
+
+ usernameLayout.setVisibility(View.VISIBLE);
+ passwordLayout.setVisibility(View.VISIBLE);
+ passwordConfirmLayout.setVisibility(View.VISIBLE);
+ emailLayout.setVisibility(View.VISIBLE);
+ }
+
+ //Link account with phone number
+ if(getArguments().getBoolean("LinkPhoneNumber")){
+ linkAccount = true;
+ useEmail.setVisibility(View.GONE);
+ useUsername.setVisibility(View.GONE);
+
+ usernameLayout.setVisibility(View.GONE);
+ passwordLayout.setVisibility(View.GONE);
+ passwordConfirmLayout.setVisibility(View.GONE);
+ emailLayout.setVisibility(View.GONE);
+
+ createAccount.setText(getResources().getString(R.string.assistant_link_account));
+ assisstantTitle.setText(getResources().getString(R.string.assistant_link_account));
+ }
+ addUsernameHandler(usernameEdit, null);
- createAccount = (Button) view.findViewById(R.id.assistant_create);
createAccount.setEnabled(false);
- createAccount.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- if(getResources().getBoolean(R.bool.isTablet)) {
- if (useEmail.isChecked()) {
- createAccountWithEmail(getUsername(), passwordEdit.getText().toString(), emailEdit.getText().toString(), false);
- }
- } else {
- if(getResources().getBoolean(R.bool.assistant_allow_username)){
- createAccountWithPhoneNumber(getUsername(), "", getPhoneNumber(), false);
- } else {
- createAccountWithPhoneNumber(getPhoneNumber(), "", getPhoneNumber(), false);
- }
- }
- }
- });
-
+ createAccount.setOnClickListener(this);
-
- int phoneStatePermission = getActivity().getPackageManager().checkPermission(Manifest.permission.RECORD_AUDIO, getActivity().getPackageName());
-
- if (phoneStatePermission == PackageManager.PERMISSION_GRANTED) {
- TelephonyManager mTelephonyManager;
- mTelephonyManager = (TelephonyManager) getActivity().getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
- String yourNumber = mTelephonyManager.getLine1Number();
- String iso = mTelephonyManager.getNetworkCountryIso();
- }
-
- xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), getString(R.string.wizard_url));
-
return view;
}
- private void updateApplyButton() {
-
+ @Override
+ public void onPause() {
+ super.onPause();
+ accountCreator.setListener(null);
}
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if(buttonView.getId() == R.id.use_username) {
- if(isChecked) {
- usernameLayout.setVisibility(View.VISIBLE);
- if(usernameEdit.getText().length() > 0){
- }
- } else {
- usernameLayout.setVisibility(View.GONE);
- if(phoneNumberEdit.getText().length() > 0){
- }
- }
- } else if(buttonView.getId() == R.id.use_email){
- if(isChecked) {
- emailLayout.setVisibility(View.VISIBLE);
- usernameLayout.setVisibility(View.VISIBLE);
- useUsername.setEnabled(false);
- } else {
- if(!useUsername.isChecked()) {
- usernameLayout.setVisibility(View.GONE);
- }
- emailLayout.setVisibility(View.GONE);
- usernameLayout.setVisibility(View.GONE);
- useUsername.setEnabled(true);
- }
+ private String getUsername() {
+ if(usernameEdit != null) {
+ String username = usernameEdit.getText().toString();
+ return username.toLowerCase(Locale.getDefault());
}
+ return null;
+ }
+
+ private String getCountryCode() {
+ if(dialCode != null) {
+ String code = dialCode.getText().toString();
+ if(code != null && code.startsWith("+")) {
+ code = code.substring(1);
+ }
+ return code;
+ }
+ return null;
}
public void setCountry(CountryListFragment.Country c) {
@@ -243,6 +233,43 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
if( c!= null) {
dialCode.setText(c.dial_code);
selectCountry.setText(c.name);
+ } else {
+ if(countryCode != -1){
+ dialCode.setText("+" + countryCode);
+ } else {
+ dialCode.setText("+");
+ }
+ }
+ }
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if(buttonView.getId() == R.id.use_username) {
+ if(isChecked) {
+ usernameLayout.setVisibility(View.VISIBLE);
+ if(getResources().getBoolean(R.bool.isTablet)){
+ passwordLayout.setVisibility(View.INVISIBLE);
+ }
+ } else {
+ usernameLayout.setVisibility(View.GONE);
+ }
+ } else if(buttonView.getId() == R.id.use_email){
+ if(isChecked) {
+ emailLayout.setVisibility(View.VISIBLE);
+ passwordLayout.setVisibility(View.VISIBLE);
+ passwordConfirmLayout.setVisibility(View.VISIBLE);
+ usernameLayout.setVisibility(View.VISIBLE);
+ useUsername.setEnabled(false);
+ } else {
+ if(!useUsername.isChecked()) {
+ usernameLayout.setVisibility(View.GONE);
+ }
+ emailLayout.setVisibility(View.GONE);
+ passwordLayout.setVisibility(View.GONE);
+ passwordConfirmLayout.setVisibility(View.GONE);
+ usernameLayout.setVisibility(View.GONE);
+ useUsername.setEnabled(true);
+ }
}
}
@@ -251,6 +278,24 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
switch (v.getId()){
case R.id.select_country: {
AssistantActivity.instance().displayCountryChooser();
+ break;
+ }
+
+ case R.id.info_phone_number: {
+ new AlertDialog.Builder(getActivity())
+ .setTitle(getString(R.string.phone_number_info_title))
+ .setMessage(getString(R.string.phone_number_info_content))
+ .show();
+ break;
+ }
+
+ case R.id.assistant_create: {
+ if(linkAccount){
+ addAlias();
+ } else {
+ createAccount();
+ }
+ break;
}
}
}
@@ -267,58 +312,6 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
}
}
- private boolean isUsernameCorrect(String username) {
- if (getResources().getBoolean(R.bool.allow_only_phone_numbers_in_assistant)) {
- LinphoneProxyConfig lpc = LinphoneManager.getLc().createProxyConfig();
- return lpc.isPhoneNumber(username);
- } else {
- return username.matches("^[a-z]+[a-z0-9.\\-_]{2,}$");
- }
- }
-
- private void isUsernameRegistred(final String username, final ImageView icon) {
- final Runnable runNotOk = new Runnable() {
- public void run() {
- usernameOk = false;
- displayError(usernameOk, usernameError, usernameEdit, LinphoneManager.getInstance().getContext().getString(R.string.wizard_username_unavailable));
- createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
- }
- };
- final Runnable runOk = new Runnable() {
- public void run() {
- usernameOk = true;
- displayError(usernameOk, usernameError, usernameEdit, "");
- createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
- }
- };
- final Runnable runNotReachable = new Runnable() {
- public void run() {
- usernameOk = false;
- displayError(usernameOk, usernameError, usernameEdit, LinphoneManager.getInstance().getContext().getString(R.string.wizard_server_unavailable));
- createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
- }
- };
-
- LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("is_account_used", LinphoneXmlRpcRequest.ArgType.String);
- xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
- @Override
- public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
- if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
- String response = request.getStringResponse();
- if(response.equals(XmlRpcHelper.SERVER_ERROR_ACCOUNT_DOESNT_EXIST)) {
- mHandler.post(runOk);
- } else {
- mHandler.post(runNotOk);
- }
- } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
- mHandler.post(runNotReachable);
- }
- }
- });
- xmlRpcRequest.addStringArg(username);
- xmlRpcSession.sendRequest(xmlRpcRequest);
- }
-
private boolean isEmailCorrect(String email) {
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
return emailPattern.matcher(email).matches();
@@ -327,114 +320,50 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
private boolean isPasswordCorrect(String password) {
return password.length() >= 1;
}
-
- private void createAccountWithPhoneNumber(final String username, final String password, final String phone, boolean suscribe) {
- final Runnable runNotOk = new Runnable() {
- public void run() {
- //TODO errorMessage.setText(R.string.wizard_failed);
- }
- };
- final Runnable runOk = new Runnable() {
- public void run() {
- AssistantActivity.instance().displayAssistantCodeConfirm(username, phone, false);
- }
- };
- final Runnable runNotReachable = new Runnable() {
- public void run() {
- //TODO errorMessage.setText(R.string.wizard_not_reachable);
- }
- };
-
- LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("create_phone_account", LinphoneXmlRpcRequest.ArgType.String);
- xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
- @Override
- public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
- if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
- String response = request.getStringResponse();
- if (response.contains("ERROR")) {
- mHandler.post(runNotOk);
- } else {
- mHandler.post(runOk);
- }
- } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
- mHandler.post(runNotReachable);
- }
- }
- });
- xmlRpcRequest.addStringArg(phone);
- xmlRpcRequest.addStringArg("");
- xmlRpcRequest.addStringArg("");
- xmlRpcRequest.addStringArg(LinphoneManager.getInstance().getUserAgent());
- xmlRpcRequest.addStringArg("");
- xmlRpcSession.sendRequest(xmlRpcRequest);
+ private void addAlias() {
+ accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
+ String countryCode = dialCode.getText().toString();
+ if(countryCode != null && countryCode.startsWith("+")) {
+ countryCode = countryCode.substring(1);
+ }
+ Status status = accountCreator.setPhoneNumber(phoneNumberEdit.getText().toString(), countryCode);
+ if(status.equals(Status.Ok)){
+ accountCreator.linkPhoneNumberWithAccount();
+ }
}
- private void createAccountWithEmail(final String username, final String password, String email, boolean suscribe) {
- final Runnable runNotOk = new Runnable() {
- public void run() {
- //TODO errorMessage.setText(R.string.wizard_failed);
- }
- };
- final Runnable runOk = new Runnable() {
- public void run() {
- AssistantActivity.instance().displayAssistantConfirm(username, password);
- }
- };
- final Runnable runNotReachable = new Runnable() {
- public void run() {
- //TODO errorMessage.setText(R.string.wizard_not_reachable);
- }
- };
-
- LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("create_account_with_useragent", LinphoneXmlRpcRequest.ArgType.Int);
- xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
- @Override
- public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
- if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
- int response = request.getIntResponse();
- if (response != 0) {
- mHandler.post(runNotOk);
- } else {
- mHandler.post(runOk);
- }
- } else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
- mHandler.post(runNotReachable);
- }
- }
- });
- xmlRpcRequest.addStringArg(username);
- xmlRpcRequest.addStringArg(password);
- xmlRpcRequest.addStringArg(email);
- xmlRpcRequest.addStringArg(LinphoneManager.getInstance().getUserAgent());
- xmlRpcSession.sendRequest(xmlRpcRequest);
+ private void createAccount() {
+ if(accountCreator.getUsername() == null && !useUsername.isChecked()){
+ accountCreator.setUsername(accountCreator.getPhoneNumber());
+ }
+ accountCreator.createAccount();
}
private void addPhoneNumberHandler(final EditText field, final ImageView icon) {
field.addTextChangedListener(new TextWatcher() {
- public void afterTextChanged(Editable s) {
+ public void afterTextChanged(Editable s) {}
+
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
+
+ public void onTextChanged(CharSequence s, int start, int count, int after) {
if (s.length() > 0) {
phoneNumberOk = false;
- String countryCode = dialCode.getText().toString();
- if(countryCode != null && countryCode.startsWith("+")) {
- countryCode = countryCode.substring(1);
- }
- Status status = accountCreator.setPhoneNumber(phoneNumberEdit.getText().toString(), countryCode);
+ Status status = accountCreator.setPhoneNumber(phoneNumberEdit.getText().toString(), getCountryCode());
+
if(status.equals(Status.Ok)){
accountCreator.isAccountUsed();
+ if(useUsername.isChecked()){
+ accountCreator.setUsername(field.getText().toString());
+ }
} else {
displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
+ sipUri.setText("");
}
} else {
displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, "");
}
}
-
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
- }
-
- public void onTextChanged(CharSequence s, int start, int count, int after) {
- }
});
}
@@ -457,10 +386,10 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
usernameOk = false;
Status status = accountCreator.setUsername(field.getText().toString());
if(status.equals(Status.Ok)){
- accountCreator.setPhoneNumber(null,null);
accountCreator.isAccountUsed();
} else {
displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
+ sipUri.setText("");
}
} else {
displayError(true, usernameError, usernameEdit, "");
@@ -469,50 +398,48 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
});
}
- private void addXMLRPCEmailHandler(final EditText field, final ImageView icon) {
+ private void addEmailHandler(final EditText field, final ImageView icon) {
field.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
-
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
}
public void onTextChanged(CharSequence s, int start, int count, int after)
{
emailOk = false;
- if (isEmailCorrect(field.getText().toString())) {
+ Status status = accountCreator.setEmail(field.getText().toString());
+ if (status.equals(Status.Ok)) {
emailOk = true;
displayError(emailOk, emailError, emailEdit, "");
}
else {
- displayError(emailOk, emailError, emailEdit, getString(R.string.wizard_email_incorrect));
+ displayError(emailOk, emailError, emailEdit, errorForStatus(status));
}
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
}
});
}
- private void addXMLRPCPasswordHandler(final EditText field1, final ImageView icon) {
+ private void addPasswordHandler(final EditText field1, final ImageView icon) {
TextWatcher passwordListener = new TextWatcher() {
public void afterTextChanged(Editable s) {
-
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
}
public void onTextChanged(CharSequence s, int start, int count, int after)
{
passwordOk = false;
+ Status status = accountCreator.setPassword(field1.getText().toString());
if (isPasswordCorrect(field1.getText().toString())) {
passwordOk = true;
displayError(passwordOk, passwordError, passwordEdit, "");
}
else {
- displayError(passwordOk, passwordError, passwordEdit, getString(R.string.wizard_password_incorrect));
+ displayError(passwordOk, passwordError, passwordEdit, errorForStatus(status));
}
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
}
@@ -521,50 +448,37 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
field1.addTextChangedListener(passwordListener);
}
- private void addXMLRPCConfirmPasswordHandler(final EditText field1, final EditText field2, final ImageView icon) {
+ private void addConfirmPasswordHandler(final EditText field1, final EditText field2, final ImageView icon) {
TextWatcher passwordListener = new TextWatcher() {
public void afterTextChanged(Editable s) {
-
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
}
public void onTextChanged(CharSequence s, int start, int count, int after)
{
- field2.setOnFocusChangeListener(new View.OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- if (!hasFocus) {
- confirmPasswordOk = false;
- if (field1.getText().toString().equals(field2.getText().toString())) {
- confirmPasswordOk = true;
-
- if (!isPasswordCorrect(field1.getText().toString())) {
- displayError(passwordOk, passwordError, passwordEdit, getString(R.string.wizard_password_incorrect));
- } else {
- displayError(confirmPasswordOk, passwordConfirmError, passwordConfirmEdit, "");
- }
- } else {
- displayError(confirmPasswordOk, passwordConfirmError, passwordConfirmEdit, getString(R.string.wizard_passwords_unmatched));
- }
- createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
- } else {
- displayError(true, passwordConfirmError, passwordConfirmEdit, "");
- }
+ confirmPasswordOk = false;
+ if (field1.getText().toString().equals(field2.getText().toString())) {
+ confirmPasswordOk = true;
+ if (!isPasswordCorrect(field1.getText().toString())) {
+ displayError(passwordOk, passwordError, passwordEdit, getString(R.string.wizard_password_incorrect));
+ } else {
+ displayError(confirmPasswordOk, passwordConfirmError, passwordConfirmEdit, "");
}
- });
+ } else {
+ displayError(confirmPasswordOk, passwordConfirmError, passwordConfirmEdit, getString(R.string.wizard_passwords_unmatched));
+ }
+ createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
+
}
};
-
field1.addTextChangedListener(passwordListener);
field2.addTextChangedListener(passwordListener);
}
String errorForStatus(Status status) {
- boolean isPhoneNumber = (phoneNumberEdit.getText().length() > 0);
if (status.equals(Status.EmailInvalid))
return getString(R.string.invalid_email);
if (status.equals(Status.UsernameInvalid)){
@@ -616,23 +530,38 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
@Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final Status status) {
+ if(getResources().getBoolean(R.bool.isTablet) || useEmail.isChecked()){
+ if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
+ usernameOk = false;
+ displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
+ sipUri.setText("");
+ } else {
+ usernameOk = true;
+ displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
+ sipUri.setText("Sip uri is sip:" + accountCreator.getUsername() + "@" + getResources().getString(R.string.default_domain));
+ }
+ createAccount.setEnabled(usernameOk && emailOk);
+ }
if(getResources().getBoolean(R.bool.assistant_allow_username) && useUsername.isChecked()){
if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
usernameOk = false;
displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
+ sipUri.setText("");
} else {
usernameOk = true;
displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
+ sipUri.setText("Sip uri is sip:" + accountCreator.getUsername() + "@" + getResources().getString(R.string.default_domain));
}
- createAccount.setEnabled(usernameOk && phoneNumberOk);
+ createAccount.setEnabled(usernameOk);
} else {
if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
phoneNumberOk = false;
displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
- phoneNumberOk = true;
+ sipUri.setText("");
} else {
phoneNumberOk = true;
displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
+ sipUri.setText("Sip uri is sip:" + accountCreator.getPhoneNumber() + "@" + getResources().getString(R.string.default_domain));
}
createAccount.setEnabled(phoneNumberOk);
}
@@ -640,6 +569,15 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
@Override
public void onAccountCreatorAccountCreated(LinphoneAccountCreator accountCreator, Status status) {
+ if(status.equals(Status.AccountCreated)) {
+ if(useEmail.isChecked()){
+ AssistantActivity.instance().displayAssistantConfirm(getUsername(), passwordEdit.getText().toString());
+ } else {
+ AssistantActivity.instance().displayAssistantCodeConfirm(getUsername(), phoneNumberEdit.getText().toString(), getCountryCode(), false);
+ }
+ } else {
+ Toast.makeText(getActivity().getApplicationContext(), errorForStatus(status), Toast.LENGTH_SHORT);
+ }
}
@Override
@@ -648,10 +586,16 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
@Override
public void onAccountCreatorAccountLinkedWithPhoneNumber(LinphoneAccountCreator accountCreator, Status status) {
+ if(status.equals(Status.Ok)){
+ AssistantActivity.instance().displayAssistantCodeConfirm(getUsername(), phoneNumberEdit.getText().toString(), getCountryCode(), false);
+ }
}
@Override
public void onAccountCreatorPhoneNumberLinkActivated(LinphoneAccountCreator accountCreator, Status status) {
+ if(status.equals(Status.Ok)){
+ AssistantActivity.instance().displayAssistantCodeConfirm(getUsername(), phoneNumberEdit.getText().toString(), getCountryCode(), false);
+ }
}
@Override
diff --git a/src/org/linphone/assistant/LinphoneLoginFragment.java b/src/org/linphone/assistant/LinphoneLoginFragment.java
index 898409c9b..bc20239c0 100644
--- a/src/org/linphone/assistant/LinphoneLoginFragment.java
+++ b/src/org/linphone/assistant/LinphoneLoginFragment.java
@@ -27,6 +27,7 @@ import org.linphone.mediastream.Log;
import android.app.Fragment;
import android.os.Bundle;
+import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
@@ -46,18 +47,15 @@ import android.widget.Toast;
* @author Sylvain Berfini
*/
public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener {
- private EditText login, password, displayName;
- private Button apply;
+ private EditText login, password, phoneNumberEdit, dialCode, displayName;
+ private Button apply, selectCountry;
private CheckBox useUsername, usePassword;
private LinearLayout phoneNumberLayout, usernameLayout, passwordLayout;
private TextView forgotPassword;
- private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit, emailEdit, dialCode;
- private TextView phoneNumberError, usernameError, passwordError, passwordConfirmError, emailError, sipUri;
private CountryListFragment.Country country;
- private Boolean recoverAccount = true;
-
+ private Boolean recoverAccount = false;
private LinphoneAccountCreator accountCreator;
-
+ private int countryCode;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -78,20 +76,55 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout);
addPhoneNumberHandler(phoneNumberEdit, null);
- if(getResources().getBoolean(R.bool.assistant_allow_username)) {
- useUsername = (CheckBox) view.findViewById(R.id.use_username);
- useUsername.setVisibility(View.VISIBLE);
- useUsername.setOnCheckedChangeListener(this);
+ useUsername = (CheckBox) view.findViewById(R.id.use_username);
+ usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
+ passwordLayout = (LinearLayout) view.findViewById(R.id.password_layout);
+ password = (EditText) view.findViewById(R.id.assistant_password);
+ displayName = (EditText) view.findViewById(R.id.assistant_display_name);
- usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
+ forgotPassword = (TextView) view.findViewById(R.id.forgot_password);
+ selectCountry = (Button) view.findViewById(R.id.select_country);
+
+ //Phone number
+ if(getResources().getBoolean(R.bool.use_phone_number_validation)){
+ //Automatically get the country code from the phone
+ TelephonyManager tm = (TelephonyManager) getActivity().getApplicationContext().getSystemService(getActivity().getApplicationContext().TELEPHONY_SERVICE);
+ String countryIso = tm.getNetworkCountryIso();
+ LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
+ countryCode = proxyConfig.lookupCCCFromIso(countryIso.toUpperCase());
+
+ phoneNumberLayout.setVisibility(View.VISIBLE);
+ selectCountry.setOnClickListener(this);
+
+ String previousPhone = AssistantActivity.instance().phone_number;
+ if(previousPhone != null ){
+ phoneNumberEdit.setText(previousPhone);
+ }
+ setCountry(AssistantActivity.instance().country);
+
+ //Allow user to enter a username instead use the phone number as username
+ if(getResources().getBoolean(R.bool.assistant_allow_username) ) {
+ useUsername.setVisibility(View.VISIBLE);
+ useUsername.setOnCheckedChangeListener(this);
+ }
}
- password = (EditText) view.findViewById(R.id.assistant_password);
- password.addTextChangedListener(this);
- forgotPassword = (TextView) view.findViewById(R.id.forgot_password);
- forgotPassword.setText(Compatibility.fromHtml(""+ getString(R.string.forgot_password) + ""));
- forgotPassword.setMovementMethod(LinkMovementMethod.getInstance());
- displayName = (EditText) view.findViewById(R.id.assistant_display_name);
+ if(getResources().getBoolean(R.bool.assistant_allow_username)) {
+ useUsername.setVisibility(View.VISIBLE);
+ useUsername.setOnCheckedChangeListener(this);
+ password.addTextChangedListener(this);
+ forgotPassword.setText(Compatibility.fromHtml("" + getString(R.string.forgot_password) + ""));
+ forgotPassword.setMovementMethod(LinkMovementMethod.getInstance());
+ }
+
+ //Hide phone number and display username/email/password
+ if(!getResources().getBoolean(R.bool.use_phone_number_validation)){
+ phoneNumberLayout.setVisibility(View.GONE);
+ useUsername.setVisibility(View.GONE);
+
+ usernameLayout.setVisibility(View.VISIBLE);
+ passwordLayout.setVisibility(View.VISIBLE);
+ }
apply = (Button) view.findViewById(R.id.assistant_apply);
apply.setEnabled(false);
@@ -100,6 +133,31 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
return view;
}
+ private String getCountryCode() {
+ if(dialCode != null) {
+ String code = dialCode.getText().toString();
+ if(code != null && code.startsWith("+")) {
+ code = code.substring(1);
+ }
+ return code;
+ }
+ return null;
+ }
+
+ public void setCountry(CountryListFragment.Country c) {
+ country = c;
+ if( c!= null) {
+ dialCode.setText(c.dial_code);
+ selectCountry.setText(c.name);
+ } else {
+ if(countryCode != -1){
+ dialCode.setText("+" + countryCode);
+ } else {
+ dialCode.setText("+");
+ }
+ }
+ }
+
private String getPhoneNumber(){
LinphoneProxyConfig proxyConfig = LinphoneManager.getLc().createProxyConfig();
String countryCode = dialCode.getText().toString();
@@ -116,8 +174,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
Toast.makeText(getActivity(), getString(R.string.first_launch_no_login_password), Toast.LENGTH_LONG).show();
return;
}
-
- AssistantActivity.instance().linphoneLogIn(login.getText().toString(), password.getText().toString(), null, displayName.getText().toString(), getResources().getBoolean(R.bool.assistant_account_validation_mandatory));
+ AssistantActivity.instance().linphoneLogIn(login.getText().toString(), password.getText().toString(), null, null, getResources().getBoolean(R.bool.assistant_account_validation_mandatory));
}
private void addPhoneNumberHandler(final EditText field, final ImageView icon) {
@@ -130,12 +187,10 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
countryCode = countryCode.substring(1);
}
LinphoneAccountCreator.Status status = accountCreator.setPhoneNumber(phoneNumberEdit.getText().toString(), countryCode);
- Log.w("Set PhoneNmuber " + status.toString());
if (status.equals(LinphoneAccountCreator.Status.Ok)) {
status = accountCreator.isAccountUsed();
- Log.w("Is account activated " + status.toString());
if (status.equals(LinphoneAccountCreator.Status.Ok)) {
-
+ recoverAccount = true;
}
} else {
//displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
@@ -164,10 +219,14 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
linphoneLogIn();
}
}
+ if (id == R.id.select_country) {
+ AssistantActivity.instance().displayCountryChooser();
+ }
}
private void recoverAccount() {
- accountCreator.recoverPhoneAccount();
+ //accountCreator.recoverPhoneAccount();
+ AssistantActivity.instance().displayAssistantCodeConfirm(accountCreator.getUsername(), phoneNumberEdit.getText().toString(), getCountryCode(), true);
}
@Override
@@ -183,12 +242,20 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-
+ if(buttonView.getId() == R.id.use_username) {
+ if(isChecked) {
+ usernameLayout.setVisibility(View.VISIBLE);
+ passwordLayout.setVisibility(View.VISIBLE);
+ recoverAccount = false;
+ } else {
+ usernameLayout.setVisibility(View.GONE);
+ passwordLayout.setVisibility(View.INVISIBLE);
+ }
+ }
}
@Override
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
- recoverAccount = true;
apply.setEnabled(true);
}
@@ -214,13 +281,11 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
@Override
public void onAccountCreatorIsAccountActivated(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
- Log.w("IS ACTIVATED " + status.toString());
apply.setEnabled(true);
}
@Override
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
- AssistantActivity.instance().displayAssistantCodeConfirm(getPhoneNumber(), getPhoneNumber(), true);
-
+ AssistantActivity.instance().displayAssistantCodeConfirm(accountCreator.getUsername(), phoneNumberEdit.getText().toString(), getCountryCode(), true);
}
}