move default port to Resolver.java

This commit is contained in:
Christian Schneppe 2018-11-23 14:00:56 +01:00
parent 06ada3372e
commit 21b4f2476c
2 changed files with 10 additions and 11 deletions

View file

@ -67,6 +67,7 @@ import de.pixart.messenger.ui.util.SoftKeyboardUtils;
import de.pixart.messenger.utils.CryptoHelper;
import de.pixart.messenger.utils.MenuDoubleTabUtil;
import de.pixart.messenger.utils.Namespace;
import de.pixart.messenger.utils.Resolver;
import de.pixart.messenger.utils.SignupUtils;
import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.utils.XmppUri;
@ -563,20 +564,17 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.binding.hostname.addTextChangedListener(mTextWatcher);
this.binding.hostname.setOnFocusChangeListener(mEditTextFocusListener);
this.binding.clearDevices.setOnClickListener(v -> showWipePepDialog());
this.binding.port.setText("5222");
this.binding.port.setText(String.valueOf(Resolver.DEFAULT_PORT_XMPP));
this.binding.port.addTextChangedListener(mTextWatcher);
this.binding.saveButton.setOnClickListener(this.mSaveButtonClickListener);
this.binding.cancelButton.setOnClickListener(this.mCancelButtonClickListener);
if (savedInstanceState != null && savedInstanceState.getBoolean("showMoreTable")) {
changeMoreTableVisibility(true);
}
final OnCheckedChangeListener OnCheckedShowConfirmPassword = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
updatePortLayout();
updateSaveButton();
updateInfoButtons();
}
final OnCheckedChangeListener OnCheckedShowConfirmPassword = (buttonView, isChecked) -> {
updatePortLayout();
updateSaveButton();
updateInfoButtons();
};
this.binding.accountRegisterNew.setOnCheckedChangeListener(OnCheckedShowConfirmPassword);
if (Config.DISALLOW_REGISTRATION_IN_UI) {

View file

@ -37,6 +37,7 @@ import de.pixart.messenger.services.XmppConnectionService;
public class Resolver {
public static final int DEFAULT_PORT_XMPP = 5222;
private static final String DIRECT_TLS_SERVICE = "_xmpps-client";
private static final String STARTTLS_SERICE = "_xmpp-client";
@ -150,7 +151,7 @@ public class Resolver {
try {
Result result = new Result();
result.ip = InetAddress.getByName(domain);
result.port = 5222;
result.port = DEFAULT_PORT_XMPP;
return Collections.singletonList(result);
} catch (UnknownHostException e) {
return Collections.emptyList();
@ -270,7 +271,7 @@ public class Resolver {
public static final String AUTHENTICATED = "authenticated";
private InetAddress ip;
private DNSName hostname;
private int port = 5222;
private int port = DEFAULT_PORT_XMPP;
private boolean directTls = false;
private boolean authenticated = false;
private int priority;
@ -286,7 +287,7 @@ public class Resolver {
static Result createDefault(DNSName hostname, InetAddress ip) {
Result result = new Result();
result.port = 5222;
result.port = DEFAULT_PORT_XMPP;
result.hostname = hostname;
result.ip = ip;
return result;