Skip to content
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

CHNL-14775: Add badge incrementing logic to extension + README #244

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

belleklaviyo
Copy link
Contributor

@belleklaviyo belleklaviyo commented Dec 13, 2024

Description

SDK changes: CHNL-14775
README updates: CHNL-12941

Adding handling of new push payloads to service extension. Modifies the autoclearing set up, so it is on by default. Devs can disable it by adding a key in their Info.plist. README updated.

Check List

  • Are you changing anything with the public API?
  • Have you tested this change on real device?
  • Are your changes backwards compatible with previous SDK Versions?
  • Have you added unit test coverage for your changes?
  • Have you verified that your changes are compatible with all the operating system version this SDK currently supports?

Manual Test Plan

Pre-reqs (new steps in README):

  1. Set up App Group for Notification Service Extension and main app target with the same name (e.g. group.com.klaviyo.SDKTestApp.shared)
  2. Add Klaviyo_App_Group to both the main app target's and the extension's Info.plists with the name of the App Group

Default Autoclearing

  1. Send some plain notification from Push Notification Console to populate the badge count (i.e. badge = 3 in payload) with the app in the background and observe badge of 3
{
    "aps": {
        "alert": {
            "title": "title",
            "subtitle": "subtitle",
            "body": "body"
        },
        "badge": 3
    }
}
  1. Open the app
  2. Close the app and observe badge cleared to 0

Disabling Autoclearing

  1. Add disable_Klaviyo_badge_autoclearing to the Info.plist of the main app target as a Boolean set to YES (as defined in the README)
  2. Send some plain notification from Push Notification Console to populate the badge count (i.e. badge = 3 in payload) with the app in the background and observe badge of 3
  3. Open the app
  4. Close the app and observe badge of 3 still remains

Push Notification Console Testing
Send payloads as documented here to cover all possible paths of badge configurations:

  • badge:off
  • badge:on, config:increment_one, value:1
  • badge:on, config:set_count, value:3 (or any valid int value)
  • badge:on, config:set_property, value:5 (or any valid int value)

Note: only other non happy paths worth testing imo are where we are sending the badge_config but no badge_value due to poor rendering and if there were some new enum case added on the backend and the SDK is not updated:

  • badge:on, config:increment_one, NO VALUE
  • badge:on, config:set_count, NO VALUE
  • badge:on, config:set_property, NO VALUE
  • badge:on, config:ex_new_enum, NO VALUE
  • badge:on, config:ex_new_enum, value:2 (or any valid int value)

End to End Testing

Supporting Materials

@belleklaviyo belleklaviyo self-assigned this Dec 13, 2024
@belleklaviyo belleklaviyo changed the base branch from master to badge-count December 17, 2024 19:07
@belleklaviyo belleklaviyo changed the base branch from badge-count to master December 17, 2024 19:07
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@belleklaviyo belleklaviyo changed the title CHNL-14775: Add badge incrementing logic to extension CHNL-14775: Add badge incrementing logic to extension + README Dec 18, 2024
@belleklaviyo belleklaviyo marked this pull request as ready for review December 19, 2024 20:08
@belleklaviyo belleklaviyo requested a review from a team as a code owner December 19, 2024 20:08
README.md Outdated

#### Handling Other Badging Sources

Klaviyo SDK handles Klaviyo pushes, but if you have other sources that change the badge count, use the `KlaviyoSDK().setBadgeCount(:)` method wherever you change the badge count to keep in sync with SDK count.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we run this whole readme thru copilot to correct any grammatical issues/inconsistency in wording?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
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.

6 participants