-
Notifications
You must be signed in to change notification settings - Fork 267
Extension Badge Handling #352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
• Moves badge increment/decrement logic from the OneSignal backend to the application itself
• This is accomplished using an app extension with an 'app group' to allow communication of data between the host app and it's notification extension service
• This allows the app to maintain a consistent badge count
• Also cleaned up some Firebase code and moved common strings to a definitions file
• Changed the SDK so that it will default to group.{bundle_id}.onesignal as the App Group name if one is not provided in Info.plist
• Swizzles the setApplicationIconBadgeNumber() method so the SDK always has a consistent badge count even if the developer manually sets it.
• Adds a test to verify the extension badge handling logic works correctly • Verifies that manually setting the badge number using UIApplication setApplicationIconBadgeNumber() also updates OneSignal SDK's cached badge value • Verifies that the SDK correctly handles positive and negative (increment and decrement) badge_inc values
|
Review status: 0 of 12 files reviewed at latest revision, 4 unresolved discussions. iOS_SDK/OneSignalSDK/Source/OneSignalExtensionBadgeHandler.h, line 6 at r1 (raw file):
Fix copyright header iOS_SDK/OneSignalSDK/Source/OneSignalExtensionBadgeHandler.m, line 6 at r2 (raw file):
Fix copyright header iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m, line 1835 at r2 (raw file):
iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m, line 1854 at r2 (raw file):
Can we add an 2nd notification service extension service that the NSDefault is se when aps Comments from Reviewable |
• Modularizes access to NSUserDefaults in regards to badge logic to a single implementation file • Moves the badge_inc property into the 'os_data' or 'custom' fields in push notification objects • Extends badge tests to cover more scenarios • Fixes header copyrights in multiple files
|
iOS_SDK/OneSignalSDK/Source/OneSignalExtensionBadgeHandler.h, line 6 at r1 (raw file): Previously, jkasten2 (Josh Kasten) wrote…
Fixed in multiple files. Comments from Reviewable |
|
iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m, line 1854 at r2 (raw file): Previously, jkasten2 (Josh Kasten) wrote…
Moved the new badge tests to Comments from Reviewable |
|
Reviewed 3 of 9 files at r1, 17 of 17 files at r3. Comments from Reviewable |
|
Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
• Moves badge increment/decrement logic from the OneSignal backend to the application itself
• This is accomplished using an app extension with an 'app group' to allow communication of data between the host app and it's notification extension service
• This allows the app to maintain a consistent badge count
• Also cleaned up some Firebase code and moved common strings to a definitions file
• Changed the SDK so that it will default to group.{bundle_id}.onesignal as the App Group name if one is not provided in Info.plist
This change is