feat(local-notifications): add new foreground property (#2633)

* Update index.ts

* Update index.ts
This commit is contained in:
rupendraa 2018-08-17 01:25:17 +05:30 committed by Daniel Sogl
parent 9b4fd02fa5
commit 229b62c10b

View File

@ -17,7 +17,6 @@ export enum ELocalNotificationTriggerUnit {
}
export interface ILocalNotificationTrigger {
/** ***** FIX ***** */
/**
@ -192,7 +191,6 @@ export interface ILocalNotificationProgressBar {
}
export interface ILocalNotification {
/**
* A unique identifier required to clear, cancel, update or retrieve the local notification in the future
* Default: 0
@ -267,7 +265,7 @@ export interface ILocalNotification {
* the value of the key 1 will be used as the 'on' timing, the value of
* the key 2 will be used as the 'off' timing
*/
led?: {color: string, on: number, off: number} | any[] | boolean | string;
led?: { color: string; on: number; off: number } | any[] | boolean | string;
/**
* Notification priority.
@ -398,6 +396,10 @@ export interface ILocalNotification {
*/
mediaSession?: string;
/**
* Make this notification show when app in foreground.
*/
foreground?: boolean;
}
/**
@ -458,7 +460,6 @@ export interface ILocalNotification {
})
@Injectable()
export class LocalNotifications extends IonicNativePlugin {
/**
* Schedules a single or multiple notifications
* @param options {Notification | Array<ILocalNotification>} optional
@ -466,7 +467,7 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
schedule(options?: ILocalNotification | Array<ILocalNotification>): void { }
schedule(options?: ILocalNotification | Array<ILocalNotification>): void {}
/**
* Updates a previously scheduled notification. Must include the id in the options parameter.
@ -475,7 +476,7 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
update(options?: ILocalNotification): void { }
update(options?: ILocalNotification): void {}
/**
* Clears single or multiple notifications
@ -483,14 +484,18 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>} Returns a promise when the notification had been cleared
*/
@Cordova()
clear(notificationId: any): Promise<any> { return; }
clear(notificationId: any): Promise<any> {
return;
}
/**
* Clears all notifications
* @returns {Promise<any>} Returns a promise when all notifications have cleared
*/
@Cordova()
clearAll(): Promise<any> { return; }
clearAll(): Promise<any> {
return;
}
/**
* Cancels single or multiple notifications
@ -498,14 +503,18 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>} Returns a promise when the notification is canceled
*/
@Cordova()
cancel(notificationId: any): Promise<any> { return; }
cancel(notificationId: any): Promise<any> {
return;
}
/**
* Cancels all notifications
* @returns {Promise<any>} Returns a promise when all notifications are canceled
*/
@Cordova()
cancelAll(): Promise<any> { return; }
cancelAll(): Promise<any> {
return;
}
/**
* Checks presence of a notification
@ -513,7 +522,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<boolean>}
*/
@Cordova()
isPresent(notificationId: number): Promise<boolean> { return; }
isPresent(notificationId: number): Promise<boolean> {
return;
}
/**
* Checks is a notification is scheduled
@ -521,7 +532,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<boolean>}
*/
@Cordova()
isScheduled(notificationId: number): Promise<boolean> { return; }
isScheduled(notificationId: number): Promise<boolean> {
return;
}
/**
* Checks if a notification is triggered
@ -529,28 +542,36 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<boolean>}
*/
@Cordova()
isTriggered(notificationId: number): Promise<boolean> { return; }
isTriggered(notificationId: number): Promise<boolean> {
return;
}
/**
* Get all the notification ids
* @returns {Promise<Array<number>>}
*/
@Cordova()
getIds(): Promise<Array<number>> { return; }
getIds(): Promise<Array<number>> {
return;
}
/**
* Get the ids of triggered notifications
* @returns {Promise<Array<number>>}
*/
@Cordova()
getTriggeredIds(): Promise<Array<number>> { return; }
getTriggeredIds(): Promise<Array<number>> {
return;
}
/**
* Get the ids of scheduled notifications
* @returns {Promise<Array<number>>} Returns a promise
*/
@Cordova()
getScheduledIds(): Promise<Array<number>> { return; }
getScheduledIds(): Promise<Array<number>> {
return;
}
/**
* Get a notification object
@ -558,7 +579,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<ILocalNotification>}
*/
@Cordova()
get(notificationId: any): Promise<ILocalNotification> { return; }
get(notificationId: any): Promise<ILocalNotification> {
return;
}
/**
* Get a scheduled notification object
@ -566,7 +589,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<ILocalNotification>}
*/
@Cordova()
getScheduled(notificationId: any): Promise<ILocalNotification> { return; }
getScheduled(notificationId: any): Promise<ILocalNotification> {
return;
}
/**
* Get a triggered notification object
@ -574,42 +599,54 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<ILocalNotification>}
*/
@Cordova()
getTriggered(notificationId: any): Promise<ILocalNotification> { return; }
getTriggered(notificationId: any): Promise<ILocalNotification> {
return;
}
/**
* Get all notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
@Cordova()
getAll(): Promise<Array<ILocalNotification>> { return; }
getAll(): Promise<Array<ILocalNotification>> {
return;
}
/**
* Get all scheduled notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
@Cordova()
getAllScheduled(): Promise<Array<ILocalNotification>> { return; }
getAllScheduled(): Promise<Array<ILocalNotification>> {
return;
}
/**
* Get all triggered notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
@Cordova()
getAllTriggered(): Promise<Array<ILocalNotification>> { return; }
getAllTriggered(): Promise<Array<ILocalNotification>> {
return;
}
/**
* Request permission to show notifications if not already granted.
* @returns {Promise<boolean>}
*/
@Cordova()
requestPermission(): Promise<boolean> { return; }
requestPermission(): Promise<boolean> {
return;
}
/**
* Informs if the app has the permission to show notifications.
* @returns {Promise<boolean>}
*/
@Cordova()
hasPermission(): Promise<boolean> { return; }
hasPermission(): Promise<boolean> {
return;
}
/**
* Adds a group of actions
@ -618,7 +655,12 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>}
*/
@Cordova()
addActions(groupId: any, actions: Array<ILocalNotificationAction>): Promise<any> { return; }
addActions(
groupId: any,
actions: Array<ILocalNotificationAction>
): Promise<any> {
return;
}
/**
* Removes a group of actions
@ -626,7 +668,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<any>}
*/
@Cordova()
removeActions(groupId: any): Promise<any> { return; }
removeActions(groupId: any): Promise<any> {
return;
}
/**
* Checks if a group of actions is defined
@ -634,7 +678,9 @@ export class LocalNotifications extends IonicNativePlugin {
* @returns {Promise<boolean>} Whether the group is defined
*/
@Cordova()
hasActions(groupId: any): Promise<boolean> { return; }
hasActions(groupId: any): Promise<boolean> {
return;
}
/**
* Gets the (platform specific) default settings.
@ -643,7 +689,9 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
getDefaults(): Promise<any> { return; }
getDefaults(): Promise<any> {
return;
}
/**
* Overwrites the (platform specific) default settings.
@ -652,7 +700,9 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
setDefaults(defaults: any): Promise<any> { return; }
setDefaults(defaults: any): Promise<any> {
return;
}
/**
* Sets a callback for a specific event
@ -664,7 +714,9 @@ export class LocalNotifications extends IonicNativePlugin {
clearFunction: 'un',
clearWithArgs: true
})
on(eventName: string): Observable<any> { return; }
on(eventName: string): Observable<any> {
return;
}
/**
* Not an official interface, however its possible to manually fire events.
@ -674,12 +726,14 @@ export class LocalNotifications extends IonicNativePlugin {
@Cordova({
sync: true
})
fireEvent(eventName: string, args: any): void { }
fireEvent(eventName: string, args: any): void {}
/**
* Fire queued events once the device is ready and all listeners are registered.
* @returns {Promise<any>}
*/
@Cordova()
fireQueuedEvents(): Promise<any> { return; }
fireQueuedEvents(): Promise<any> {
return;
}
}