notif ios: Buffer notification tap events; same as on Android#2229
notif ios: Buffer notification tap events; same as on Android#2229rajveermalviya wants to merge 2 commits into
Conversation
5c3f7b3 to
3996923
Compare
3996923 to
2615cfb
Compare
chrisbobbe
left a comment
There was a problem hiding this comment.
This looks like a helpful simplification! I haven't tested manually yet, and see one comment below. I'll take another look (and do that manual testing) when this is un-marked as a draft.
| // https://github.com/zulip/zulip-flutter/pull/2043#discussion_r2794138972 | ||
| // TODO it'd be nice to avoid that glitch by controlling the initial route. | ||
| // We accept this glitch as a workaround for an upstream issue: | ||
| // https://github.com/flutter/flutter/issues/178305 |
There was a problem hiding this comment.
The linked Flutter issue appears to be Android-specific, so this reasoning doesn't hold in the iOS case.
| } | ||
|
|
||
| @HostApi() | ||
| abstract class NotificationHostApi { |
There was a problem hiding this comment.
Can we keep NotificationHostApi (without any methods), as a home for future functionality e.g. two methods I propose in #2257?
There was a problem hiding this comment.
I tried this, but when we have an empty NotificationHostApi then Pigeon generates a _extractReplyValueOrThrow which ends up being unused. And because of that analyzer ends up complaining about it.
32008cd to
43cc2ad
Compare
|
This is ready for review now. |
It turns out that `userNotificationCenter(_:didReceive:withCompletionHandler:)` does execute when app is terminated and later opened by tapping on a notification, so there is no need to check `launchOptions` in `application(_:didFinishLaunchingWithOptions:)` to handle this case. But because we currently handle both cases, there is a potential bug where if both are handled, it could cause double navigations for the same notification. This is not observed in practice, probably because we do not buffer events from `userNotificationCenter(_:didReceive:withCompletionHandler:)` currently and those events may be missed until Flutter init is complete and the handler (in NotificationOpenService.init) is setup. So, remove the unnecessary handlers for `launchOptions`. This also unifies our notification opening implementation between Android and iOS, where we handle all types of notification tap events via the same Pigeon EventChannel API.
43cc2ad to
bd0306b
Compare
It turns out that
userNotificationCenter(_:didReceive:withCompletionHandler:)does execute when app is terminated and later opened by tapping on a notification, so there is no need to checklaunchOptionsinapplication(_:didFinishLaunchingWithOptions:)to handle this case.But because we currently handle both cases, there is a potential bug where if both are handled, it could cause double navigations for the same notification. This is not observed in practice, probably because we do not buffer events from
userNotificationCenter(_:didReceive:withCompletionHandler:)currently and those events may be missed until Flutter init is complete and the handler (in NotificationOpenService.init) is setup.So, remove the unnecessary handlers for
launchOptions. This also unifies our notification opening implementation between Android and iOS, where we handle all types of notification tap events via the same Pigeon EventChannel API.