feat(push): Added voip property to IOSPushOptions (#2681)

* feat(push): Added missing voip property to IOSPushOptions

* Update index.ts
This commit is contained in:
rvdleun 2018-08-31 14:23:40 +02:00 committed by Daniel Sogl
parent a73146648f
commit 03e4f0e439

View File

@ -1,10 +1,12 @@
import { Injectable } from '@angular/core'; 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'; import { Observable } from 'rxjs/Observable';
declare const window: any; declare const window: any;
export type EventResponse = RegistrationEventResponse & NotificationEventResponse & Error; export type EventResponse = RegistrationEventResponse &
NotificationEventResponse &
Error;
export interface RegistrationEventResponse { export interface RegistrationEventResponse {
/** /**
@ -13,7 +15,6 @@ export interface RegistrationEventResponse {
registrationId: string; registrationId: string;
} }
export interface NotificationEventResponse { export interface NotificationEventResponse {
/** /**
* The text of the push message sent from the 3rd party service. * 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 * Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1
*/ */
categories?: CategoryArray; 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 { export interface CategoryArray {
@ -203,7 +211,6 @@ export interface BrowserPushOptions {
* Default: http://push.api.phonegap.com/v1/push Optional. * Default: http://push.api.phonegap.com/v1/push Optional.
*/ */
pushServiceURL?: string; pushServiceURL?: string;
} }
export interface PushOptions { export interface PushOptions {
@ -314,7 +321,6 @@ export type PushEvent = string;
}) })
@Injectable() @Injectable()
export class Push extends IonicNativePlugin { export class Push extends IonicNativePlugin {
/** /**
* Init push notifications * Init push notifications
* @param options {PushOptions} * @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. * @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() @Cordova()
hasPermission(): Promise<{ isEnabled: boolean }> { return; } hasPermission(): Promise<{ isEnabled: boolean }> {
return;
}
/** /**
* Create a new notification channel for Android O and above. * Create a new notification channel for Android O and above.
@ -338,7 +346,9 @@ export class Push extends IonicNativePlugin {
@Cordova({ @Cordova({
callbackOrder: 'reverse' callbackOrder: 'reverse'
}) })
createChannel(channel?: Channel): Promise<any> { return; } createChannel(channel?: Channel): Promise<any> {
return;
}
/** /**
* Delete a notification channel for Android O and above. * Delete a notification channel for Android O and above.
@ -347,15 +357,18 @@ export class Push extends IonicNativePlugin {
@Cordova({ @Cordova({
callbackOrder: 'reverse' callbackOrder: 'reverse'
}) })
deleteChannel(id?: string): Promise<any> { return; } deleteChannel(id?: string): Promise<any> {
return;
}
/** /**
* Returns a list of currently configured channels. * Returns a list of currently configured channels.
* @return {Promise<Channel[]>} * @return {Promise<Channel[]>}
*/ */
@Cordova() @Cordova()
listChannels(): Promise<Channel[]> { return; } listChannels(): Promise<Channel[]> {
return;
}
} }
/** /**
@ -367,11 +380,12 @@ export class Push extends IonicNativePlugin {
pluginRef: 'PushNotification' pluginRef: 'PushNotification'
}) })
export class PushObject { export class PushObject {
private _objectInstance: any; private _objectInstance: any;
constructor(options: PushOptions) { constructor(options: PushOptions) {
if (checkAvailability('PushNotification', 'init', 'PushNotification') === true) { if (
checkAvailability('PushNotification', 'init', 'PushNotification') === true
) {
this._objectInstance = window.PushNotification.init(options); this._objectInstance = window.PushNotification.init(options);
} }
} }
@ -386,7 +400,9 @@ export class PushObject {
clearFunction: 'off', clearFunction: 'off',
clearWithArgs: true clearWithArgs: true
}) })
on(event: PushEvent): Observable<EventResponse> { return; } on(event: PushEvent): Observable<EventResponse> {
return;
}
/** /**
* The unregister method is used when the application no longer wants to receive push notifications. * 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. * so you will need to re-register them if you want them to function again without an application reload.
*/ */
@CordovaInstance() @CordovaInstance()
unregister(): Promise<any> { return; } unregister(): Promise<any> {
return;
}
/** /**
* Set the badge count visible when the app is not running * Set the badge count visible when the app is not running
@ -407,13 +425,17 @@ export class PushObject {
@CordovaInstance({ @CordovaInstance({
callbackOrder: 'reverse' callbackOrder: 'reverse'
}) })
setApplicationIconBadgeNumber(count?: number): Promise<any> { return; }; setApplicationIconBadgeNumber(count?: number): Promise<any> {
return;
}
/** /**
* Get the current badge count visible when the app is not running * Get the current badge count visible when the app is not running
* successHandler gets called with an integer which is the current badge count * successHandler gets called with an integer which is the current badge count
*/ */
@CordovaInstance() @CordovaInstance()
getApplicationIconBadgeNumber(): Promise<number> { return; } getApplicationIconBadgeNumber(): Promise<number> {
return;
}
/** /**
* iOS only * iOS only
@ -424,13 +446,17 @@ export class PushObject {
@CordovaInstance({ @CordovaInstance({
callbackOrder: 'reverse' callbackOrder: 'reverse'
}) })
finish(id?: string): Promise<any> { return; } finish(id?: string): Promise<any> {
return;
}
/** /**
* Tells the OS to clear all notifications from the Notification Center * Tells the OS to clear all notifications from the Notification Center
*/ */
@CordovaInstance() @CordovaInstance()
clearAllNotifications(): Promise<any> { return; } clearAllNotifications(): Promise<any> {
return;
}
/** /**
* The subscribe method is used when the application wants to subscribe a new topic to receive push notifications. * 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<any>} * @return {Promise<any>}
*/ */
@CordovaInstance() @CordovaInstance()
subscribe(topic: string): Promise<any> { return; } subscribe(topic: string): Promise<any> {
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. * 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<any>} * @return {Promise<any>}
*/ */
@CordovaInstance() @CordovaInstance()
unsubscribe(topic: string): Promise<any> { return; } unsubscribe(topic: string): Promise<any> {
return;
}
} }