Unity-Technologies / com.unity.mobile.notifications

Mobile Notifications Package
https://docs.unity3d.com/Packages/com.unity.mobile.notifications@2.1/manual/index.html
Other
131 stars 42 forks source link

Refactor notification manager #216

Closed aurimasc closed 2 years ago

aurimasc commented 2 years ago

The problem this PR is solving is that UnityNotificationManager class is used as the central manager for most notification stuff and as a receiver for alarms when notifications are supposed to be shown. The receiver objects are created by OS and they are recreated based on vairous conditions, while our own manager is supposed to be singleton instance. Some issues coming from that were solved via static variables in the class, which was error prone. The changes in this PR are:

Note to QA:

vaidasma commented 2 years ago

Verified.

• Notifications are still delivered in different app states: killed, in foreground, in background, after restart (Exception: Xiaomi Mi 5s, known not to receive notifications after restart)

Tested on devices: • VLNQA00090 - Samsung Galaxy S8 (USA) (SM-G950U), CPU: Snapdragon 835 MSM8998, GPU: Adreno 540, OS: 7.0.0 • VLNQA00341 - Note20 Ultra 5G INT (SM-N986B), CPU: Exynos 990, GPU: Mali-G77, OS: 10 • VLNQA00011 - Xiaomi Mi 5s (MI 5s), CPU: Snapdragon 820 MSM8996, GPU: Adreno 530, OS: 6.0.1

Could not test on: • VLNQA00460 - Google Pixel 6 (Pixel 6), CPU: Google Tensor (Whitechapel), GPU: Mali-G78, OS: 13

Issue discovered (unrelated to PR): Notifications do not arrive until app is in foreground Issue link: MPT-1819