-
Notifications
You must be signed in to change notification settings - Fork 286
Notification rewrite #2146
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
Notification rewrite #2146
Conversation
No hard feelings on that.
Your way certainly looks better for us programmers, but not for users. 😛 I don’t know if I can get behind a notification rewrite that doesn’t use Notification Center at this point. |
Well, I do get your point but don't understand "it doesn't use Notification Center". 411cfb8 adds that support, but I have doubts on the UX part of it, which is why I asked in the PR. Here are the shortcomings I've thought about :
Maybe adding a third |
My mistake. I missed that, and I tried switching the text ranker using this branch and still got a nasty modal alert. Am I correct that you added some methods to support Notification Center, but never actually call them? That’s what it looks like. On the actual implementation, those are all good points. It really doesn’t seem like an API for the real world. I had the same concerns and thought “Well, I guess this is what people do now.” and plowed forward. Maybe you’re right to question the whole thing. I really think Notification Center feels nice to use where I’ve seen it pop up (using my branch), but like you said, that all falls apart if the user changes to banners. Are you thinking we should just implement our own thing entirely? Seems like we need three types:
Right now, I think QS is too heavy on the first type. A lot of those could probably be changed to the second type, or just moved out of the way to await an answer. Maybe you’ve dine some of that. The best (worst?) example of this is the upgrade process and I haven’t done the work to fake an upgrade using this code. 😄 |
Yep, for the sake of discussing first ;-).
Sadly, I don't think there's a way to get the current notification style, beforehand at least.I vaguely remember it's possible to get a notification style, so it may be possible to post one, see how it looks, and then decide to switch to alerts.
Oh my god no ! Wait, we have one already ? What's that spinning cube which tells me there were updated plugins and I should relaunch ;-).
I mostly agree with your list, I was just thinking the API should be built around some use cases (which I'm unsure of), before switching everything to it. So, based on your list above, I would do this :
I'm leaving out the second kind because I don't like them (thankfully only Apple uses those, see the "App Store update available" which can't be dismissed). Can you give me an example where the user would be absolutely forced to act which wouldn't be covered by the first one ? |
The API was truly not designed for any real-world use.
The only thing I can think of where the user would need to respond immediately is destructive file operations, but that has its own UI. As for my “second type” above, I didn’t mean the App Store style thing that can’t be dismissed. (I hate it, too.) I’m referring to messages that can be dismissed by the user, but won’t just fade away on their own before the user has a chance to read them. Things like “This won’t work until you relaunch” or “There’s an update available”. I’m thinking this will be the most common type, and I can say from experience that using Notification Center for them feels really nice. The third kind should continue to work as they do now, where you can choose to send them to Growl, etc. UPDATE: We especially need to keep Growl and the built-in notifier as options for messages that can go away on their own, because for the others to work at all, we have to use “alerts” (see 7dcaffc) that stay until dismissed. Seriously. Who designed this? |
Some class-dumps and disassembling got involved, and I got this : I also got some non-dismissable (a.k.a the ones we hate) notifications, and that's mostly it. There is no way to get a banner-style notification when you're set to alert — because ultimately the user gets to choose. The closest you can get looks like the one above (without the shiny star thing), which doesn't auto-dismiss after a while (even though there's also appears to be a way to do so). We can cheat the dismiss part using Oh my, I just noticed Mail uses some hybrid "banner with buttons that show on hover" ones ! |
After some more disassembling, I can confirm that there are only 2 applications that can tweak their display style : Calendar & Reminders — that's hardcoded in Also note that it looks like the actual display style is derived from the first time we showed a notification, so if something decided to show a notification without us having the So given we have a user-accessible, EDIT We are not alone : Here's the defaulty thing demonstrated, here's the "reset" procedure. |
Are you sure that’s still true? Those comments were from 2013. I’m sure I tested |
I seem to remember I had the exact opposite happen : running with the Note that I think the signedness of an application is also taken into account, so maybe running a signed build would allow the style to be changed (as you saw), while an unsigned one wouldn't (as I saw). |
Maybe signing made a difference, but I’m sure I tried it first with a Debug build which wouldn’t be signed. Is it possible you had manually chosen banners for QS at some point in the past? If so, the OS would probably respect that setting and ignore the app’s default. |
Added some commits here. The first allows the handler to actually get called. 😃 The second is because responses weren’t really making sense. If you passed in two buttons, like
Clicking “Stop” would do what you think, but clicking “Go” would send |
break; | ||
|
||
case NSUserNotificationActivationTypeAdditionalActionClicked: |
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.
10.10+ ?
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, seriously? Fine. Leaving it out entirely doesn’t change behavior.
Such a characteristic bug 😆.
I think that's because IIRC there's no way to be informed when a notification is dismissed (slide-to-go-away), so you can't really cancel. So clicking the notification itself = first button. But I might not remember, and I might be confused because |
Seeing a crash with my local copy of QS, but it’s not in 1.5.0. I think it’s a result of some changes on this branch. To reproduce, move a file to a location where a file with the same name already exists.
|
Regarding that crash, I think this branch actually fixes a number of similar crashes. We just need to add the file conflict thing to the main thread. And I think that exception only crashes if ou build with the latest SDK, so might not affect release builds (done from 10.10). Going to test. |
Confirmed. When building from 10.10, this is just a warning:
Easy enough to fix, but the real problem (which I remember now) is that the file conflict panel is appearing in a separate window and often behind the main interface. |
a0920ad
to
392245d
Compare
So, this is an alternate version of #2104. Sorry @skurfer, I didn't like the "one delegate to rule them all approach", though as I said earlier, it's because of the API.
This one uses a block to notify what choice the user made. Right now it uses the same kind of block than the alerts do, but depending on some discussion, that can change. I prefer that to moving gobs of important code to unrelated places. I do agree the update code is not the most streamlined code to pick on, but, well...
Something I planned for but didn't yet handle is automatically escalating notifications to alerts via the delegate callback (that's why I started on cleaning up
QSAlertManager
first, then proceeded to notification handling). The issue is that I can't think of a good way of not doing so without changing the block's signature. Maybe provide a third method that has the automatic escalation behavior in ?