ios: Fix unwanted in-app notification sound when phone is on silent.#4898
ios: Fix unwanted in-app notification sound when phone is on silent.#4898chrisbobbe merged 11 commits intozulip:mainfrom
Conversation
d43dbe9 to
27d4c08
Compare
|
Thanks! Testing out this area of behavior (first with just a released version, to understand the status quo), I'm actually kind of puzzled -- I can't seem to reproduce the behavior we expect. (This is something I don't see in my own normal personal use, because I always have my devices on silent/vibrate for notifications.)
What behavior do you see, before your changes? |
|
All the cleanups that come after the behavior changes look good!
This sounds pretty reasonable. I wonder how it ends up differing from |
Hmm! Interesting. For the problem where you expect to hear a sound while foregrounded, before these changes: This may have been implicit, but did you read through the code in I've just tried on my iPhone, and I'm hearing our "thump" sound when I get a PM from another account and I don't have any message lists open. Edit: I've also just tried on the office Android device, and I'm getting a visible notification and an Android notification sound, along with the "thump" sound. |
It looks like this was resolved, and you managed to reproduce it: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/notification.20sound.20bug/near/1240401 |
27d4c08 to
d9cf445
Compare
Good point—I've just pushed a revision that says |
On iOS, for zulip#4897, we instead want to use the native notification-sound functionality. So, do that, by adding a line to AppDelegate.m. We should still carve out an exception: we won't need to notify the user if the relevant item (a new or updated message) is already on the user's screen. Doing so could be annoying; for example, you don't need to be notified about every single message in an active PM conversation. That's issue zulip#3114, and it'll take some work. But this change improves the behavior on iOS and it matches the existing behavior on Android. On Android, this JS function call has apparently been duplicating the notification sound that gets played at a lower level, so it's fine for Android to remove this. Fixes: zulip#4897
A sound, by itself, would tell the user that something interesting happened, but without giving them a clue about what the interesting thing was. So, use a banner for that. We should still eventually not show these for messages that already appear on the screen, as we mentioned for notification sounds in the previous commit.
Along with the one bit of now-unused code (as of this series) that was importing it.
This was a lot of setup for the in-app "notification" sound, which we removed in a recent commit.
…pers. navSelectors and navActions are kind of relics from before zulip#3804, and we already have zulip#4417 for removing most or all of navActions. Help along the removal of navSelectors by removing these things that we stopped using in a recent commit.
As mentioned in a previous commit, navSelectors and navActions are kind of relics from before zulip#3804, and we already have zulip#4417 for removing most or all of navActions. Might as well remove navSelectors.
d9cf445 to
a19eb69
Compare
|
This code looks good! And we've just tested on iOS 14 (on my iPhone 7, which I upgraded yesterday from iOS 12), and it works as intended. Please merge at will. I believe you're in the middle of testing again on iOS 13. |
Yep, this worked as expected. Yay! |
|
Thanks for the review! Merged. |
(And some follow-up cleanups.)
I've kept my personal iPhone on iOS 13 just in case, and here's a case where that paid off! I was able to test this on my device, and that helped me notice that
UNNotificationPresentationOptionBanner(which is iOS 14+) didn't do anything on my device, and that I should includeUNNotificationPresentationOptionAlertfor iOS <14 support.A consequence is that I haven't been able to test on iOS 14 yet. I get this output from
logging.warnif I try to test on a simulator running iOS 14:(Looks like we can only test push notifications on a real device.) Should I upgrade my own device to iOS 14, or does someone with a device running iOS 14 want to test, or do we think it's fine without testing on 14?
Fixes: #4897