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]: Error after upgrade from 3.3.1 -> 5.0.0 #921

Closed
sbellver opened this issue Sep 27, 2023 · 1 comment
Closed

[Bug]: Error after upgrade from 3.3.1 -> 5.0.0 #921

sbellver opened this issue Sep 27, 2023 · 1 comment

Comments

@sbellver
Copy link

sbellver commented Sep 27, 2023

What happened?

I have an app write in Vue3 with ionic/capacitor

I'm on 3.3.1 and everyting works fine.

But if i upgrade to 5.0.0 some errors became

Steps to reproduce?

1. Update package to last version 5.0.0 from 3.1.1
2. Delete ios folder
3. npm i
4. npx cap sync
5. All works fine :)
6. ionic serve
7. Errors :( 'Property getDeviceState does not exist on type 'OneSognalPlugin'

Really, everything related to Onesignal."Function" gives me an error

This is my working code on 3.3.1

`
/* Onesignal */
import OneSignal from 'onesignal-cordova-plugin';
document.addEventListener("deviceready", OneSignalInit, false);

function OneSignalInit(): void {
  OneSignal.setAppId("ID");
  OneSignal.setNotificationOpenedHandler(function(jsonData) {
      console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
  });

  OneSignal.promptForPushNotificationsWithUserResponse(function(accepted) {
      console.log("User accepted notifications: " + accepted);
  });

  OneSignal.getDeviceState((state) => {
    app.config.globalProperties.$oneSignalState = state;
  });
}


### What did you expect to happen?

All works fine after upgrade plugin

### OneSignal Cordova SDK version

5.0.0

### Which platform(s) are affected?

- [X] iOS
- [X] Android

### Relevant log output

_No response_

### Code of Conduct

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

<!-- probot = {"onesignal-probot":{"response_time_in_business_days":21}} -->
@terreng
Copy link

terreng commented Sep 30, 2023

The names of several methods changed in v5.0.0. See the migration guide: https://github.com/OneSignal/OneSignal-Cordova-SDK/blob/user_model/main/MIGRATION_GUIDE.md

@emawby emawby closed this as completed Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants