-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Callbacks for Information and Error dialogs #851
Conversation
… and information dialog
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.
Looks good, much cleaner. I think there is one issue though, inline.
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.
Just some small things.
dialog/information_test.go
Outdated
func() { | ||
select { | ||
case <-tapped: | ||
case <-time.After(1 * time.Second): |
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 way too long IMO.
case <-time.After(1 * time.Second): | |
case <-time.After(100 * time.Millisecond): |
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.
Oh, when using test.Tap
you don't have to do concurrency, it's synchronous. However, using a chan
and the select
makes the test independent from the implementation of test.Tap
.
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.
It looks like this is still 1 second
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.
Sorry, fixed.
@andydotxyz @toaster Should be fixed now. Hope the solution for saving the callback for Confirm dialogs is OK? |
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.
Good solution, but could be simpler - no need for the field as the scope for “originalCallback” is within a single method
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.
seconds -> milliseconds
Thanks. |
That's great thanks. |
Description:
Motivation: (from #752): "Whenever I display an error message to the user in the error dialog, I'd like to have some way of handling when this window is dismissed.
In the case of my app, any error that I display in the error dialog is a critical one, after which I do not expect the user to continue using the app, thus dismiss action must call: window.Close() and some other cleanup code (e.g. closing DB connection, stopping goroutines).
I think callback function on the error dialog dismiss would be helpful to accomplish this task."
This pull request implements this behaviour for information and error dialogs with new "xxxWithCallback" methods.
Fixes #752
Checklist:
Where applicable: