mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
fix: strengthened controls on the presence of server address strings (local and remote)
This commit is contained in:
parent
6f51fd92bb
commit
c5a78bf945
2 changed files with 6 additions and 4 deletions
|
|
@ -103,8 +103,8 @@ public class ServerSignupDialog extends DialogFragment {
|
||||||
serverName = Objects.requireNonNull(bind.serverNameTextView.getText()).toString().trim();
|
serverName = Objects.requireNonNull(bind.serverNameTextView.getText()).toString().trim();
|
||||||
username = Objects.requireNonNull(bind.usernameTextView.getText()).toString().trim();
|
username = Objects.requireNonNull(bind.usernameTextView.getText()).toString().trim();
|
||||||
password = bind.lowSecurityCheckbox.isChecked() ? MusicUtil.passwordHexEncoding(Objects.requireNonNull(bind.passwordTextView.getText()).toString()) : Objects.requireNonNull(bind.passwordTextView.getText()).toString();
|
password = bind.lowSecurityCheckbox.isChecked() ? MusicUtil.passwordHexEncoding(Objects.requireNonNull(bind.passwordTextView.getText()).toString()) : Objects.requireNonNull(bind.passwordTextView.getText()).toString();
|
||||||
server = Objects.requireNonNull(bind.serverTextView.getText()).toString().trim();
|
server = bind.serverTextView.getText() != null && !bind.serverTextView.getText().toString().trim().isBlank() ? bind.serverTextView.getText().toString().trim() : null;
|
||||||
localAddress = Objects.requireNonNull(bind.localAddressTextView.getText()).toString().trim();
|
localAddress = bind.localAddressTextView.getText() != null && !bind.localAddressTextView.getText().toString().trim().isBlank() ? bind.localAddressTextView.getText().toString().trim() : null;
|
||||||
lowSecurity = bind.lowSecurityCheckbox.isChecked();
|
lowSecurity = bind.lowSecurityCheckbox.isChecked();
|
||||||
|
|
||||||
if (TextUtils.isEmpty(serverName)) {
|
if (TextUtils.isEmpty(serverName)) {
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,9 @@ object Preferences {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getInUseServerAddress(): String? {
|
fun getInUseServerAddress(): String? {
|
||||||
return App.getInstance().preferences.getString(IN_USE_SERVER_ADDRESS, getServer())
|
return App.getInstance().preferences.getString(IN_USE_SERVER_ADDRESS, null)
|
||||||
|
?.takeIf { it.isNotBlank() }
|
||||||
|
?: getServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
@ -186,7 +188,7 @@ object Preferences {
|
||||||
fun isServerSwitchable(): Boolean {
|
fun isServerSwitchable(): Boolean {
|
||||||
return App.getInstance().preferences.getLong(
|
return App.getInstance().preferences.getLong(
|
||||||
NEXT_SERVER_SWITCH, 0
|
NEXT_SERVER_SWITCH, 0
|
||||||
) + 15000 < System.currentTimeMillis()
|
) + 15000 < System.currentTimeMillis() && !getServer().isNullOrEmpty() && !getLocalAddress().isNullOrEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue