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

getPermissionSubscriptionState callback not being called if there is not state

Open frenkelor opened this issue 8 years ago • 2 comments

https://github.com/geektimecoil/react-native-onesignal/blob/d8061133cf14b8813badd6b612cb78b58fe44010/android/src/main/java/com/geektime/rnonesignalandroid/RNOneSignal.java#L220

As i see is it's better to return a null in the callback or implement failure state instead not calling it at all. I didn't try it on my phone only on the simulator I'm running RN 52 with lates OneSignal RN sdk

frenkelor avatar May 10 '18 10:05 frenkelor

@frenkelor A null OSPermissionSubscriptionState should be very rare and would only happen under 2 circumstances:

  1. You enabled the new GDPR privacy consent methods and the user hasn't given consent
  2. You haven't called init() yet.

Either way, this would be an error in the way the SDK is being used, and whether we return null or don't call the callback at all, it doesn't really matter

Nightsd01 avatar May 10 '18 23:05 Nightsd01

Either way, this would be an error in the way the SDK is being used, and whether we return null or don't call the callback at all, it doesn't really matter

@Nightsd01 IMHO it matters. I promisified that method and ended up with a memory leak. :sweat_smile:

dapids avatar Aug 08 '18 13:08 dapids