OneSignal/react-native-onesignal

[Bug]: NotificationClickEvent returning `launchUrl` instead of `launchURL` (on Android)

Aya-Sato opened this issue · 7 comments

What happened?

When calling OneSignal.Notifications.addEventListener("click", (event) => {};), event.notification.launchUrl is being returned on Android instead of event.notification.launchURL.

Steps to reproduce?

OneSignal.Notifications.addEventListener("click", (event) => {
     console.log(event.notification.launchURL)
  }
)

On iOS, event.notification.launchURL is correctly returned as specified by the OSNotification type. On Android, event.notification.launchURL is undefined and instead event.notification.launchUrl is returned.

What did you expect to happen?

Expect to have the event.notification.launchURL returned on Android as well.

React Native OneSignal SDK version

5.2.0

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

No response

Code of Conduct

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

I have the same issue and I had to do the ugly hack to quiet warnings and the error to support both platforms. On iOS it works fine, the object returned to the android device is invalid.

      if (
        oneSignalEvent.notification?.launchURL ||
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-expect-error
        oneSignalEvent.notification?.launchUrl
      ) {}

I created an issue here some months ago: #1635
It was marked as resolved 8h ago so I hope new update will rollout soon!

@Martinocom-Switcho Thank you for letting us know! I will close the issue

@Aya-Sato Shouldn't you first release the fix and then close? When can we expect change to be released?

@pilotpirxie I think it was closed because #1635 was still open and this was a duplicate.

But I agree that if merged ≠ released, the original #1635 should't be closed. Or at least it should be stated somewhere if this is the policy of this repo.

@pilotpirxie @Martinocom-Switcho
Yes, I closed the issue because it was a duplicate. I do agree with @Martinocom-Switcho though that the original shouldn't have been closed if it was not released yet..