-
Notifications
You must be signed in to change notification settings - Fork 98
Show errors in create and edit only after the user makes one #1140
Show errors in create and edit only after the user makes one #1140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the tests. Love the regex. Some nits re: naming that can be cleaned up 👍
// We use a marker error for an error we don't tell the user about, | ||
// but will cause the save button to be disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect 👏
app/src/main/java/mozilla/lockbox/presenter/ItemMutationPresenter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/mozilla/lockbox/presenter/ItemMutationPresenter.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/mozilla/lockbox/presenter/ItemMutationPresenter.kt
Outdated
Show resolved
Hide resolved
override val togglePasswordClicks: Observable<Unit> | ||
get() = view!!.btnPasswordToggle.clicks().mergeWith(togglePasswordVisibility) | ||
get() = view!!.btnPasswordToggle.clicks().mergeWith(passwordFocus.map { Unit }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
@@ -55,6 +53,15 @@ open class ItemMutationFragment : BackableFragment(), ItemMutationView { | |||
override val passwordChanged: Observable<String> | |||
get() = view!!.inputPassword.textChanges().map { it.toString() } | |||
|
|||
override val hostnameFocus | |||
get() = focusChanges(view!!.inputHostname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use view?.inputHostname
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Same with pwd and username)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This is a well established pattern.
Additionally, passing an optional to focusChanges
means we get an optional back. We should fail fast here if there is a problem with the layout.xml
.
view.inputPassword?.setSelection(view.inputPassword?.length() ?: 0) | ||
} | ||
} | ||
open fun setupKeyboardFocus(view: View) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be removed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Edit
and Create
subclasses are still called. I don't understand the code enough to say if those methods can be rendered obsolete.
I've added comment to this effect.
Bitrise failure:
|
0dd952a
to
af4eb72
Compare
d2cd427
to
58cca7d
Compare
58cca7d
to
e4537a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏 👏 very nice very nice
@eliserichards Also fixes #1131 |
Thank you @turkergoksu! Good catch! 🔥 |
Fixes #1120
This includes a number of fixes in displaying errors during manual create, which is inherited by edit.
http
orhttps
then don't show an error until they make a mistake