Closed clementpadovani closed 7 years ago
@markohlebar after some fiddling I’m getting some fixed results with an alert. the system doesn’t seem to really like having an alert come from an extension. And TBH it doesn’t really feel right
@ClementPadovani what happened? I just tried it and it worked fine. Did you do
DispatchQueue.main.async {
//present NSAlert
}
?
The docs say There are no guarantees about the thread or queue on which the cancellation handler is invoked.
. Is that the problem?
@ClementPadovani re-read that last thing again, not sure it's relevant but it might be that there are no guarantees on which thread the performCommandWithInvocation
is called either.
@markohlebar Yes I had this issue, however instead of wrapping it around a DispatchQueue
I used OperationQueue.mainQueue
.
@ClementPadovani what's the actual problem, is it flaky in presentation even when you dispatch it on the main queue?
@markohlebar Okay so I figured out the issue. The alert was actually being displayed, however it was hidden behind Xcode. https://github.com/markohlebar/Import/pull/11/commits/816db1d71fb32e775f156c28f5440aad829c95b9 fixes that issue.
I had to pass the completion handler as a parameter since calling it would kill the extension. Thus preventing the alert being shown and doing its work.
Hey @ClementPadovani checked the PR, looks good!
However, I'd say that there is kind of a bias as to what "Remove Import" would do. At the first hunch it would remove the import from the top, so that's kinda bad.
On the other hand, I would expect "Cancel" to just remove the import statement as the "Remove Import" button does at the moment. There is no use for it anyways, so as a flow of importing something I think removing it as a default action would be OK, what do you think?
@markohlebar fixed with d8c60d7
@ClementPadovani awesome!
Adds fixes for #9