Skip to content

Conversation

@Nightsd01
Copy link
Contributor

@Nightsd01 Nightsd01 commented Jan 15, 2019

• We recently discovered an issue where if an app sends two notifications that have their own unique buttons, both notifications will display whatever the more recent notifications buttons were supposed to be.
• For example, if an app sends a notification with "Like" as the button title, and then later on it sends another notification with "Dislike" as the title, BOTH notifications will now show "Dislike" as the button title.
• This was caused by the fact that the SDK uses a single UNNotificationCategory ID called __dynamic__ to register notification actions, meaning the most recently received notification defines the buttons.
• Fixes the issue by now registering unique UNNotificationCategory's to each specific notification.
• To prevent the steady buildup of registered categories over time, we define a limit (MAX_CATEGORIES_SIZE, which is currently 128) and delete/de-register any previousUNNotificationCategory's than the 128 most recent.
• Adds a test to make sure that the SDK is correctly registering, deleting, and associating categories with notifications


This change is Reviewable

• We recently discovered an issue where if an app sends two notifications that have their own unique buttons, both notifications will display whatever the more recent notifications buttons were supposed to be.
• For example, if an app sends a notification with "Like" as the button title, and then later on it sends another notification with "Dislike" as the title, BOTH notifications will now show "Dislike" as the button title.
• This was caused by the fact that the SDK uses a single UNNotificationCategory ID called "__dynamic__" to register notification actions, meaning the most recently received notification defines the buttons.
• Fixes the issue by now registering unique UNNotificationCategory's to each specific notification.
• To prevent the steady buildup of registered categories over time, we define a limit (MAX_CATEGORIES_SIZE, which is currently 128) and delete/de-register any previous UNNotificationCategory's than the 128 most recent.
• Adds a test to make sure that the SDK is correctly registering, deleting, and associating categories with notifications
• Fixes an old test that depended on the old statically defined UNNotificationCategory identifier
• Moves the existingCategories() method from OneSignalHelper to OneSignalNotificationCategoryController
@Nightsd01 Nightsd01 merged commit 7142c7f into master Jan 15, 2019
@Jeasmine Jeasmine deleted the save_categories branch May 12, 2020 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants