react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

[Bug]: Doesn't return to the app (crashes) if user rejects notification permission

Open jose-gataca opened this issue 1 year ago • 2 comments

What happened?

After requesting permission on Android, if the permissions are rejected by the user, the rejection is not handled correctly by the sdk (either crash - if no fallback to settings - or kicked out of the app -if fallback to settings is set to true-).

Steps to reproduce?

1. Install v5.0.4 of the library on a react native application
2. Add the following code:
        const has = OneSignal.Notifications.hasPermission();
        const can = await OneSignal.Notifications.canRequestPermission();
        if (!has && can) {
            await AsyncStorageTool.storeData('permissions_requested', 'true');
            OneSignal.Notifications.requestPermission(false);
        }
3. Run on an Android Device
4. Reject notifications when the prompt is displayed

What did you expect to happen?

After the requestPermission (either to true or false), I would expect the application to run correctly without any push notifications. Instead, if fallbackToSettings is set to true, you are kicked out of the app if the notifications permissions are rejected. If it is set to false, then it plainly crashes.

React Native OneSignal SDK version

5.0.4

Which platform(s) are affected?

  • [ ] iOS
  • [X] Android

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

jose-gataca avatar Jan 10 '24 15:01 jose-gataca

@jose-gataca thank your for reporting! We are looking into this.

jennantilla avatar Jan 17 '24 18:01 jennantilla

+1

MicaelaWaigel avatar Feb 07 '24 17:02 MicaelaWaigel