If a notification is received when the app is not in foreground, the app is then launched, notification center is opened and a notification is tapped, the notificationOrigin
is marked as .DeliveredWhileInForground
.
I noticed that in that case, the following is true:
applicationIsInForeground && application.applicationState == .Inactive
I propose that we look for that case and return .UserTappedToBringAppToForeground
instead.
Something like this:
let notificationOrigin: UserNotificationOrigin
if applicationIsInForeground {
notificationOrigin = application.applicationState == .Inactive
? .UserTappedToBringAppToForeground
: .DeliveredWhileInForground
} else if application.applicationState == .Background && remoteNotification.contentAvailable {
notificationOrigin = .DeliveredWhileInBackground
} else {
notificationOrigin = .UserTappedToBringAppToForeground
}
bug help wanted