invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.88k stars 228 forks source link

EventType.DISMISS is executed when app is brought back to foreground not when in background #962

Closed gtom84 closed 7 months ago

gtom84 commented 10 months ago

This is happening on iOS only.

If user tap on Mark as read action button then the section in onBackgroundEvent is executed with app in the background. If user dismisses the notification swiping it away or taping on Clear then nothing is executed when app is in background. However and that's probably a bug, if user opens up the app after they dismissed the notification, the section from onBackgroundEvent is executed right when the app is brought back to foreground.

This is for app in background state not in Killed state.

notifee.onBackgroundEvent(async ({ type, detail }) => {
  const { notification, pressAction, input } = detail;
  if (type === EventType.DISMISSED) {
    console.log('Background notification dismissed by user', detail.notification);
  }
  if (type === EventType.ACTION_PRESS && pressAction.id === 'mark-as-read') {
    console.log('Background notification mark as read by user', detail.notification);
  }
  if (type === EventType.UNKNOWN) {
    console.log('Catch all - Event UNKNOWN', detail.notification);
  }
});

React 18.2 React-native 0.73.1 Notify 7.8.2

github-actions[bot] commented 9 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

gtom84 commented 9 months ago

Not stale

github-actions[bot] commented 8 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

gtom84 commented 8 months ago

Not stale

github-actions[bot] commented 7 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

gendalf-thug commented 3 months ago

Lol, best problem solving which I see