forked from github/wulkanowy-mirror
Improve symbol input field (#2312)
This commit is contained in:
parent
26a95ecb99
commit
58d5196ac9
@ -100,6 +100,13 @@ class LoginSymbolFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setErrorSymbolDefinitelyInvalid() {
|
||||||
|
with(binding.loginSymbolNameLayout) {
|
||||||
|
requestFocus()
|
||||||
|
error = getString(R.string.login_invalid_symbol_definitely)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun setErrorSymbolRequire() {
|
override fun setErrorSymbolRequire() {
|
||||||
setErrorSymbol(getString(R.string.error_field_required))
|
setErrorSymbol(getString(R.string.error_field_required))
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,10 @@ class LoginSymbolPresenter @Inject constructor(
|
|||||||
view?.setErrorSymbolRequire()
|
view?.setErrorSymbolRequire()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (isFormDefinitelyInvalid()) {
|
||||||
|
view?.setErrorSymbolDefinitelyInvalid()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
loginData = loginData.copy(
|
loginData = loginData.copy(
|
||||||
symbol = view?.symbolValue?.getNormalizedSymbol(),
|
symbol = view?.symbolValue?.getNormalizedSymbol(),
|
||||||
@ -130,6 +134,13 @@ class LoginSymbolPresenter @Inject constructor(
|
|||||||
}.launch("login")
|
}.launch("login")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun isFormDefinitelyInvalid(): Boolean {
|
||||||
|
val definitelyInvalidSymbols = listOf("vulcan", "uonet", "wulkanowy", "standardowa")
|
||||||
|
val normalizedSymbol = view?.symbolValue.orEmpty().getNormalizedSymbol()
|
||||||
|
|
||||||
|
return normalizedSymbol in definitelyInvalidSymbols
|
||||||
|
}
|
||||||
|
|
||||||
fun onFaqClick() {
|
fun onFaqClick() {
|
||||||
view?.openFaqPage()
|
view?.openFaqPage()
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ interface LoginSymbolView : BaseView {
|
|||||||
|
|
||||||
fun setErrorSymbolInvalid()
|
fun setErrorSymbolInvalid()
|
||||||
|
|
||||||
|
fun setErrorSymbolDefinitelyInvalid()
|
||||||
|
|
||||||
fun setErrorSymbolRequire()
|
fun setErrorSymbolRequire()
|
||||||
|
|
||||||
fun setErrorSymbol(message: String)
|
fun setErrorSymbol(message: String)
|
||||||
|
@ -141,7 +141,9 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/loginSymbolHelper">
|
app:layout_constraintTop_toBottomOf="@+id/loginSymbolHelper"
|
||||||
|
app:placeholderText="@string/login_symbol_placeholder"
|
||||||
|
app:placeholderTextColor="?colorTertiary">
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
android:id="@+id/loginSymbolName"
|
android:id="@+id/loginSymbolName"
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
<string name="login_token_hint">Token</string>
|
<string name="login_token_hint">Token</string>
|
||||||
<string name="login_pin_hint">PIN</string>
|
<string name="login_pin_hint">PIN</string>
|
||||||
<string name="login_symbol_hint">Symbol</string>
|
<string name="login_symbol_hint">Symbol</string>
|
||||||
|
<string name="login_symbol_placeholder">E.g. \"lodz\" or \"powiatjaroslawski\"</string>
|
||||||
<string name="login_sign_in">Sign in</string>
|
<string name="login_sign_in">Sign in</string>
|
||||||
<string name="login_invalid_password">Password too short</string>
|
<string name="login_invalid_password">Password too short</string>
|
||||||
<string name="login_incorrect_password_default">Login details are incorrect</string>
|
<string name="login_incorrect_password_default">Login details are incorrect</string>
|
||||||
@ -59,7 +60,8 @@
|
|||||||
<string name="login_invalid_email">Invalid email</string>
|
<string name="login_invalid_email">Invalid email</string>
|
||||||
<string name="login_invalid_login">Use the assigned login instead of email</string>
|
<string name="login_invalid_login">Use the assigned login instead of email</string>
|
||||||
<string name="login_invalid_custom_email">Use the assigned login or email in @%1$s</string>
|
<string name="login_invalid_custom_email">Use the assigned login or email in @%1$s</string>
|
||||||
<string name="login_invalid_symbol">Invalid symbol</string>
|
<string name="login_invalid_symbol">Invalid symbol. If you cannot find it, please contact the school</string>
|
||||||
|
<string name="login_invalid_symbol_definitely">Don\'t make this up! If you cannot find it, please contact the school</string>
|
||||||
<string name="login_incorrect_symbol">Student not found. Validate the symbol and the chosen variation of the UONET+ register</string>
|
<string name="login_incorrect_symbol">Student not found. Validate the symbol and the chosen variation of the UONET+ register</string>
|
||||||
<string name="login_duplicate_student">Selected student is already logged in</string>
|
<string name="login_duplicate_student">Selected student is already logged in</string>
|
||||||
<string name="login_symbol_helper">The symbol can be found on the register page in <b>Uczeń</b> → <b>Dostęp Mobilny</b> → <b>Wygeneruj kod dostępu</b>.\n\nMake sure that you have set the appropriate register variant in the <b>UONET+ register variant</b> field on the first login screen</string>
|
<string name="login_symbol_helper">The symbol can be found on the register page in <b>Uczeń</b> → <b>Dostęp Mobilny</b> → <b>Wygeneruj kod dostępu</b>.\n\nMake sure that you have set the appropriate register variant in the <b>UONET+ register variant</b> field on the first login screen</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user