urbanairship / airship-flutter

Flutter integration
Other
17 stars 18 forks source link

iOS app icon badge behaves inconsistently #179

Closed jschmitz1 closed 1 year ago

jschmitz1 commented 1 year ago

Preliminary Info

What Airship dependencies are you using?

airship_flutter 7.0.0

What are the versions of any relevant development tools you are using?

macOS ventura 13.01; XCode 14.3.1; Flutter 3.10.5; iOS 16

Report

What unexpected behavior are you seeing?

The push notification badge behaves inconsistently on iOS. I have auto-badging enabled and it always correctly increments the badge number by 1. The badge is also successfully removed from the app icon by calling Airship.push.iOS.setBadge(0); in the initialization script of my App. However, if i send new notifications after the badge was removed from the app icon, the badge does not start counting at 1. Instead it starts at the number of notifications that were previously received. As an example:

  1. Send two push notifications to device, they arrive and are displayed correctly. Badge number is incremented by 1 two times, thus the badge now displays "2".
  2. Open the app, Airship.push.iOS.setBadge(0); seemingly resets the badge to 0.
  3. Close the App / return to HomeScreen. Badge is not displayed on app icon.
  4. Send another push notification to the device. Now the badge displays "3" instead of the expected "1".

What is the expected behavior?

After setting the badge number to 0 by calling Airship.push.iOS.setBadge(0), the badge displayed on the App Icon should begin counting at 0/1 again.

What are the steps to reproduce the unexpected behavior?

This is inconsistent behavior. On a USB connected iPhone i have not encountered this issue. While testing on BrowserStack iPhones it sometimes occurs and sometimes doesn’t.

jschmitz1 commented 1 year ago

I found this very old issue in the repository for the cordova plugin: https://github.com/urbanairship/urbanairship-cordova/issues/83 The explanation provided in the comments has cleared some things up, we will do some testing again and if the issue persists i will re-open this issue but for now i will close it.

The documentation for airship_flutter could be expanded to make the auto-badging behavior of iOS more clear