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

[Bug]: Param launchURL differs between iOS and Android implementation #1635

Open
2 of 3 tasks
Martinocom-Switcho opened this issue Jan 26, 2024 · 2 comments · May be fixed by #1704
Open
2 of 3 tasks

[Bug]: Param launchURL differs between iOS and Android implementation #1635

Martinocom-Switcho opened this issue Jan 26, 2024 · 2 comments · May be fixed by #1704

Comments

@Martinocom-Switcho
Copy link

Martinocom-Switcho commented Jan 26, 2024

What happened?

We're currently on the latest version (5.0.4) of RN-OneSignal and 0.72.6 of React Native. We discovered a problem inside the library with the name of launchURL param.

On Android the received object contains launchUrl (lowercase) instead of launchURL (uppercase), causing the interface OSNotification to be wrongly typed.

This only happens on Android, since iOS is ok. I double-checked if everything is ok, reinstalling all the dependencies (yes, deleting also the .lock file and the node_modules folder + builds from Android). I have no customisations nor modification on the Native part.

UPDATE 1 Feb 2024: we upgraded to 5.0.5, but it's not solved.
UPDATE 19 Feb 2024: we upgraded to 5.0.6 but it's not solved.
UPDATE 28 Mar 2024: we upgraded to 5.1.0 but it's not solved.
UPDATE 23 Apr 2024: we upgraded to 5.1.2 but it's not solved.

Steps to reproduce?

On an Android phone:

  1. Setup everything (RN + OneSignal + ...)

  2. Send a notification with Launch URL set to "something"

  3. Receive the message in app (doesn't matter if foreground/background/closed)

  4. The object received will be like this:

{
 ...
 "body": "<body>",
 "launchUrl": "myapp://launch-url-should-be-uppercase",
 ...
}
  1. The OSNotification object is instead like this:
export default class OSNotification {
  body: string;
  launchURL?: string; // correctly typed uppercase URL
  ...
}

What did you expect to happen?

The types should mach, being launchURL in both the received object and the OSNotification interface. For now I applied a temporary solution:

  // @ts-expect-error in case of wrongly typed launchURL https://github.com/OneSignal/react-native-onesignal/issues/1635
  const launchUrl = (notification.launchURL ?? notification.launchUrl) as typeof notification.launchURL;

React Native OneSignal SDK version

5.0.4

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
@jennantilla
Copy link
Contributor

@Martinocom-Switcho thank you for reporting! We'll get this updated so it types are consistent.

@cristiangu
Copy link

I was just preparing to create a new bug for this. Thank you for reporting this sooner!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants