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

[expo-notifications][Android] Fix setBadgeCount() when badge count is 0 #29657

Conversation

douglowder
Copy link
Contributor

Why

The ShortcutBadger package does not correctly set the badge count on Android if the value to be set is 0. This fixes the issue, using a fix provided by @haileyok in #29634 .

Fixes #29634.

How

In the case where badge count is 0, use Android built in notification manager to cancel all notifications.

Test Plan

  • CI should pass
  • API should behave correctly in our test app

Checklist

@douglowder douglowder requested a review from tsapeta as a code owner June 11, 2024 18:46
Copy link

linear bot commented Jun 11, 2024

@expo-bot
Copy link
Collaborator

Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines.

I've found some issues in your pull request that should be addressed (click on them for more details) 👇

⚠️ Suggestion: Missing changelog entries


Your changes should be noted in the changelog. Read Updating Changelogs guide and consider adding an appropriate entry to the following changelogs:


Generated by ExpoBot 🤖 against a8bff02

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jun 11, 2024
@expo-bot
Copy link
Collaborator

The Pull Request introduced fingerprint changes against the base commit: e7f82b4

Fingerprint diff
[
  {
    "type": "dir",
    "filePath": "../../packages/expo-notifications/android",
    "reasons": [
      "expoAutolinkingAndroid"
    ],
    "hash": "f40e1620eb87ed7eb551836d185cd5f25e397e87"
  }
]

Generated by PR labeler 🤖

Copy link
Contributor

@christopherwalter christopherwalter left a comment

Choose a reason for hiding this comment

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

Approving but left a comment regarding behavior

@douglowder douglowder merged commit ee4595c into main Jun 11, 2024
17 of 18 checks passed
@douglowder douglowder deleted the doug/eng-12472-expo-notificationsandroid-fix-badge-count-issue branch June 11, 2024 19:44
douglowder added a commit that referenced this pull request Jun 11, 2024
… 0 (#29657)

# Why

The `ShortcutBadger` package does not correctly set the badge count on
Android if the value to be set is 0. This fixes the issue, using a fix
provided by @haileyok in #29634 .

Fixes #29634.

# How

In the case where badge count is 0, use Android built in notification
manager to cancel all notifications.

# Test Plan

- CI should pass
- API should behave correctly in our test app

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
marklawlor pushed a commit that referenced this pull request Jun 12, 2024
… 0 (#29657)

# Why

The `ShortcutBadger` package does not correctly set the badge count on
Android if the value to be set is 0. This fixes the issue, using a fix
provided by @haileyok in #29634 .

Fixes #29634.

# How

In the case where badge count is 0, use Android built in notification
manager to cancel all notifications.

# Test Plan

- CI should pass
- API should behave correctly in our test app

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
@douglowder douglowder added the published Changes from the PR have been published to npm label Jun 12, 2024
douglowder added a commit that referenced this pull request Jun 12, 2024
… 0 (#29657)

# Why

The `ShortcutBadger` package does not correctly set the badge count on
Android if the value to be set is 0. This fixes the issue, using a fix
provided by @haileyok in #29634 .

Fixes #29634.

# How

In the case where badge count is 0, use Android built in notification
manager to cancel all notifications.

# Test Plan

- CI should pass
- API should behave correctly in our test app

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint changed bot: suggestions ExpoBot has some suggestions published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[notifications] badge does not "reset" when calling setBadgeCountAsync(0) on Android
3 participants