Do not save account if username and/or domain not provided

This commit is contained in:
Gautier Pelloux-Prayer 2014-10-15 09:37:27 +02:00
parent 1105425508
commit d0c0d1c433
3 changed files with 32 additions and 19 deletions

View file

@ -20,7 +20,7 @@
<bool name="exit_button_on_dialer">false</bool>
<bool name="hide_camera_settings">false</bool>
<bool name="replace_wizard_with_old_interface">false</bool>
<bool name="replace_wizard_with_old_interface">true</bool>
<bool name="hide_wizard">false</bool>
<string name="setup_forced_proxy"></string>
<bool name="setup_cancel_move_to_back">false</bool>

View file

@ -495,9 +495,16 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
}
setListPreferenceValues(pref, entries, values);
pref.setSummary(mPrefs.getAccountTransportString(n));
pref.setDefaultValue(mPrefs.getAccountTransportKey(n));
pref.setValueIndex(entries.indexOf(mPrefs.getAccountTransportString(n)));
if (! isNewAccount) {
pref.setSummary(mPrefs.getAccountTransportString(n));
pref.setDefaultValue(mPrefs.getAccountTransportKey(n));
pref.setValueIndex(entries.indexOf(mPrefs.getAccountTransportString(n)));
} else {
pref.setSummary(getString(R.string.pref_transport_udp));
pref.setDefaultValue(getString(R.string.pref_transport_udp));
pref.setValueIndex(entries.indexOf(getString(R.string.pref_transport_udp)));
}
}
private static void setListPreferenceValues(ListPreference pref, List<CharSequence> entries, List<CharSequence> values) {

View file

@ -283,6 +283,12 @@ public class LinphonePreferences {
* @throws LinphoneCoreException
*/
public void saveNewAccount() throws LinphoneCoreException {
if (tempUsername == null || tempUsername.length() < 1 || tempDomain == null || tempDomain.length() < 1) {
Log.w("Skipping account save: username or domain not provided");
return;
}
String identity = "sip:" + tempUsername + "@" + tempDomain;
String proxy = "sip:";
if (tempProxy == null) {