-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix multiple click #1312
Fix multiple click #1312
Conversation
d726ab0
to
d1a3a9d
Compare
@@ -514,10 +516,26 @@ internal class SendFormViewModel @Inject constructor( | |||
) | |||
} catch (e: InvalidTransactionDataException) { | |||
showError(e.text) | |||
} finally { | |||
disableSendingForm() |
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.
are you sure that we should disable it here? what if this ends with error? looks like it will disable sending forever
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.
What I mean by disableSendingForm is that in this state, the form is not in the sending state. The finally section is always executed, even if an exception occurs. As a result, whether the operation completes successfully or an exception occurs, the form will be out of submission mode, and the user can submit it again.
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.
that's probably not the best naming then :) let's maybe call it showLoading and hideLoading for simplicity?
@@ -514,10 +516,26 @@ internal class SendFormViewModel @Inject constructor( | |||
) | |||
} catch (e: InvalidTransactionDataException) { | |||
showError(e.text) | |||
} finally { | |||
disableSendingForm() |
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.
that's probably not the best naming then :) let's maybe call it showLoading and hideLoading for simplicity?
when (isBusy) { | ||
true -> UiCirclesLoader( | ||
color1 = textColor ?: appColor.oxfordBlue800 | ||
) | ||
|
||
false -> content?.invoke() ?: Text( | ||
text = text, | ||
color = if (disabled == true) appColor.neutral800 else textColor | ||
?: appColor.oxfordBlue800, | ||
style = textStyle ?: Theme.montserrat.subtitle1 | ||
) | ||
} |
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.
there's no need for when
if conditions are true & false, just use if-else
statement
@@ -28,7 +29,8 @@ internal fun MultiColorButton( | |||
trailingIcon: Int? = null, | |||
iconColor: Color? = null, | |||
backgroundColor: Color? = null, | |||
disabled: Boolean? = false, | |||
isBusy: Boolean = false, |
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.
isBusy: Boolean = false, | |
isLoading: Boolean = false, |
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.
Done
…screen Added `launchSingleTop=true` to prevent multiple instances of the same screen from being opened. This change ensures that navigating to a destination that is already on top of the back stack will not create a new instance of that destination, thus preventing duplicate screens.
Fixes #1178