Fix register fail on delete account

This commit is contained in:
Erwan Croze 2017-05-12 16:44:14 +02:00
parent 8a7e6facd9
commit b6bf0bb74e
3 changed files with 8 additions and 14 deletions

View file

@ -524,8 +524,8 @@ public class AccountPreferencesFragment extends PreferencesListFragment implemen
delete.setOnPreferenceClickListener(new OnPreferenceClickListener() { delete.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
mPrefs.deleteAccount(n); mPrefs.deleteAccount(n);
LinphoneActivity.instance().refreshAccounts();
LinphoneActivity.instance().displaySettings(); LinphoneActivity.instance().displaySettings();
LinphoneActivity.instance().refreshAccounts();
return true; return true;
} }
}); });

View file

@ -1590,13 +1590,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
statusFragment.resetAccountStatus(); statusFragment.resetAccountStatus();
LinphoneManager.getInstance().subscribeFriendList(false); LinphoneManager.getInstance().subscribeFriendList(false);
defaultAccount.setOnClickListener(new OnClickListener() { defaultAccount.setOnClickListener(null);
@Override
public void onClick(View view) {
LinphoneActivity.instance().displayAccountSettings(0);
openOrCloseSideMenu(false);
}
});
} else { } else {
address.setText(proxy.getAddress().asStringUriOnly()); address.setText(proxy.getAddress().asStringUriOnly());
displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getAddress())); displayName.setText(LinphoneUtils.getAddressDisplayName(proxy.getAddress()));

View file

@ -783,11 +783,6 @@ public class LinphonePreferences {
} }
public void deleteAccount(int n) { public void deleteAccount(int n) {
LinphoneAuthInfo authInfo = getAuthInfo(n);
if (authInfo != null) {
getLc().removeAuthInfo(authInfo);
}
LinphoneProxyConfig proxyCfg = getProxyConfig(n); LinphoneProxyConfig proxyCfg = getProxyConfig(n);
if (proxyCfg != null) if (proxyCfg != null)
getLc().removeProxyConfig(proxyCfg); getLc().removeProxyConfig(proxyCfg);
@ -797,6 +792,11 @@ public class LinphonePreferences {
getLc().setDefaultProxyConfig(null); getLc().setDefaultProxyConfig(null);
} }
LinphoneAuthInfo authInfo = getAuthInfo(n);
if (authInfo != null) {
getLc().removeAuthInfo(authInfo);
}
getLc().refreshRegisters(); getLc().refreshRegisters();
} }
// End of accounts settings // End of accounts settings