diff --git a/src/@ionic-native/plugins/push/index.ts b/src/@ionic-native/plugins/push/index.ts index bf1661533..a3b9206cd 100644 --- a/src/@ionic-native/plugins/push/index.ts +++ b/src/@ionic-native/plugins/push/index.ts @@ -1,10 +1,12 @@ import { Injectable } from '@angular/core'; -import { Cordova, Plugin, CordovaInstance, checkAvailability, IonicNativePlugin } from '@ionic-native/core'; +import { checkAvailability, Cordova, CordovaInstance, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs/Observable'; declare const window: any; -export type EventResponse = RegistrationEventResponse & NotificationEventResponse & Error; +export type EventResponse = RegistrationEventResponse & + NotificationEventResponse & + Error; export interface RegistrationEventResponse { /** @@ -13,7 +15,6 @@ export interface RegistrationEventResponse { registrationId: string; } - export interface NotificationEventResponse { /** * The text of the push message sent from the 3rd party service. @@ -111,6 +112,13 @@ export interface IOSPushOptions { * Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1 */ categories?: CategoryArray; + + /** + * If true the device will be set up to receive VoIP Push notifications and the + * other options will be ignored since VoIP notifications are silent + * notifications that should be handled in the "notification" event. + */ + voip?: boolean | string; } export interface CategoryArray { @@ -203,7 +211,6 @@ export interface BrowserPushOptions { * Default: http://push.api.phonegap.com/v1/push Optional. */ pushServiceURL?: string; - } export interface PushOptions { @@ -314,7 +321,6 @@ export type PushEvent = string; }) @Injectable() export class Push extends IonicNativePlugin { - /** * Init push notifications * @param options {PushOptions} @@ -329,7 +335,9 @@ export class Push extends IonicNativePlugin { * @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted. */ @Cordova() - hasPermission(): Promise<{ isEnabled: boolean }> { return; } + hasPermission(): Promise<{ isEnabled: boolean }> { + return; + } /** * Create a new notification channel for Android O and above. @@ -338,7 +346,9 @@ export class Push extends IonicNativePlugin { @Cordova({ callbackOrder: 'reverse' }) - createChannel(channel?: Channel): Promise { return; } + createChannel(channel?: Channel): Promise { + return; + } /** * Delete a notification channel for Android O and above. @@ -347,15 +357,18 @@ export class Push extends IonicNativePlugin { @Cordova({ callbackOrder: 'reverse' }) - deleteChannel(id?: string): Promise { return; } + deleteChannel(id?: string): Promise { + return; + } /** * Returns a list of currently configured channels. * @return {Promise} */ @Cordova() - listChannels(): Promise { return; } - + listChannels(): Promise { + return; + } } /** @@ -367,11 +380,12 @@ export class Push extends IonicNativePlugin { pluginRef: 'PushNotification' }) export class PushObject { - private _objectInstance: any; constructor(options: PushOptions) { - if (checkAvailability('PushNotification', 'init', 'PushNotification') === true) { + if ( + checkAvailability('PushNotification', 'init', 'PushNotification') === true + ) { this._objectInstance = window.PushNotification.init(options); } } @@ -386,7 +400,9 @@ export class PushObject { clearFunction: 'off', clearWithArgs: true }) - on(event: PushEvent): Observable { return; } + on(event: PushEvent): Observable { + return; + } /** * The unregister method is used when the application no longer wants to receive push notifications. @@ -394,7 +410,9 @@ export class PushObject { * so you will need to re-register them if you want them to function again without an application reload. */ @CordovaInstance() - unregister(): Promise { return; } + unregister(): Promise { + return; + } /** * Set the badge count visible when the app is not running @@ -407,13 +425,17 @@ export class PushObject { @CordovaInstance({ callbackOrder: 'reverse' }) - setApplicationIconBadgeNumber(count?: number): Promise { return; }; + setApplicationIconBadgeNumber(count?: number): Promise { + return; + } /** * Get the current badge count visible when the app is not running * successHandler gets called with an integer which is the current badge count */ @CordovaInstance() - getApplicationIconBadgeNumber(): Promise { return; } + getApplicationIconBadgeNumber(): Promise { + return; + } /** * iOS only @@ -424,13 +446,17 @@ export class PushObject { @CordovaInstance({ callbackOrder: 'reverse' }) - finish(id?: string): Promise { return; } + finish(id?: string): Promise { + return; + } /** * Tells the OS to clear all notifications from the Notification Center */ @CordovaInstance() - clearAllNotifications(): Promise { return; } + clearAllNotifications(): Promise { + return; + } /** * The subscribe method is used when the application wants to subscribe a new topic to receive push notifications. @@ -438,7 +464,9 @@ export class PushObject { * @return {Promise} */ @CordovaInstance() - subscribe(topic: string): Promise { return; } + subscribe(topic: string): Promise { + return; + } /** * The unsubscribe method is used when the application no longer wants to receive push notifications from a specific topic but continue to receive other push messages. @@ -446,6 +474,7 @@ export class PushObject { * @return {Promise} */ @CordovaInstance() - unsubscribe(topic: string): Promise { return; } - + unsubscribe(topic: string): Promise { + return; + } }