Add recover account
Add documentation for linphone customization
This commit is contained in:
parent
1c1f97e156
commit
b518041fb5
13 changed files with 391 additions and 114 deletions
72
doc/CustomsParameters.txt
Normal file
72
doc/CustomsParameters.txt
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
**********************************
|
||||||
|
* LINPHONE customs parameters *
|
||||||
|
**********************************
|
||||||
|
|
||||||
|
In res/values/non_localizable_custom.xml (filled with linphone default options):
|
||||||
|
|
||||||
|
1. Global
|
||||||
|
|
||||||
|
* Set the default domain used by the application:
|
||||||
|
<string name="default_domain">sip.linphone.org</string
|
||||||
|
|
||||||
|
2. Assistant
|
||||||
|
|
||||||
|
* Server xmlrpc url for accounts
|
||||||
|
<string name="wizard_url">https://sip3.linphone.org:444/inapp.php</string>
|
||||||
|
|
||||||
|
* In CreateAccount, allow username instead of phone number for creating a new account
|
||||||
|
<bool name="assistant_allow_username">true</bool>
|
||||||
|
|
||||||
|
* Hide buttons in assistant menu
|
||||||
|
<bool name="hide_linphone_accounts_in_assistant">false</bool>
|
||||||
|
<bool name="hide_generic_accounts_in_assistant">false</bool>
|
||||||
|
<bool name="hide_remote_provisioning_in_assistant">false</bool>
|
||||||
|
|
||||||
|
|
||||||
|
3. Inapp
|
||||||
|
|
||||||
|
* Enabled inapp purchase
|
||||||
|
<bool name="enable_in_app_purchase">true</bool>
|
||||||
|
|
||||||
|
* Days before end of trial period that launch daily notification to remind user to buy an account
|
||||||
|
<integer name="days_notification_shown">5</integer>
|
||||||
|
|
||||||
|
* Time between two inapp notifications in seconds
|
||||||
|
<integer name="time_between_inapp_notification">86400</integer>
|
||||||
|
|
||||||
|
* Hide username field in purchase view (automatically get from default account)
|
||||||
|
<bool name="hide_username_in_inapp">true</bool>
|
||||||
|
|
||||||
|
|
||||||
|
In res/raw/linphonerc_factory sections:
|
||||||
|
|
||||||
|
[in-app-purchase]
|
||||||
|
* Server xmlrpc url for inapp
|
||||||
|
server_url=https://sip3.linphone.org:444/inapp.php
|
||||||
|
|
||||||
|
* Item ids from the google play store
|
||||||
|
purchasable_items_ids=test_account_subscription
|
||||||
|
|
||||||
|
[app]
|
||||||
|
|
||||||
|
* Numbers of digits to enter for validation/recover account
|
||||||
|
activation_code_length=4
|
||||||
|
|
||||||
|
|
||||||
|
[assistant]
|
||||||
|
|
||||||
|
* Set the default domain used for account creation :
|
||||||
|
domain=sip.linphone.org
|
||||||
|
|
||||||
|
* Set the default password length (min-max) :
|
||||||
|
password_max_length=-1
|
||||||
|
password_min_length=1
|
||||||
|
|
||||||
|
* Set the default username length (min-max) :
|
||||||
|
username_length=-1
|
||||||
|
username_max_length=64
|
||||||
|
username_min_length=1
|
||||||
|
username_regex=^[a-z0-9_.\-]*$
|
||||||
|
|
||||||
|
* Server xmlrpc url for accounts
|
||||||
|
xmlrpc_url=https://sip3.linphone.org:444/inapp.php
|
|
@ -103,14 +103,14 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Don't use phone number as username"/>
|
android:text="@string/use_username_instead_or_phone_number"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/use_email"
|
android:id="@+id/use_email"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Don't use phone number for account activation"/>
|
android:text="@string/use_email_for_validation"/>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -34,64 +34,142 @@
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="30dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:text="@string/username"
|
android:id="@+id/phone_number_layout"
|
||||||
style="@style/font13"
|
|
||||||
android:textAllCaps="true"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<EditText
|
<Button
|
||||||
android:id="@+id/assistant_username"
|
android:id="@+id/select_country"
|
||||||
android:background="@drawable/resizable_textfield"
|
style="@style/font8"
|
||||||
android:textColor="@color/colorB"
|
android:text="@string/select_your_country"
|
||||||
android:inputType="text|textNoSuggestions"
|
android:background="@drawable/resizable_assistant_button"
|
||||||
android:contentDescription="@string/content_description_username_field"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/phone_number_label"
|
||||||
|
android:text="@string/phone_number"
|
||||||
|
style="@style/font13"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/dial_code"
|
||||||
|
android:background="@drawable/resizable_textfield"
|
||||||
|
android:textColor="@color/colorB"
|
||||||
|
android:inputType="phone"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:singleLine="true"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/phone_number"
|
||||||
|
android:background="@drawable/resizable_textfield"
|
||||||
|
android:textColor="@color/colorB"
|
||||||
|
android:contentDescription="@string/content_description_phone_number_field"
|
||||||
|
android:inputType="phone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:singleLine="true"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/phone_number_error"
|
||||||
|
android:text="@string/error"
|
||||||
|
style="@style/font20"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/sip_uri"
|
||||||
|
style="@style/font9"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/use_username"
|
||||||
|
android:visibility="visible"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp"
|
|
||||||
android:singleLine="true"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:text="@string/password"
|
|
||||||
style="@style/font13"
|
|
||||||
android:textAllCaps="true"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/assistant_password"
|
|
||||||
android:background="@drawable/resizable_textfield"
|
|
||||||
android:textColor="@color/colorB"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:singleLine="true"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/forgot_password"
|
|
||||||
android:layout_gravity="right"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"/>
|
android:text="@string/login_with_username"/>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:text="@string/assistant_display_name_optional"
|
android:id="@+id/username_layout"
|
||||||
style="@style/font13"
|
android:visibility="gone"
|
||||||
android:textAllCaps="true"
|
android:orientation="vertical"
|
||||||
android:paddingTop="15dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:id="@+id/assistant_display_name"
|
android:text="@string/username"
|
||||||
android:background="@drawable/resizable_textfield"
|
style="@style/font13"
|
||||||
android:textColor="@color/colorB"
|
android:textAllCaps="true"
|
||||||
android:inputType="textPersonName"
|
android:layout_width="match_parent"
|
||||||
android:contentDescription="@string/content_description_username_field"
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/assistant_username"
|
||||||
|
android:background="@drawable/resizable_textfield"
|
||||||
|
android:textColor="@color/colorB"
|
||||||
|
android:inputType="text|textNoSuggestions"
|
||||||
|
android:contentDescription="@string/content_description_username_field"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:singleLine="true"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/password_layout"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp"
|
android:layout_height="wrap_content">
|
||||||
android:singleLine="true"/>
|
|
||||||
|
<TextView
|
||||||
|
android:text="@string/password"
|
||||||
|
style="@style/font13"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/assistant_password"
|
||||||
|
android:background="@drawable/resizable_textfield"
|
||||||
|
android:textColor="@color/colorB"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:singleLine="true"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/forgot_password"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:singleLine="true"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/assistant_apply"
|
android:id="@+id/assistant_apply"
|
||||||
|
|
|
@ -7,7 +7,6 @@ contact="Linphone Android" <sip:linphone.android@unknown-host>
|
||||||
use_info=0
|
use_info=0
|
||||||
use_ipv6=0
|
use_ipv6=0
|
||||||
keepalive_period=30000
|
keepalive_period=30000
|
||||||
rls_uri=sip:rls@sip1.linphone.org
|
|
||||||
use_rls_presence=1
|
use_rls_presence=1
|
||||||
|
|
||||||
[video]
|
[video]
|
||||||
|
|
|
@ -12,6 +12,7 @@ register_only_when_network_is_up=1
|
||||||
auto_net_state_mon=0
|
auto_net_state_mon=0
|
||||||
auto_answer_replacing_calls=1
|
auto_answer_replacing_calls=1
|
||||||
ping_with_options=0
|
ping_with_options=0
|
||||||
|
rls_uri=sip:rls@sip.linphone.org
|
||||||
|
|
||||||
[rtp]
|
[rtp]
|
||||||
audio_rtp_port=7076
|
audio_rtp_port=7076
|
||||||
|
@ -37,7 +38,7 @@ max_calls=10
|
||||||
activation_code_length=4
|
activation_code_length=4
|
||||||
|
|
||||||
[in-app-purchase]
|
[in-app-purchase]
|
||||||
server_url=http://sip3.linphone.org/inapp.php
|
server_url=https://sip3.linphone.org:444/inapp.php
|
||||||
purchasable_items_ids=test_account_subscription
|
purchasable_items_ids=test_account_subscription
|
||||||
|
|
||||||
[assistant]
|
[assistant]
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<!-- Assistant -->
|
<!-- Assistant -->
|
||||||
<string name="wizard_url">https://sip3.linphone.org:444/inapp.php</string><!-- Url of the xmlrpc script -->
|
<string name="wizard_url">https://sip3.linphone.org:444/inapp.php</string><!-- Url of the xmlrpc script -->
|
||||||
<bool name="assistant_allow_username">false</bool> <!-- Allow to use an username instead of the phone number for account creation -->
|
<bool name="assistant_allow_username">true</bool> <!-- Allow to use an username instead of the phone number for account creation -->
|
||||||
<bool name="assistant_use_linphone_login_as_first_fragment">false</bool><!-- Start assistant in loginFragment view instead of menu -->
|
<bool name="assistant_use_linphone_login_as_first_fragment">false</bool><!-- Start assistant in loginFragment view instead of menu -->
|
||||||
<bool name="replace_assistant_with_old_interface">false</bool>
|
<bool name="replace_assistant_with_old_interface">false</bool>
|
||||||
<bool name="hide_assistant">false</bool>
|
<bool name="hide_assistant">false</bool>
|
||||||
|
@ -24,7 +24,6 @@
|
||||||
<bool name="hide_generic_accounts_in_assistant">false</bool>
|
<bool name="hide_generic_accounts_in_assistant">false</bool>
|
||||||
<bool name="hide_remote_provisioning_in_assistant">false</bool>
|
<bool name="hide_remote_provisioning_in_assistant">false</bool>
|
||||||
<bool name="display_account_assistant_at_first_start">true</bool>
|
<bool name="display_account_assistant_at_first_start">true</bool>
|
||||||
<bool name="hide_H264_downloader">false</bool><!-- Set the email field of the wizard with one of the gmail account registered on the device -->
|
|
||||||
|
|
||||||
<!-- Remote provisioning -->
|
<!-- Remote provisioning -->
|
||||||
<bool name="display_sms_remote_provisioning_activity">false</bool>
|
<bool name="display_sms_remote_provisioning_activity">false</bool>
|
||||||
|
@ -33,9 +32,9 @@
|
||||||
<bool name="allow_cancel_remote_provisioning_login_activity">true</bool>
|
<bool name="allow_cancel_remote_provisioning_login_activity">true</bool>
|
||||||
|
|
||||||
<!-- Inapp -->
|
<!-- Inapp -->
|
||||||
<bool name="enabled_in_app_purchase">true</bool>
|
<bool name="enable_in_app_purchase">true</bool>
|
||||||
<bool name="in_app_purchase_in_settings">true</bool>
|
<integer name="days_notification_shown">5</integer><!-- Notification shown before end of trial version in days -->
|
||||||
<integer name="number_days_reminder">28</integer><!-- Remind to biy account -->
|
<integer name="time_between_inapp_notification">86400</integer><!-- Time between two inapp notifications in seconds -->
|
||||||
<bool name="hide_username_in_inapp">true</bool>
|
<bool name="hide_username_in_inapp">true</bool>
|
||||||
|
|
||||||
<!-- Push notification settings -->
|
<!-- Push notification settings -->
|
||||||
|
|
|
@ -101,6 +101,9 @@
|
||||||
<string name="assistant_choose_country">Choose a country</string>
|
<string name="assistant_choose_country">Choose a country</string>
|
||||||
<string name="select_your_country">Select your Country</string>
|
<string name="select_your_country">Select your Country</string>
|
||||||
<string name="country_code">(%s)</string>
|
<string name="country_code">(%s)</string>
|
||||||
|
<string name="use_username_instead_or_phone_number">Don\'t use phone number as username</string>
|
||||||
|
<string name="use_email_for_validation">Use email address for account validation</string>
|
||||||
|
<string name="login_with_username">Log in with username</string>
|
||||||
|
|
||||||
<!-- Status -->
|
<!-- Status -->
|
||||||
<string name="invalid_email">Invalid email</string>
|
<string name="invalid_email">Invalid email</string>
|
||||||
|
@ -122,7 +125,8 @@
|
||||||
<!-- In-app -->
|
<!-- In-app -->
|
||||||
<string name="inapp">In-app</string>
|
<string name="inapp">In-app</string>
|
||||||
<string name="inapp_notification_title">In-app purchase</string>
|
<string name="inapp_notification_title">In-app purchase</string>
|
||||||
<string name="inapp_notification_content">The trail period expires on %s</string>
|
<string name="inapp_notification_trial_expire">The trail period expires on %s</string>
|
||||||
|
<string name="inapp_notification_account_expire">The subscription period expires on %s</string>
|
||||||
|
|
||||||
<!-- Dailer -->
|
<!-- Dailer -->
|
||||||
<string name="address_bar_hint">Enter a number or an address</string>
|
<string name="address_bar_hint">Enter a number or an address</string>
|
||||||
|
|
|
@ -125,6 +125,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
private Fragment.SavedState dialerSavedState;
|
private Fragment.SavedState dialerSavedState;
|
||||||
private boolean newProxyConfig;
|
private boolean newProxyConfig;
|
||||||
private boolean emptyFragment = false;
|
private boolean emptyFragment = false;
|
||||||
|
private boolean isTrialAccount = false;
|
||||||
private OrientationEventListener mOrientationHelper;
|
private OrientationEventListener mOrientationHelper;
|
||||||
private LinphoneCoreListenerBase mListener;
|
private LinphoneCoreListenerBase mListener;
|
||||||
private LinearLayout mTabBar;
|
private LinearLayout mTabBar;
|
||||||
|
@ -201,7 +202,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
initButtons();
|
initButtons();
|
||||||
initSideMenu();
|
initSideMenu();
|
||||||
|
|
||||||
if(getResources().getBoolean(R.bool.enabled_in_app_purchase)){
|
if(getResources().getBoolean(R.bool.enable_in_app_purchase)){
|
||||||
isTrialAccount();
|
isTrialAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,7 +629,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayInapp() {
|
public void displayInapp() {
|
||||||
checkAndRequestInappPermission();
|
|
||||||
startActivity(new Intent(LinphoneActivity.this, InAppPurchaseActivity.class));
|
startActivity(new Intent(LinphoneActivity.this, InAppPurchaseActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1470,8 +1470,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
public void initSideMenu() {
|
public void initSideMenu() {
|
||||||
|
|
||||||
sideMenu = (DrawerLayout) findViewById(R.id.side_menu);
|
sideMenu = (DrawerLayout) findViewById(R.id.side_menu);
|
||||||
if(getResources().getBoolean(R.bool.in_app_purchase_in_settings)){
|
if(getResources().getBoolean(R.bool.enable_in_app_purchase)){
|
||||||
sideMenuItems = new String[]{getResources().getString(R.string.menu_assistant),getResources().getString(R.string.menu_settings),getResources().getString(R.string.menu_about), getResources().getString(R.string.inapp)};
|
sideMenuItems = new String[]{getResources().getString(R.string.menu_assistant),getResources().getString(R.string.menu_settings),getResources().getString(R.string.inapp), getResources().getString(R.string.menu_about)};
|
||||||
} else {
|
} else {
|
||||||
sideMenuItems = new String[]{getResources().getString(R.string.menu_assistant),getResources().getString(R.string.menu_settings),getResources().getString(R.string.menu_about)};
|
sideMenuItems = new String[]{getResources().getString(R.string.menu_assistant),getResources().getString(R.string.menu_settings),getResources().getString(R.string.menu_about)};
|
||||||
}
|
}
|
||||||
|
@ -1492,7 +1492,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
if (sideMenuItemList.getAdapter().getItem(i).toString().equals(getString(R.string.menu_assistant))) {
|
if (sideMenuItemList.getAdapter().getItem(i).toString().equals(getString(R.string.menu_assistant))) {
|
||||||
LinphoneActivity.instance().displayAssistant();
|
LinphoneActivity.instance().displayAssistant();
|
||||||
}
|
}
|
||||||
if(getResources().getBoolean(R.bool.in_app_purchase_in_settings)){
|
if(getResources().getBoolean(R.bool.enable_in_app_purchase)){
|
||||||
if (sideMenuItemList.getAdapter().getItem(i).toString().equals(getString(R.string.inapp))) {
|
if (sideMenuItemList.getAdapter().getItem(i).toString().equals(getString(R.string.inapp))) {
|
||||||
LinphoneActivity.instance().displayInapp();
|
LinphoneActivity.instance().displayInapp();
|
||||||
}
|
}
|
||||||
|
@ -1678,10 +1678,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
helper.isTrialAccountAsync(new XmlRpcListenerBase() {
|
helper.isTrialAccountAsync(new XmlRpcListenerBase() {
|
||||||
@Override
|
@Override
|
||||||
public void onTrialAccountFetched(boolean isTrial) {
|
public void onTrialAccountFetched(boolean isTrial) {
|
||||||
if (isTrial) {
|
isTrialAccount = isTrial;
|
||||||
getExpirationAccount();
|
getExpirationAccount();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error){}
|
||||||
}, LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()), LinphonePreferences.instance().getAccountHa1(LinphonePreferences.instance().getDefaultAccountIndex()));
|
}, LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()), LinphonePreferences.instance().getAccountHa1(LinphonePreferences.instance().getDefaultAccountIndex()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1699,12 +1701,14 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
calresult.setTimeInMillis(timestamp);
|
calresult.setTimeInMillis(timestamp);
|
||||||
|
|
||||||
int diff = getDiffDays(calresult, Calendar.getInstance());
|
int diff = getDiffDays(calresult, Calendar.getInstance());
|
||||||
if (diff != -1 && diff <= getResources().getInteger(R.integer.number_days_reminder)) {
|
if (diff != -1 && diff <= getResources().getInteger(R.integer.days_notification_shown)) {
|
||||||
displayInappNotification(timestampToHumanDate(calresult));
|
displayInappNotification(timestampToHumanDate(calresult));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error){}
|
||||||
}, LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()), LinphonePreferences.instance().getAccountHa1(LinphonePreferences.instance().getDefaultAccountIndex()));
|
}, LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()), LinphonePreferences.instance().getAccountHa1(LinphonePreferences.instance().getDefaultAccountIndex()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1715,7 +1719,12 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
} else {
|
} else {
|
||||||
LinphonePreferences.instance().setLastDateNotificationShown(timestampToHumanDate(Calendar.getInstance()));
|
LinphonePreferences.instance().setLastDateNotificationShown(timestampToHumanDate(Calendar.getInstance()));
|
||||||
}
|
}
|
||||||
LinphoneService.instance().displayInappNotification(String.format(getString(R.string.inapp_notification_content), date));
|
if(isTrialAccount){
|
||||||
|
LinphoneService.instance().displayInappNotification(String.format(getString(R.string.inapp_notification_trial_expire), date));
|
||||||
|
} else {
|
||||||
|
LinphoneService.instance().displayInappNotification(String.format(getString(R.string.inapp_notification_account_expire), date));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String timestampToHumanDate(Calendar cal) {
|
private String timestampToHumanDate(Calendar cal) {
|
||||||
|
|
|
@ -143,14 +143,6 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
findPreference(getString(R.string.pref_in_app_store_key)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
Intent intent = new Intent(LinphoneService.instance(), InAppPurchaseActivity.class);
|
|
||||||
startActivityForResult(intent, STORE_INTENT);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets listener for each preference to update the matching value in linphonecore
|
// Sets listener for each preference to update the matching value in linphonecore
|
||||||
|
@ -174,10 +166,6 @@ public class SettingsFragment extends PreferencesListFragment {
|
||||||
hidePreference(R.string.pref_add_account_key);
|
hidePreference(R.string.pref_add_account_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getResources().getBoolean(R.bool.in_app_purchase_in_settings)){
|
|
||||||
hidePreference(R.string.pref_in_app_store_key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
if (getResources().getBoolean(R.bool.disable_chat)) {
|
||||||
findPreference(getString(R.string.pref_image_sharing_server_key)).setLayoutResource(R.layout.hidden);
|
findPreference(getString(R.string.pref_image_sharing_server_key)).setLayoutResource(R.layout.hidden);
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,22 +294,22 @@ private static AssistantActivity instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logIn(String username, String password, String displayName, String domain, TransportType transport, boolean sendEcCalibrationResult) {
|
private void logIn(String username, String password, String ha1, String displayName, String domain, TransportType transport, boolean sendEcCalibrationResult) {
|
||||||
saveCreatedAccount(username, password, displayName, null, domain, transport);
|
saveCreatedAccount(username, password, displayName, ha1, domain, transport);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAccount(String username, String password, String displayName, String domain) {
|
public void checkAccount(String username, String password, String displayName, String domain) {
|
||||||
saveCreatedAccount(username, password, displayName, null, domain, null);
|
saveCreatedAccount(username, password, displayName, null, domain, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void linphoneLogIn(String username, String password, String displayName, boolean validate) {
|
public void linphoneLogIn(String username, String password, String ha1, String displayName, boolean validate) {
|
||||||
if (validate) {
|
if (validate) {
|
||||||
checkAccount(username, password, displayName, getString(R.string.default_domain));
|
checkAccount(username, password, displayName, getString(R.string.default_domain));
|
||||||
} else {
|
} else {
|
||||||
if(accountCreated) {
|
if(accountCreated) {
|
||||||
retryLogin(username, password, displayName, getString(R.string.default_domain), null);
|
retryLogin(username, password, displayName, getString(R.string.default_domain), null);
|
||||||
} else {
|
} else {
|
||||||
logIn(username, password, displayName, getString(R.string.default_domain), null, true);
|
logIn(username, password, ha1, displayName, getString(R.string.default_domain), null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ private static AssistantActivity instance;
|
||||||
if (accountCreated) {
|
if (accountCreated) {
|
||||||
retryLogin(username, password, displayName, domain, transport);
|
retryLogin(username, password, displayName, domain, transport);
|
||||||
} else {
|
} else {
|
||||||
logIn(username, password, displayName, domain, transport, false);
|
logIn(username, password, null, displayName, domain, transport, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,12 +525,13 @@ private static AssistantActivity instance;
|
||||||
back.setVisibility(View.INVISIBLE);
|
back.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayAssistantCodeConfirm(String username, String phone) {
|
public void displayAssistantCodeConfirm(String username, String phone, boolean recoverAccount) {
|
||||||
CreateAccountCodeActivationFragment fragment = new CreateAccountCodeActivationFragment();
|
CreateAccountCodeActivationFragment fragment = new CreateAccountCodeActivationFragment();
|
||||||
newAccount = true;
|
newAccount = true;
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
extras.putString("Username", username);
|
extras.putString("Username", username);
|
||||||
extras.putString("Phone", phone);
|
extras.putString("Phone", phone);
|
||||||
|
extras.putBoolean("RecoverAccount", recoverAccount);
|
||||||
fragment.setArguments(extras);
|
fragment.setArguments(extras);
|
||||||
changeFragment(fragment);
|
changeFragment(fragment);
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.linphone.mediastream.Log;
|
||||||
public class CreateAccountCodeActivationFragment extends Fragment {
|
public class CreateAccountCodeActivationFragment extends Fragment {
|
||||||
private String username, phone, ha1;
|
private String username, phone, ha1;
|
||||||
private EditText code;
|
private EditText code;
|
||||||
|
private boolean recoverAccount;
|
||||||
private int code_length;
|
private int code_length;
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private Button checkAccount;
|
private Button checkAccount;
|
||||||
|
@ -57,6 +58,7 @@ public class CreateAccountCodeActivationFragment extends Fragment {
|
||||||
|
|
||||||
username = getArguments().getString("Username");
|
username = getArguments().getString("Username");
|
||||||
phone = getArguments().getString("Phone");
|
phone = getArguments().getString("Phone");
|
||||||
|
recoverAccount = getArguments().getBoolean("RecoverAccount");
|
||||||
code_length = LinphonePreferences.instance().getCodeLength();
|
code_length = LinphonePreferences.instance().getCodeLength();
|
||||||
|
|
||||||
if(username == null || username.length() == 0){
|
if(username == null || username.length() == 0){
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.linphone.core.LinphoneXmlRpcRequestImpl;
|
||||||
import org.linphone.core.LinphoneXmlRpcSession;
|
import org.linphone.core.LinphoneXmlRpcSession;
|
||||||
import org.linphone.core.LinphoneXmlRpcSessionImpl;
|
import org.linphone.core.LinphoneXmlRpcSessionImpl;
|
||||||
import org.linphone.xmlrpc.XmlRpcHelper;
|
import org.linphone.xmlrpc.XmlRpcHelper;
|
||||||
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
|
@ -104,21 +105,11 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
||||||
View view = inflater.inflate(R.layout.assistant_account_creation, container, false);
|
View view = inflater.inflate(R.layout.assistant_account_creation, container, false);
|
||||||
|
|
||||||
accountCreator = new LinphoneAccountCreatorImpl(LinphoneManager.getLc(), getResources().getString(R.string.wizard_url));
|
accountCreator = new LinphoneAccountCreatorImpl(LinphoneManager.getLc(), getResources().getString(R.string.wizard_url));
|
||||||
|
accountCreator.setDomain(getResources().getString(R.string.default_domain));
|
||||||
accountCreator.setListener(this);
|
accountCreator.setListener(this);
|
||||||
|
|
||||||
phoneNumberError = (TextView) view.findViewById(R.id.phone_number_error);
|
phoneNumberError = (TextView) view.findViewById(R.id.phone_number_error);
|
||||||
phoneNumberEdit = (EditText) view.findViewById(R.id.phone_number);
|
phoneNumberEdit = (EditText) view.findViewById(R.id.phone_number);
|
||||||
phoneNumberEdit.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {}
|
|
||||||
});
|
|
||||||
phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout);
|
phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout);
|
||||||
addPhoneNumberHandler(phoneNumberEdit, null);
|
addPhoneNumberHandler(phoneNumberEdit, null);
|
||||||
|
|
||||||
|
@ -225,12 +216,10 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
||||||
if(isChecked) {
|
if(isChecked) {
|
||||||
usernameLayout.setVisibility(View.VISIBLE);
|
usernameLayout.setVisibility(View.VISIBLE);
|
||||||
if(usernameEdit.getText().length() > 0){
|
if(usernameEdit.getText().length() > 0){
|
||||||
sipUri.setText("Sip uri is sip:" + usernameEdit.getText().toString() + "@sip.linphone.org");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
usernameLayout.setVisibility(View.GONE);
|
usernameLayout.setVisibility(View.GONE);
|
||||||
if(phoneNumberEdit.getText().length() > 0){
|
if(phoneNumberEdit.getText().length() > 0){
|
||||||
sipUri.setText("Sip uri is sip:" + phoneNumberEdit.getText().toString() + "@sip.linphone.org");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(buttonView.getId() == R.id.use_email){
|
} else if(buttonView.getId() == R.id.use_email){
|
||||||
|
@ -340,7 +329,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAccountWithPhoneNumber(final String username, final String password, final String phone, boolean suscribe) {
|
private void createAccountWithPhoneNumber(final String username, final String password, final String phone, boolean suscribe) {
|
||||||
AssistantActivity.instance().displayAssistantCodeConfirm(username, phone);
|
|
||||||
final Runnable runNotOk = new Runnable() {
|
final Runnable runNotOk = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
//TODO errorMessage.setText(R.string.wizard_failed);
|
//TODO errorMessage.setText(R.string.wizard_failed);
|
||||||
|
@ -348,7 +337,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
||||||
};
|
};
|
||||||
final Runnable runOk = new Runnable() {
|
final Runnable runOk = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
AssistantActivity.instance().displayAssistantCodeConfirm(username, phone);
|
AssistantActivity.instance().displayAssistantCodeConfirm(username, phone, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final Runnable runNotReachable = new Runnable() {
|
final Runnable runNotReachable = new Runnable() {
|
||||||
|
@ -611,6 +600,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
||||||
return getString(R.string.transport_unsupported);
|
return getString(R.string.transport_unsupported);
|
||||||
if (status.equals(Status.AccountExist))
|
if (status.equals(Status.AccountExist))
|
||||||
return getString(R.string.account_already_exist);
|
return getString(R.string.account_already_exist);
|
||||||
|
if (status.equals(Status.AccountExistWithAlias))
|
||||||
|
return getString(R.string.account_already_exist);
|
||||||
if (status.equals(Status.AccountCreated)
|
if (status.equals(Status.AccountCreated)
|
||||||
|| status.equals(Status.AccountNotCreated)
|
|| status.equals(Status.AccountNotCreated)
|
||||||
|| status.equals(Status.AccountNotExist)
|
|| status.equals(Status.AccountNotExist)
|
||||||
|
@ -626,18 +617,19 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
||||||
@Override
|
@Override
|
||||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final Status status) {
|
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final Status status) {
|
||||||
if(getResources().getBoolean(R.bool.assistant_allow_username) && useUsername.isChecked()){
|
if(getResources().getBoolean(R.bool.assistant_allow_username) && useUsername.isChecked()){
|
||||||
if (status.equals(Status.AccountNotExist)) {
|
if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
|
||||||
usernameOk = true;
|
usernameOk = false;
|
||||||
displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
|
displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
|
||||||
} else {
|
} else {
|
||||||
usernameOk = false;
|
usernameOk = true;
|
||||||
displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
|
displayError(usernameOk, usernameError, usernameEdit, errorForStatus(status));
|
||||||
}
|
}
|
||||||
createAccount.setEnabled(usernameOk && phoneNumberOk);
|
createAccount.setEnabled(usernameOk && phoneNumberOk);
|
||||||
} else {
|
} else {
|
||||||
if (status.equals(Status.AccountNotExist)) {
|
if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
|
||||||
phoneNumberOk = true;
|
phoneNumberOk = false;
|
||||||
displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
|
displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
|
||||||
|
phoneNumberOk = true;
|
||||||
} else {
|
} else {
|
||||||
phoneNumberOk = true;
|
phoneNumberOk = true;
|
||||||
displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
|
displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
|
||||||
|
|
|
@ -17,8 +17,13 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
|
import org.linphone.core.LinphoneAccountCreator;
|
||||||
|
import org.linphone.core.LinphoneAccountCreatorImpl;
|
||||||
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -30,46 +35,122 @@ import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
/**
|
/**
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
*/
|
*/
|
||||||
public class LinphoneLoginFragment extends Fragment implements OnClickListener, TextWatcher {
|
public class LinphoneLoginFragment extends Fragment implements CompoundButton.OnCheckedChangeListener, OnClickListener, TextWatcher, LinphoneAccountCreator.LinphoneAccountCreatorListener {
|
||||||
private EditText login, password, displayName;
|
private EditText login, password, displayName;
|
||||||
private Button apply;
|
private Button apply;
|
||||||
|
private CheckBox useUsername, usePassword;
|
||||||
|
private LinearLayout phoneNumberLayout, usernameLayout, passwordLayout;
|
||||||
private TextView forgotPassword;
|
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 LinphoneAccountCreator accountCreator;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.assistant_linphone_login, container, false);
|
View view = inflater.inflate(R.layout.assistant_linphone_login, container, false);
|
||||||
|
|
||||||
|
accountCreator = new LinphoneAccountCreatorImpl(LinphoneManager.getLc(), getResources().getString(R.string.wizard_url));
|
||||||
|
accountCreator.setListener(this);
|
||||||
|
|
||||||
String url = "http://linphone.org/free-sip-service.html&action=recover";
|
String url = "http://linphone.org/free-sip-service.html&action=recover";
|
||||||
|
|
||||||
login = (EditText) view.findViewById(R.id.assistant_username);
|
login = (EditText) view.findViewById(R.id.assistant_username);
|
||||||
login.addTextChangedListener(this);
|
login.addTextChangedListener(this);
|
||||||
|
|
||||||
|
dialCode = (EditText) view.findViewById(R.id.dial_code);
|
||||||
|
|
||||||
|
phoneNumberEdit = (EditText) view.findViewById(R.id.phone_number);
|
||||||
|
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);
|
||||||
|
|
||||||
|
usernameLayout = (LinearLayout) view.findViewById(R.id.username_layout);
|
||||||
|
}
|
||||||
|
|
||||||
password = (EditText) view.findViewById(R.id.assistant_password);
|
password = (EditText) view.findViewById(R.id.assistant_password);
|
||||||
password.addTextChangedListener(this);
|
password.addTextChangedListener(this);
|
||||||
forgotPassword = (TextView) view.findViewById(R.id.forgot_password);
|
forgotPassword = (TextView) view.findViewById(R.id.forgot_password);
|
||||||
forgotPassword.setText(Compatibility.fromHtml("<a href=\"" + url + "\"'>"+ getString(R.string.forgot_password) + "</a>"));
|
forgotPassword.setText(Compatibility.fromHtml("<a href=\"" + url + "\"'>"+ getString(R.string.forgot_password) + "</a>"));
|
||||||
forgotPassword.setMovementMethod(LinkMovementMethod.getInstance());
|
forgotPassword.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
displayName = (EditText) view.findViewById(R.id.assistant_display_name);
|
displayName = (EditText) view.findViewById(R.id.assistant_display_name);
|
||||||
|
|
||||||
apply = (Button) view.findViewById(R.id.assistant_apply);
|
apply = (Button) view.findViewById(R.id.assistant_apply);
|
||||||
apply.setEnabled(false);
|
apply.setEnabled(false);
|
||||||
apply.setOnClickListener(this);
|
apply.setOnClickListener(this);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void linphoneLogIn() {
|
public void linphoneLogIn() {
|
||||||
if (login.getText() == null || login.length() == 0 || password.getText() == null || password.length() == 0) {
|
if (login.getText() == null || login.length() == 0 || password.getText() == null || password.length() == 0) {
|
||||||
Toast.makeText(getActivity(), getString(R.string.first_launch_no_login_password), Toast.LENGTH_LONG).show();
|
Toast.makeText(getActivity(), getString(R.string.first_launch_no_login_password), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AssistantActivity.instance().linphoneLogIn(login.getText().toString(), password.getText().toString(), displayName.getText().toString(), getResources().getBoolean(R.bool.assistant_account_validation_mandatory));
|
AssistantActivity.instance().linphoneLogIn(login.getText().toString(), password.getText().toString(), null, displayName.getText().toString(), getResources().getBoolean(R.bool.assistant_account_validation_mandatory));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addPhoneNumberHandler(final EditText field, final ImageView icon) {
|
||||||
|
field.addTextChangedListener(new TextWatcher() {
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
if (s.length() > 0) {
|
||||||
|
//phoneNumberOk = false;
|
||||||
|
String countryCode = dialCode.getText().toString();
|
||||||
|
if (countryCode != null && countryCode.startsWith("+")) {
|
||||||
|
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)) {
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//displayError(phoneNumberOk, phoneNumberError, phoneNumberEdit, errorForStatus(status));
|
||||||
|
}
|
||||||
|
} 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) {
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -77,10 +158,18 @@ public class LinphoneLoginFragment extends Fragment implements OnClickListener,
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
if (id == R.id.assistant_apply) {
|
if (id == R.id.assistant_apply) {
|
||||||
linphoneLogIn();
|
if(recoverAccount){
|
||||||
|
recoverAccount();
|
||||||
|
} else {
|
||||||
|
linphoneLogIn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void recoverAccount() {
|
||||||
|
accountCreator.recoverPhoneAccount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||||
|
|
||||||
|
@ -91,4 +180,47 @@ public class LinphoneLoginFragment extends Fragment implements OnClickListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {}
|
public void afterTextChanged(Editable s) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||||
|
recoverAccount = true;
|
||||||
|
apply.setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
Log.w("IS ACTIVATED " + status.toString());
|
||||||
|
apply.setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAccountCreatorPhoneAccountRecovered(LinphoneAccountCreator accountCreator, LinphoneAccountCreator.Status status) {
|
||||||
|
AssistantActivity.instance().displayAssistantCodeConfirm(getPhoneNumber(), getPhoneNumber(), true);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue