Set country call prefix if able when configuring proxy config + fixed issue when deleting account

This commit is contained in:
Sylvain Berfini 2019-05-22 11:23:20 +02:00
parent 6ae75e34b9
commit dec9442a47
7 changed files with 20 additions and 7 deletions

View file

@ -18,7 +18,7 @@
android:name="android.hardware.camera" android:name="android.hardware.camera"
android:required="false" /> android:required="false" />
<!-- Needed to be able to detect a GSM call and thus pause any active SIP call --> <!-- Needed to be able to detect a GSM call and thus pause any active SIP call, and auto fill the phone number field in assistant -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- Needed to be able to pick images from SD card to share in chat message --> <!-- Needed to be able to pick images from SD card to share in chat message -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

View file

@ -122,6 +122,13 @@ public abstract class AssistantActivity extends LinphoneGenericActivity
Log.e("[Assistant] Account creator couldn't create proxy config"); Log.e("[Assistant] Account creator couldn't create proxy config");
// TODO: display error message // TODO: display error message
} else { } else {
if (proxyConfig.getDialPrefix() == null) {
DialPlan dialPlan = getDialPlanForCurrentCountry();
if (dialPlan != null) {
proxyConfig.setDialPrefix(dialPlan.getCountryCallingCode());
}
}
LinphonePreferences.instance().firstLaunchSuccessful(); LinphonePreferences.instance().firstLaunchSuccessful();
goToLinphoneActivity(); goToLinphoneActivity();
} }

View file

@ -70,7 +70,6 @@ public class GenericConnectionAssistantActivity extends AssistantActivity implem
mAccountCreator.setDomain(mDomain.getText().toString()); mAccountCreator.setDomain(mDomain.getText().toString());
mAccountCreator.setPassword(mPassword.getText().toString()); mAccountCreator.setPassword(mPassword.getText().toString());
mAccountCreator.setDisplayName(mDisplayName.getText().toString()); mAccountCreator.setDisplayName(mDisplayName.getText().toString());
// TODO: add support for user-id in account creator
switch (mTransport.getCheckedRadioButtonId()) { switch (mTransport.getCheckedRadioButtonId()) {
case R.id.transport_udp: case R.id.transport_udp:

View file

@ -44,7 +44,6 @@ class AsyncContactsLoader extends AsyncTask<Void, Void, AsyncContactsLoader.Asyn
@SuppressLint("InlinedApi") @SuppressLint("InlinedApi")
public static final String[] PROJECTION = { public static final String[] PROJECTION = {
ContactsContract.Data.CONTACT_ID, ContactsContract.Data.CONTACT_ID,
ContactsContract.Contacts.LOOKUP_KEY,
ContactsContract.Contacts.DISPLAY_NAME_PRIMARY, ContactsContract.Contacts.DISPLAY_NAME_PRIMARY,
ContactsContract.Data.MIMETYPE, ContactsContract.Data.MIMETYPE,
ContactsContract.Contacts.STARRED, ContactsContract.Contacts.STARRED,
@ -128,8 +127,6 @@ class AsyncContactsLoader extends AsyncTask<Void, Void, AsyncContactsLoader.Asyn
String id = c.getString(c.getColumnIndex(ContactsContract.Data.CONTACT_ID)); String id = c.getString(c.getColumnIndex(ContactsContract.Data.CONTACT_ID));
boolean starred = boolean starred =
c.getInt(c.getColumnIndex(ContactsContract.Contacts.STARRED)) == 1; c.getInt(c.getColumnIndex(ContactsContract.Contacts.STARRED)) == 1;
String lookupKey =
c.getString(c.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
LinphoneContact contact = androidContactsCache.get(id); LinphoneContact contact = androidContactsCache.get(id);
if (contact == null) { if (contact == null) {

View file

@ -155,6 +155,7 @@ public class AccountSettingsFragment extends SettingsFragment {
mExpire.setInputType(InputType.TYPE_CLASS_NUMBER); mExpire.setInputType(InputType.TYPE_CLASS_NUMBER);
mPrefix = mRootView.findViewById(R.id.pref_prefix); mPrefix = mRootView.findViewById(R.id.pref_prefix);
mPrefix.setInputType(InputType.TYPE_CLASS_NUMBER);
mAvpfInterval = mRootView.findViewById(R.id.pref_avpf_rr_interval); mAvpfInterval = mRootView.findViewById(R.id.pref_avpf_rr_interval);
mAvpfInterval.setInputType(InputType.TYPE_CLASS_NUMBER); mAvpfInterval.setInputType(InputType.TYPE_CLASS_NUMBER);
@ -537,10 +538,19 @@ public class AccountSettingsFragment extends SettingsFragment {
core.removeAuthInfo(mAuthInfo); core.removeAuthInfo(mAuthInfo);
} }
} }
// Set a new default proxy config if the current one has been removed
if (core != null && core.getDefaultProxyConfig() == null) {
ProxyConfig[] proxyConfigs = core.getProxyConfigList();
if (proxyConfigs.length > 0) {
core.setDefaultProxyConfig(proxyConfigs[0]);
}
}
((SettingsActivity) getActivity()) ((SettingsActivity) getActivity())
.getSideMenuFragment() .getSideMenuFragment()
.displayAccountsInSideMenu(); .displayAccountsInSideMenu();
((SettingsActivity) getActivity()).popBackStack(); ((SettingsActivity) getActivity()).goBack();
} }
}); });

View file

@ -89,7 +89,6 @@ public class SettingsActivity extends MainActivity {
@Override @Override
public void goBack() { public void goBack() {
// 1 is for the empty fragment on tablets
if (!isTablet()) { if (!isTablet()) {
if (popBackStack()) { if (popBackStack()) {
showTopBarWithTitle(getString(R.string.settings)); showTopBarWithTitle(getString(R.string.settings));

View file

@ -81,6 +81,7 @@ public class LinphoneService extends Service {
Toast.makeText(LinphoneService.this, message, Toast.LENGTH_SHORT).show(); Toast.makeText(LinphoneService.this, message, Toast.LENGTH_SHORT).show();
if (state == Call.State.IncomingReceived) { if (state == Call.State.IncomingReceived) {
Toast.makeText(LinphoneService.this, "Incoming call received, answering it automatically", Toast.LENGTH_LONG).show();
// For this sample we will automatically answer incoming calls // For this sample we will automatically answer incoming calls
CallParams params = getCore().createCallParams(call); CallParams params = getCore().createCallParams(call);
params.enableVideo(true); params.enableVideo(true);