From e9283a994db483dd0959b85284f08b565eccfe34 Mon Sep 17 00:00:00 2001 From: neoassyrian Date: Mon, 12 Jun 2017 07:23:47 +1000 Subject: [PATCH] feat(one-signal): add getPermissionSubscriptionState (#1678) * Create index.ts * Create index.ts --- src/@ionic-native/plugins/onesignal/index.ts | 47 ++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/@ionic-native/plugins/onesignal/index.ts b/src/@ionic-native/plugins/onesignal/index.ts index 75214b3c0..67dd6e329 100644 --- a/src/@ionic-native/plugins/onesignal/index.ts +++ b/src/@ionic-native/plugins/onesignal/index.ts @@ -219,6 +219,41 @@ export interface OSActionButton { */ icon: string; } +/** + * OSPermissionState + */ +export interface OSPermissionState { + /** + * User was prompted. + */ + hasPrompted: boolean; + /** + * Permissions Status + */ + status: any; +} +/** + * OSSubscriptionState + */ +export interface OSSubscriptionState { + subscribed: boolean; + userSubscriptionSetting: any; + userId: any; + pushToken: any; +} +/** + * Subscription and permissions status + */ +export interface OSPermissionSubscriptionState { + /** + * Id assigned to the button. + */ + permissionStatus: OSPermissionState; + /** + * Text show on the button to the user. + */ + subscriptionStatus: OSSubscriptionState; +} /** * **ANDROID** - If a background image was set, this object will be available. @@ -537,6 +572,18 @@ export class OneSignal extends IonicNativePlugin { @Cordova({ sync: true }) setSubscription(enable: boolean): void { } + + /** + * Get the current notification and permission state. Returns a OSPermissionSubscriptionState type described below. + * You can pass true later to opt users back into notifications. + * + * @param {boolean} enable + */ + @Cordova({ sync: true }) + getPermissionSubscriptionState(): OSPermissionSubscriptionState { } + + + /** * * @param {notificationObj} Parameters see POST [documentation](https://documentation.onesignal.com/v2.0/docs/notifications-create-notification)