From 5d5bae3b789f8d78270aa9e5c2089aa2fd4f70c1 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 10 Mar 2016 17:47:16 -0500 Subject: [PATCH] feat(localnotification): complete functionality --- src/plugins/localnotifications.ts | 140 +++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 4 deletions(-) diff --git a/src/plugins/localnotifications.ts b/src/plugins/localnotifications.ts index 068b8a6436..13643116a5 100644 --- a/src/plugins/localnotifications.ts +++ b/src/plugins/localnotifications.ts @@ -42,15 +42,149 @@ import {Plugin, Cordova} from './plugin'; }) export class LocalNotifications { + /** + * Schedules a single or multiple notifications + * @param options + */ @Cordova({ sync: true }) - static schedule(options? : ScheduleOptions) : void {} + static schedule(options? : Notification) : void {} + + /** + * Updates a previously scheduled notification. Must include the id in the options parameter. + * @param options + */ + @Cordova({ + sync: true + }) + static update(options? : Notification) : void {} + + /** + * Clears single or multiple notifications + * @param notificationId A single notification id, or an array of notification ids. + */ + @Cordova() + static clear(notificationId : any) : Promise {return} + + /** + * Clears all notifications + */ + @Cordova({ + successIndex: 0, + errorIndex: 2 + }) + static clearAll() : Promise {return} + + /** + * Cancels single or multiple notifications + * @param notificationId A single notification id, or an array of notification ids. + */ + @Cordova() + static cancel(notificationId : any) : Promise {return} + + /** + * Cancels all notifications + */ + @Cordova({ + successIndex: 0, + errorIndex: 2 + }) + static cancelAll() : Promise {return} + + /** + * Checks presence of a notification + * @param notificationId + */ + @Cordova() + static isPresent (notificationId : number) : Promise {return} + + /** + * Checks is a notification is scheduled + * @param notificationId + */ + @Cordova() + static isScheduled (notificationId : number) : Promise {return} + + /** + * Checks if a notification is triggered + * @param notificationId + */ + @Cordova() + static isTriggered (notificationId : number) : Promise {return} + + /** + * Get all the notification ids + */ + @Cordova() + static getAllIds () : Promise> {return} + + /** + * Get the ids of triggered notifications + */ + @Cordova() + static getTriggeredIds () : Promise> {return} + + /** + * Get the ids of scheduled notifications + */ + @Cordova() + static getScheduledIds () : Promise> {return} + + /** + * Get a notification object + * @param notificationId The id of the notification to get + */ + @Cordova() + static get (notificationId : any) : Promise {return} + + /** + * Get a scheduled notification object + * @param notificationId The id of the notification to get + */ + @Cordova() + static getScheduled (notificationId : any) : Promise {return} + + /** + * Get a triggered notification object + * @param notificationId The id of the notification to get + */ + @Cordova() + static getTriggered (notificationId : any) : Promise {return} + + /** + * Get all notification objects + */ + @Cordova() + static getAll() : Promise> {return} + + /** + * Get all scheduled notification objects + */ + @Cordova() + static getAllScheduled() : Promise> {return} + + /** + * Get all triggered notification objects + */ + @Cordova() + static getAllTriggered() : Promise> {return} + + + /** + * Sets a callback for a specific event + * @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall + * @param callback Call back function. All events return notification and state parameter. clear and clearall return state parameter only. + */ + @Cordova({ + sync: true + }) + static on(eventName : string, callback : any) : void {} } -interface ScheduleOptions { +interface Notification { /** * A unique identifier required to clear, cancel, update or retrieve the local notification in the future @@ -131,6 +265,4 @@ interface ScheduleOptions { * Default: FFFFFF */ led : string - - } \ No newline at end of file