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

Fix badge clearing when calling clearAll #1335

Merged
merged 2 commits into from
Nov 8, 2023
Merged

Conversation

emawby
Copy link
Contributor

@emawby emawby commented Nov 8, 2023

Description

One Line Summary

This PR allows badges to be cleared when calling clearAll even when the disable badge clearing plist option is set to true

Details

the disable badge clearing plist option is intended to turn off the automatic badge clearing behavior that occurs when the app is opened or a notification is clicked.

This option should not be respected when the clearAll method is explicitly called because it will result in the wrong value being shown when notifications are incremented.

Additionally when the option is on we should still cache the current value instead of doing a no op incase the value has been manually set by the app.

Motivation

Fixes #1324

Scope

badge counts

Testing

Unit testing

Manual testing

tested on a physical device with the setting both on and off

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

If clearAll was called with disable badge clearing set to true then we would clear notifications but no the badge. This change makes it so that clearAll removes badges regardless of the disable badge clearing setting
@emawby emawby requested a review from nan-li November 8, 2023 20:25
@emawby emawby merged commit 2570a4d into main Nov 8, 2023
3 of 4 checks passed
@emawby emawby deleted the rebase_fix_badge_clearing branch November 8, 2023 21:39
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.

[Bug]: Inconsistent Badge Count Incrementation after Reset
2 participants