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

patch expo-notifications to clear badge #4475

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

haileyok
Copy link
Contributor

@haileyok haileyok commented Jun 11, 2024

Why

The library that expo-notifications is using to clear the badge - ShortcutBadger does not clear the badge count correctly for some reason. The documentation says that either clearCount(context, 0) or resetCount(context) should reset the badge, but it does not - even though the call returns true.

Instead, we can use the Android API to clear the badge count.

Solution from flutter/flutter#25030 (comment), albeit in Java

Test Plan

  • Send yourself some notifications
  • Verify the badge increments
  • Open the app, visit the notifications tab
  • Verify the badge has been removed

Copy link

render bot commented Jun 11, 2024

Copy link

The Pull Request introduced fingerprint changes against the base commit:

Fingerprint diff
[{"type":"dir","filePath":"node_modules/expo-notifications/android","reasons":["expoAutolinkingAndroid"],"hash":"34a8bdae7dbf9876ec48baa2fac0f75aaed01254"},{"type":"dir","filePath":"patches","reasons":["patchPackage"],"hash":"3b6ba76de1c638d3cad055eec08e6e8a46b3a874"}]

Generated by PR labeler 🤖

Copy link

Old size New size Diff
7.39 MB 7.39 MB 0 B (0.00%)

@haileyok haileyok merged commit 808dd35 into main Jun 11, 2024
6 checks passed
estrattonbailey added a commit that referenced this pull request Jun 11, 2024
* origin/main: (54 commits)
  patch `expo-notifications` to clear badge (#4475)
  Revert to old modal on android (#4458)
  Sort profile feedgens by likes (#4380)
  Revert "Fix undefined block (#4471)" (#4472)
  Fix undefined block (#4471)
  Open convo menu when tapping on chat with deleted account (#4470)
  stop using `addPushTokenListener` (#4467)
  add hitslop to repost button (#4469)
  Add a loading indicator to notifications when loading latest (#4468)
  Visually improve the empty state of feeds (#4466)
  Give a meaningful error in the composer when replying to a deleted post (#4464)
  Fix: show known feed error UI more reliably (#4463)
  Only validate persisted data for existing users (#4465)
  Check `canAskAgain` for notification permissions (#4460)
  Add support for new-tab clicks on feeds (#4462)
  Override legacy language codes for indonesian, hebrew, and yiddish (#4461)
  Ungate mobile web notification badge (#4459)
  Fix (#4430): Use separate hooks for shell mode animated styles (#4451)
  Throttle instead of debounce (#4456)
  debounce refetching listconvos (#4455)
  ...
@haileyok haileyok deleted the hailey/fix-clear-badge-android branch September 2, 2024 20:07
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.

2 participants