williamrijksen / com.williamrijksen.onesignal

Titanium Appcelerator Library for OneSignal Push Notifications Service
Other
51 stars 43 forks source link

Fix/depreciation ids available #66

Closed williamrijksen closed 3 years ago

williamrijksen commented 6 years ago

Context

Replaces the idsavailable function by the get getPermissionSubscriptionState.

How to test

Notes

Blocked by #62 This is a breaking change!

williamrijksen commented 6 years ago

@jvandijk Based on #62, a functional test is still required. Can we do that?

frodfigu commented 4 years ago

But... Where is the release 2.2.0 for Android? The actual 2.1.1... shows me onesignal.getPermissionSubscriptionState is not a function

Thank you!

SquirrelMobile commented 4 years ago

The 2.2.0 remove the depreciated idsAvailable without implement the remplacement method : getPermissionSubscriptionState, can we merge this PR ?

SquirrelMobile commented 4 years ago

com.williamrijksen.onesignal-iphone-2.2.1.zip I've compile the module for iOS (since we need the last SDK version to remove the UIWebview error and stil need the player_id from OneSignal.

Use this code :

var e = onesignal.getPermissionSubscriptionState();
Ti.API.log("--- getPermissionSubscriptionState " + JSON.stringify(e));

It return on abject like this :

{
  "subscriptionStatus": {
    "userSubscriptionSetting": true,
    "subscribed": true,
    "userId": "THE PLAYER ID",
    "pushToken": "THE PUSH TOKEN"
  },
  "permissionStatus": {
    "status": 2,
    "provisional": false,
    "hasPrompted": true
  },
  "emailSubscriptionStatus": {
    "emailAddress": null,
    "emailUserId": null
  }
}