Commit f6544e8b by Sebastián Katzer

All interfaces working except update() for iOS

parent 0fe90469
......@@ -39,41 +39,41 @@
- (void) schedule:(CDVInvokedUrlCommand*)command;
//// Update set of notifications
//- (void) update:(CDVInvokedUrlCommand*)command;
//// Cancel set of notifications
//- (void) cancel:(CDVInvokedUrlCommand*)command;
//// Cancel all notifications
//- (void) cancelAll:(CDVInvokedUrlCommand*)command;
//// Clear set of notifications
//- (void) clear:(CDVInvokedUrlCommand*)command;
//// Clear all notifications
//- (void) clearAll:(CDVInvokedUrlCommand*)command;
//
//// If a notification with an ID is present
//- (void) isPresent:(CDVInvokedUrlCommand*)command;
//// If a notification with an ID is scheduled
//- (void) isScheduled:(CDVInvokedUrlCommand*)command;
//// If a notification with an ID is triggered
//- (void) isTriggered:(CDVInvokedUrlCommand*)command;
//
//// List all ids from all local notifications
//- (void) getAllIds:(CDVInvokedUrlCommand*)command;
//// List all ids from all pending notifications
//- (void) getScheduledIds:(CDVInvokedUrlCommand*)command;
//// List all ids from all triggered notifications
//- (void) getTriggeredIds:(CDVInvokedUrlCommand*)command;
//
//// Propertys for given local notification
//- (void) getSingle:(CDVInvokedUrlCommand*)command;
//// Propertya for given scheduled notification
//- (void) getSingleScheduled:(CDVInvokedUrlCommand*)command;
//// Propertys for given triggered notification
//- (void) getSingleTriggered:(CDVInvokedUrlCommand*)command;
//
//// Property list for given local notifications
//- (void) getAll:(CDVInvokedUrlCommand*)command;
//// Property list for given scheduled notifications
//- (void) getScheduled:(CDVInvokedUrlCommand*)command;
//// Property list for given triggered notifications
//- (void) getTriggered:(CDVInvokedUrlCommand*)command;
// Clear notifications by id
- (void) clear:(CDVInvokedUrlCommand*)command;
// Clear all notifications
- (void) clearAll:(CDVInvokedUrlCommand*)command;
// Cancel notifications by id
- (void) cancel:(CDVInvokedUrlCommand*)command;
// Cancel all notifications
- (void) cancelAll:(CDVInvokedUrlCommand*)command;
// If a notification with an ID is present
- (void) isPresent:(CDVInvokedUrlCommand*)command;
// If a notification with an ID is scheduled
- (void) isScheduled:(CDVInvokedUrlCommand*)command;
// If a notification with an ID is triggered
- (void) isTriggered:(CDVInvokedUrlCommand*)command;
// List of all notification IDs
- (void) ids:(CDVInvokedUrlCommand*)command;
// List of all scheduled notification IDs
- (void) scheduledIds:(CDVInvokedUrlCommand*)command;
// List of all triggered notification IDs
- (void) triggeredIds:(CDVInvokedUrlCommand*)command;
// Notification by id
- (void) notification:(CDVInvokedUrlCommand*)command;
// Scheduled notification by id
- (void) scheduledNotification:(CDVInvokedUrlCommand*)command;
// Triggered notification by id
- (void) triggeredNotification:(CDVInvokedUrlCommand*)command;
// List of notifications by id
- (void) notifications:(CDVInvokedUrlCommand*)command;
// List of scheduled notifications by id
- (void) scheduledNotifications:(CDVInvokedUrlCommand*)command;
// List of triggered notifications by id
- (void) triggeredNotifications:(CDVInvokedUrlCommand*)command;
@end
......@@ -138,379 +138,338 @@
// [self execCallback:command];
// }];
//}
//
///**
// * Cancel a set of notifications.
// *
// * @param ids
// * The IDs of the notifications
// */
//- (void) cancel:(CDVInvokedUrlCommand*)command
//{
// [self.commandDelegate runInBackground:^{
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// for (NSNumber* id in command.arguments) {
// UNNotificationRequest* notification;
//
// notification = [self.center getNotificationWithId:id];
//
// if (!notification)
// continue;
//
// [self.center cancelNotification:notification];
// [self fireEvent:@"cancel" notification:notification];
// }
// } else {
// for (NSNumber* id in command.arguments) {
// UILocalNotification* notification;
//
// notification = [self.app localNotificationWithId:id];
//
// if (!notification)
// continue;
//
// [self.app cancelLocalNotification:notification];
// [self fireEvent:@"cancel" localnotification:notification];
// }
// }
//
// [self execCallback:command];
// }];
//}
//
///**
// * Cancel all local notifications.
// */
//- (void) cancelAll:(CDVInvokedUrlCommand*)command
//{
// [self.commandDelegate runInBackground:^{
// [self cancelAllNotifications];
// [self fireEvent:@"cancelall"];
// [self execCallback:command];
// }];
//}
//
///**
// * Clear a set of notifications.
// *
// * @param ids
// * The IDs of the notifications
// */
//- (void) clear:(CDVInvokedUrlCommand*)command
//{
// [self.commandDelegate runInBackground:^{
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// for (NSNumber* id in command.arguments) {
// UNNotificationRequest* notification;
//
// notification = [self.center getNotificationWithId:id];
//
// if (!notification)
// continue;
//
// [self.center clearNotification:notification];
// [self fireEvent:@"clear" notification:notification];
// }
// } else {
// for (NSNumber* id in command.arguments) {
// UILocalNotification* notification;
//
// notification = [self.app localNotificationWithId:id];
//
// if (!notification)
// continue;
//
// [self.app clearLocalNotification:notification];
// [self fireEvent:@"clear" localnotification:notification];
// }
// }
//
// [self execCallback:command];
// }];
//}
//
///**
// * Clear all local notifications.
// */
//- (void) clearAll:(CDVInvokedUrlCommand*)command
//{
// [self.commandDelegate runInBackground:^{
// [self clearAllNotifications];
// [self fireEvent:@"clearall"];
// [self execCallback:command];
// }];
//}
//
///**
// * If a notification by ID is present.
// *
// * @param id
// * The ID of the notification
// */
//- (void) isPresent:(CDVInvokedUrlCommand *)command
//{
// [self isPresent:command type:NotifcationTypeAll];
//}
//
///**
// * If a notification by ID is scheduled.
// *
// * @param id
// * The ID of the notification
// */
//- (void) isScheduled:(CDVInvokedUrlCommand*)command
//{
// [self isPresent:command type:NotifcationTypeScheduled];
//}
//
///**
// * Check if a notification with an ID is triggered.
// *
// * @param id
// * The ID of the notification
// */
//- (void) isTriggered:(CDVInvokedUrlCommand*)command
//{
// [self isPresent:command type:NotifcationTypeTriggered];
//}
//
///**
// * Check if a notification with an ID exists.
// *
// * @param type
// * The notification life cycle type
// */
//- (void) isPresent:(CDVInvokedUrlCommand*)command
// type:(APPNotificationType)type;
//{
// [self.commandDelegate runInBackground:^{
// NSNumber* id = [command argumentAtIndex:0];
// BOOL exist;
//
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// exist = [self.center notificationExist:id type:type];
// } else {
// if (type == NotifcationTypeAll) {
// exist = [self.app localNotificationExist:id];
// } else {
// exist = [self.app localNotificationExist:id type:type];
// }
// }
//
// CDVPluginResult* result;
// result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
// messageAsBool:exist];
//
// [self.commandDelegate sendPluginResult:result
// callbackId:command.callbackId];
// }];
//}
//
///**
// * List all ids from all local notifications.
// */
//- (void) getAllIds:(CDVInvokedUrlCommand*)command
//{
// [self getIds:command byType:NotifcationTypeAll];
//}
//
///**
// * List all ids from all pending notifications.
// */
//- (void) getScheduledIds:(CDVInvokedUrlCommand*)command
//{
// [self getIds:command byType:NotifcationTypeScheduled];
//}
//
///**
// * List all ids from all triggered notifications.
// */
//- (void) getTriggeredIds:(CDVInvokedUrlCommand*)command
//{
// [self getIds:command byType:NotifcationTypeTriggered];
//}
//
///**
// * List of ids for given local notifications.
// *
// * @param type
// * Notification life cycle type
// * @param ids
// * The IDs of the notifications
// */
//- (void) getIds:(CDVInvokedUrlCommand*)command
// byType:(APPNotificationType)type;
//{
// [self.commandDelegate runInBackground:^{
// NSArray* ids;
//
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// ids = [self.center getNotificationIdsByType:type];
// } else {
// if (type == NotifcationTypeAll) {
// ids = [self.app localNotificationIds];
// } else {
// ids = [self.app localNotificationIdsByType:type];
// }
// }
//
// CDVPluginResult* result;
// result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
// messageAsArray:ids];
//
// [self.commandDelegate sendPluginResult:result
// callbackId:command.callbackId];
// }];
//}
//
///**
// * Propertys for given local notification.
// */
//- (void) getSingle:(CDVInvokedUrlCommand*)command
//{
// [self getOption:command byType:NotifcationTypeAll];
//}
//
///**
// * Propertya for given scheduled notification.
// */
//- (void) getSingleScheduled:(CDVInvokedUrlCommand*)command
//{
// [self getOption:command byType:NotifcationTypeScheduled];
//}
//
//// Propertys for given triggered notification
//- (void) getSingleTriggered:(CDVInvokedUrlCommand*)command
//{
// [self getOption:command byType:NotifcationTypeTriggered];
//}
//
///**
// * Property list for given local notifications.
// *
// * @param ids
// * The IDs of the notifications
// */
//- (void) getAll:(CDVInvokedUrlCommand*)command
//{
// [self getOptions:command byType:NotifcationTypeAll];
//}
//
///**
// * Property list for given scheduled notifications.
// *
// * @param ids
// * The IDs of the notifications
// */
//- (void) getScheduled:(CDVInvokedUrlCommand*)command
//{
// [self getOptions:command byType:NotifcationTypeScheduled];
//}
//
///**
// * Property list for given triggered notifications.
// *
// * @param ids
// * The IDs of the notifications
// */
//- (void) getTriggered:(CDVInvokedUrlCommand *)command
//{
// [self getOptions:command byType:NotifcationTypeTriggered];
//}
//
///**
// * Propertys for given triggered notification.
// *
// * @param type
// * Notification life cycle type
// * @param ids
// * The ID of the notification
// */
//- (void) getOption:(CDVInvokedUrlCommand*)command
// byType:(APPNotificationType)type;
//{
// [self.commandDelegate runInBackground:^{
// NSArray* ids = command.arguments;
// NSArray* notifications;
//
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// notifications = [self.center getNotificationOptionsByType:type
// andId:ids];
// } else {
// if (type == NotifcationTypeAll) {
// notifications = [self.app localNotificationOptionsById:ids];
// }
// else {
// notifications = [self.app localNotificationOptionsByType:type
// andId:ids];
// }
// }
//
// CDVPluginResult* result;
// result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
// messageAsDictionary:[notifications firstObject]];
//
// [self.commandDelegate sendPluginResult:result
// callbackId:command.callbackId];
// }];
//}
//
///**
// * Property list for given triggered notifications.
// *
// * @param type
// * Notification life cycle type
// * @param ids
// * The IDs of the notifications
// */
//- (void) getOptions:(CDVInvokedUrlCommand*)command
// byType:(APPNotificationType)type;
//{
// [self.commandDelegate runInBackground:^{
// NSArray* ids = command.arguments;
// NSArray* notifications;
//
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// if (type == NotifcationTypeAll && ids.count == 0) {
// notifications = [self.center getNotificationOptions];
// }
// else if (type == NotifcationTypeAll) {
// notifications = [self.center getNotificationOptionsById:ids];
// }
// else if (ids.count == 0) {
// notifications = [self.center getNotificationOptionsByType:type];
// }
// else {
// notifications = [self.center getNotificationOptionsByType:type
// andId:ids];
// }
// } else {
// if (type == NotifcationTypeAll && ids.count == 0) {
// notifications = [self.app localNotificationOptions];
// }
// else if (type == NotifcationTypeAll) {
// notifications = [self.app localNotificationOptionsById:ids];
// }
// else if (ids.count == 0) {
// notifications = [self.app localNotificationOptionsByType:type];
// }
// else {
// notifications = [self.app localNotificationOptionsByType:type
// andId:ids];
// }
// }
//
// CDVPluginResult* result;
// result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
// messageAsArray:notifications];
//
// [self.commandDelegate sendPluginResult:result
// callbackId:command.callbackId];
// }];
//}
/**
* Clear notifications by id.
*
* @param [ Array<Int> ] The IDs of the notifications to clear.
*
* @return [ Void ]
*/
- (void) clear:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate runInBackground:^{
for (NSNumber* id in command.arguments) {
UNNotificationRequest* notification;
notification = [self.center getNotificationWithId:id];
if (!notification)
continue;
[self.center clearNotification:notification];
[self fireEvent:@"clear" notification:notification];
}
[self execCallback:command];
}];
}
/**
* Clear all local notifications.
*
* @return [ Void ]
*/
- (void) clearAll:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate runInBackground:^{
[self.center clearAllNotifications];
[self.app setApplicationIconBadgeNumber:0];
[self fireEvent:@"clearall"];
[self execCallback:command];
}];
}
/**
* Cancel notifications by id.
*
* @param [ Array<Int> ] The IDs of the notifications to clear.
*
* @return [ Void ]
*/
- (void) cancel:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate runInBackground:^{
for (NSNumber* id in command.arguments) {
UNNotificationRequest* notification;
notification = [self.center getNotificationWithId:id];
if (!notification)
continue;
[self.center cancelNotification:notification];
[self fireEvent:@"cancel" notification:notification];
}
[self execCallback:command];
}];
}
/**
* Cancel all local notifications.
*
* @return [ Void ]
*/
- (void) cancelAll:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate runInBackground:^{
[self.center cancelAllNotifications];
[self.app setApplicationIconBadgeNumber:0];
[self fireEvent:@"cancelall"];
[self execCallback:command];
}];
}
/**
* If a notification by ID is present.
*
* @param [ Number ]id The ID of the notification.
*
* @return [ Void ]
*/
- (void) isPresent:(CDVInvokedUrlCommand *)command
{
[self exist:command byType:NotifcationTypeAll];
}
/**
* If a notification by ID is scheduled.
*
* @param [ Number ]id The ID of the notification.
*
* @return [ Void ]
*/
- (void) isScheduled:(CDVInvokedUrlCommand*)command
{
[self exist:command byType:NotifcationTypeScheduled];
}
/**
* Check if a notification with an ID is triggered.
*
* @param [ Number ]id The ID of the notification.
*
* @return [ Void ]
*/
- (void) isTriggered:(CDVInvokedUrlCommand*)command
{
[self exist:command byType:NotifcationTypeTriggered];
}
/**
* Check if a notification exists by ID and type.
*
* @param [ APPNotificationType ] type The type of notifications to look for.
*
* @return [ Void ]
*/
- (void) exist:(CDVInvokedUrlCommand*)command
byType:(APPNotificationType)type;
{
[self.commandDelegate runInBackground:^{
NSNumber* id = [command argumentAtIndex:0];
BOOL exist = [_center notificationExist:id type:type];
CDVPluginResult* result;
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsBool:exist];
[self.commandDelegate sendPluginResult:result
callbackId:command.callbackId];
}];
}
/**
* List of all notification IDs.
*
* @return [ Void ]
*/
- (void) ids:(CDVInvokedUrlCommand*)command
{
[self ids:command byType:NotifcationTypeAll];
}
/**
* List of all scheduled notification IDs.
*
* @return [ Void ]
*/
- (void) scheduledIds:(CDVInvokedUrlCommand*)command
{
[self ids:command byType:NotifcationTypeScheduled];
}
/**
* List of all triggered notification IDs.
*
* @return [ Void ]
*/
- (void) triggeredIds:(CDVInvokedUrlCommand*)command
{
[self ids:command byType:NotifcationTypeTriggered];
}
/**
* List of ids for given local notifications.
*
* @param [ APPNotificationType ] type The type of notifications to look for.
*
* @return [ Void ]
*/
- (void) ids:(CDVInvokedUrlCommand*)command
byType:(APPNotificationType)type;
{
[self.commandDelegate runInBackground:^{
NSArray* ids = [self.center getNotificationIdsByType:type];
CDVPluginResult* result;
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsArray:ids];
[self.commandDelegate sendPluginResult:result
callbackId:command.callbackId];
}];
}
/**
* Notification by id.
*
* @param [ Number ] id The id of the notification to return.
*
* @return [ Void ]
*/
- (void) notification:(CDVInvokedUrlCommand*)command
{
[self notification:command byType:NotifcationTypeAll];
}
/**
* Scheduled notification by id.
*
* @param [ Number ] id The id of the notification to return.
*
* @return [ Void ]
*/
- (void) scheduledNotification:(CDVInvokedUrlCommand*)command
{
[self notification:command byType:NotifcationTypeScheduled];
}
/**
* Triggered notification by id.
*
* @param [ Number ] id The id of the notification to return.
*
* @return [ Void ]
*/
- (void) triggeredNotification:(CDVInvokedUrlCommand*)command
{
[self notification:command byType:NotifcationTypeTriggered];
}
/**
* Notification by type and id.
*
* @param [ APPNotificationType ] type The type of notifications to look for.
*
* @return [ Void ]
*/
- (void) notification:(CDVInvokedUrlCommand*)command
byType:(APPNotificationType)type;
{
[self.commandDelegate runInBackground:^{
NSArray* ids = command.arguments;
NSArray* notifications;
notifications = [_center getNotificationOptionsByType:type andId:ids];
CDVPluginResult* result;
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsDictionary:[notifications firstObject]];
[self.commandDelegate sendPluginResult:result
callbackId:command.callbackId];
}];
}
/**
* List of notifications by id.
*
* @param [ Array<Number> ] ids The ids of the notifications to return.
*
* @return [ Void ]
*/
- (void) notifications:(CDVInvokedUrlCommand*)command
{
[self notifications:command byType:NotifcationTypeAll];
}
/**
* List of scheduled notifications by id.
*
* @param [ Array<Number> ] ids The ids of the notifications to return.
*
* @return [ Void ]
*/
- (void) scheduledNotifications:(CDVInvokedUrlCommand*)command
{
[self notifications:command byType:NotifcationTypeScheduled];
}
/**
* List of triggered notifications by id.
*
* @param [ Array<Number> ] ids The ids of the notifications to return.
*
* @return [ Void ]
*/
- (void) triggeredNotifications:(CDVInvokedUrlCommand *)command
{
[self notifications:command byType:NotifcationTypeTriggered];
}
/**
* List of notifications by type and id.
*
* @param [ APPNotificationType ] type The type of notifications to look for.
*
* @return [ Void ]
*/
- (void) notifications:(CDVInvokedUrlCommand*)command
byType:(APPNotificationType)type;
{
[self.commandDelegate runInBackground:^{
NSArray* ids = command.arguments;
NSArray* notifications;
if (type == NotifcationTypeAll && ids.count == 0) {
notifications = [_center getNotificationOptions];
}
else if (type == NotifcationTypeAll) {
notifications = [_center getNotificationOptionsById:ids];
}
else if (ids.count == 0) {
notifications = [_center getNotificationOptionsByType:type];
}
else {
notifications = [_center getNotificationOptionsByType:type
andId:ids];
}
CDVPluginResult* result;
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsArray:notifications];
[self.commandDelegate sendPluginResult:result
callbackId:command.callbackId];
}];
}
/**
* Check for permission to show notifications.
*
* @return [ Void ]
*/
- (void) check:(CDVInvokedUrlCommand*)command
{
......@@ -530,6 +489,8 @@
/**
* Request for permission to show notifcations.
*
* @return [ Void ]
*/
- (void) request:(CDVInvokedUrlCommand*)command
{
......@@ -574,34 +535,6 @@
////
//// [self scheduleLocalNotification:notification];
//}
//
///**
// * Cancel all local notifications.
// */
//- (void) cancelAllNotifications
//{
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// [self.center cancelAllNotifications];
// } else {
// [self.app cancelAllLocalNotifications];
// }
//
// [self.app setApplicationIconBadgeNumber:0];
//}
//
///**
// * Clear all local notifications.
// */
//- (void) clearAllNotifications
//{
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// [self.center clearAllNotifications];
// } else {
// [self.app clearAllLocalNotifications];
// }
//
// [self.app setApplicationIconBadgeNumber:0];
//}
#pragma mark -
#pragma mark UNUserNotificationCenterDelegate
......
......@@ -125,288 +125,276 @@ exports.schedule = function (msgs, callback, scope, args) {
// }
// };
// /**
// * Clear the specified notification.
// *
// * @param {String} id
// * The ID of the notification
// * @param {Function} callback
// * A function to be called after the notification has been cleared
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.clear = function (ids, callback, scope) {
// ids = Array.isArray(ids) ? ids : [ids];
// ids = this.convertIds(ids);
// this.exec('clear', ids, callback, scope);
// };
/**
* Clear the specified notifications by id.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.clear = function (ids, callback, scope) {
ids = Array.isArray(ids) ? ids : [ids];
ids = this.convertIds(ids);
// /**
// * Clear all previously sheduled notifications.
// *
// * @param {Function} callback
// * A function to be called after all notifications have been cleared
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.clearAll = function (callback, scope) {
// this.exec('clearAll', null, callback, scope);
// };
this.exec('clear', ids, callback, scope);
};
// /**
// * Cancel the specified notifications.
// *
// * @param {String[]} ids
// * The IDs of the notifications
// * @param {Function} callback
// * A function to be called after the notifications has been canceled
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.cancel = function (ids, callback, scope) {
// ids = Array.isArray(ids) ? ids : [ids];
// ids = this.convertIds(ids);
/**
* Clear all triggered notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.clearAll = function (callback, scope) {
this.exec('clearAll', null, callback, scope);
};
// this.exec('cancel', ids, callback, scope);
// };
/**
* Clear the specified notifications by id.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.cancel = function (ids, callback, scope) {
ids = Array.isArray(ids) ? ids : [ids];
ids = this.convertIds(ids);
// /**
// * Remove all previously registered notifications.
// *
// * @param {Function} callback
// * A function to be called after all notifications have been canceled
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.cancelAll = function (callback, scope) {
// this.exec('cancelAll', null, callback, scope);
// };
this.exec('cancel', ids, callback, scope);
};
// /**
// * Check if a notification with an ID is present.
// *
// * @param {String} id
// * The ID of the notification
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.isPresent = function (id, callback, scope) {
// this.exec('isPresent', id || 0, callback, scope);
// };
/**
* Cancel all scheduled notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.cancelAll = function (callback, scope) {
this.exec('cancelAll', null, callback, scope);
};
// /**
// * Check if a notification with an ID is scheduled.
// *
// * @param {String} id
// * The ID of the notification
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.isScheduled = function (id, callback, scope) {
// this.exec('isScheduled', id || 0, callback, scope);
// };
/**
* Check if a notification is present.
*
* @param [ Int ] id The ID of the notification.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.isPresent = function (id, callback, scope) {
this.exec('isPresent', id, callback, scope);
};
// /**
// * Check if a notification with an ID was triggered.
// *
// * @param {String} id
// * The ID of the notification
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.isTriggered = function (id, callback, scope) {
// this.exec('isTriggered', id || 0, callback, scope);
// };
/**
* Check if a notification is scheduled.
*
* @param [ Int ] id The ID of the notification.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.isScheduled = function (id, callback, scope) {
this.exec('isScheduled', id, callback, scope);
};
// *
// * List all local notification IDs.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
/**
* Check if a notification was triggered.
*
* @param [ Int ] id The ID of the notification.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.isTriggered = function (id, callback, scope) {
this.exec('isTriggered', id, callback, scope);
};
// exports.getAllIds = function (callback, scope) {
// this.exec('getAllIds', null, callback, scope);
// };
/**
* List of all notification ids.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getAllIds = function (callback, scope) {
this.exec('ids', null, callback, scope);
};
// /**
// * Alias for `getAllIds`.
// */
// exports.getIds = function () {
// this.getAllIds.apply(this, arguments);
// };
/**
* Alias for `getAllIds`.
*/
exports.getIds = function () {
this.getAllIds.apply(this, arguments);
};
// /**
// * List all scheduled notification IDs.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getScheduledIds = function (callback, scope) {
// this.exec('getScheduledIds', null, callback, scope);
// };
/**
* List of all scheduled notification IDs.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getScheduledIds = function (callback, scope) {
this.exec('scheduledIds', null, callback, scope);
};
// /**
// * List all triggered notification IDs.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getTriggeredIds = function (callback, scope) {
// this.exec('getTriggeredIds', null, callback, scope);
// };
/**
* List of all triggered notification IDs.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getTriggeredIds = function (callback, scope) {
this.exec('triggeredIds', null, callback, scope);
};
// /**
// * Property list for given local notifications.
// * If called without IDs, all notification will be returned.
// *
// * @param {Number[]?} ids
// * Set of notification IDs
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.get = function () {
// var args = Array.apply(null, arguments);
/**
* List of local notifications specified by id.
* If called without IDs, all notification will be returned.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.get = function () {
var args = Array.apply(null, arguments);
// if (typeof args[0] == 'function') {
// args.unshift([]);
// }
if (typeof args[0] == 'function') {
args.unshift([]);
}
// var ids = args[0],
// callback = args[1],
// scope = args[2];
var ids = args[0],
callback = args[1],
scope = args[2];
// if (!Array.isArray(ids)) {
// this.exec('getSingle', Number(ids), callback, scope);
// return;
// }
if (!Array.isArray(ids)) {
this.exec('notification', Number(ids), callback, scope);
return;
}
// ids = this.convertIds(ids);
ids = this.convertIds(ids);
// this.exec('getAll', ids, callback, scope);
// };
this.exec('notifications', ids, callback, scope);
};
// /**
// * Property list for all local notifications.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getAll = function (callback, scope) {
// this.exec('getAll', null, callback, scope);
// };
/**
* List for all notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getAll = function (callback, scope) {
this.exec('notifications', null, callback, scope);
};
// /**
// * Property list for given scheduled notifications.
// * If called without IDs, all notification will be returned.
// *
// * @param {Number[]?} ids
// * Set of notification IDs
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getScheduled = function () {
// var args = Array.apply(null, arguments);
/**
* List of scheduled notifications specified by id.
* If called without IDs, all notification will be returned.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getScheduled = function () {
var args = Array.apply(null, arguments);
// if (typeof args[0] == 'function') {
// args.unshift([]);
// }
if (typeof args[0] == 'function') {
args.unshift([]);
}
// var ids = args[0],
// callback = args[1],
// scope = args[2];
var ids = args[0],
callback = args[1],
scope = args[2];
// if (!Array.isArray(ids)) {
// ids = [ids];
// }
if (!Array.isArray(ids)) {
ids = [ids];
}
// if (!Array.isArray(ids)) {
// this.exec('getSingleScheduled', Number(ids), callback, scope);
// return;
// }
if (!Array.isArray(ids)) {
this.exec('scheduledNotification', Number(ids), callback, scope);
return;
}
// ids = this.convertIds(ids);
ids = this.convertIds(ids);
// this.exec('getScheduled', ids, callback, scope);
// };
this.exec('scheduledNotifications', ids, callback, scope);
};
// /**
// * Property list for all scheduled notifications.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getAllScheduled = function (callback, scope) {
// this.exec('getScheduled', null, callback, scope);
// };
/**
* List of all scheduled notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*/
exports.getAllScheduled = function (callback, scope) {
this.exec('scheduledNotifications', null, callback, scope);
};
// /**
// * Property list for given triggered notifications.
// * If called without IDs, all notification will be returned.
// *
// * @param {Number[]?} ids
// * Set of notification IDs
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getTriggered = function () {
// var args = Array.apply(null, arguments);
/**
* List of triggered notifications specified by id.
* If called without IDs, all notification will be returned.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getTriggered = function () {
var args = Array.apply(null, arguments);
// if (typeof args[0] == 'function') {
// args.unshift([]);
// }
if (typeof args[0] == 'function') {
args.unshift([]);
}
// var ids = args[0],
// callback = args[1],
// scope = args[2];
var ids = args[0],
callback = args[1],
scope = args[2];
// if (!Array.isArray(ids)) {
// ids = [ids];
// }
if (!Array.isArray(ids)) {
ids = [ids];
}
// if (!Array.isArray(ids)) {
// this.exec('getSingleTriggered', Number(ids), callback, scope);
// return;
// }
if (!Array.isArray(ids)) {
this.exec('triggeredNotification', Number(ids), callback, scope);
return;
}
// ids = this.convertIds(ids);
ids = this.convertIds(ids);
// this.exec('getTriggered', ids, callback, scope);
// };
this.exec('triggeredNotifications', ids, callback, scope);
};
// /**
// * Property list for all triggered notifications.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getAllTriggered = function (callback, scope) {
// this.exec('getTriggered', null, callback, scope);
// };
/**
* List of all triggered notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*/
exports.getAllTriggered = function (callback, scope) {
this.exec('triggeredNotifications', null, callback, scope);
};
/**
* The (platform specific) default settings.
......
......@@ -70,223 +70,211 @@ exports.schedule = function (notifications, callback, scope, args) {
// this.core.update(notifications, callback, scope, args);
// };
// /**
// * Clear the specified notification.
// *
// * @param {String} id
// * The ID of the notification
// * @param {Function} callback
// * A function to be called after the notification has been cleared
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.clear = function (ids, callback, scope) {
// this.core.clear(ids, callback, scope);
// };
// /**
// * Clear all previously sheduled notifications.
// *
// * @param {Function} callback
// * A function to be called after all notifications have been cleared
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.clearAll = function (callback, scope) {
// this.core.clearAll(callback, scope);
// };
/**
* Clear the specified notifications by id.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.clear = function (ids, callback, scope) {
this.core.clear(ids, callback, scope);
};
// /**
// * Cancel the specified notifications.
// *
// * @param {String[]} ids
// * The IDs of the notifications
// * @param {Function} callback
// * A function to be called after the notifications has been canceled
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.cancel = function (ids, callback, scope) {
// this.core.cancel(ids, callback, scope);
// };
/**
* Clear all triggered notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.clearAll = function (callback, scope) {
this.core.clearAll(callback, scope);
};
// /**
// * Remove all previously registered notifications.
// *
// * @param {Function} callback
// * A function to be called after all notifications have been canceled
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.cancelAll = function (callback, scope) {
// this.core.cancelAll(callback, scope);
// };
/**
* Cancel the specified notifications by id.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.cancel = function (ids, callback, scope) {
this.core.cancel(ids, callback, scope);
};
// /**
// * Check if a notification with an ID is present.
// *
// * @param {String} id
// * The ID of the notification
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.isPresent = function (id, callback, scope) {
// this.core.isPresent(id, callback, scope);
// };
/**
* Cancel all scheduled notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.cancelAll = function (callback, scope) {
this.core.cancelAll(callback, scope);
};
// /**
// * Check if a notification with an ID is scheduled.
// *
// * @param {String} id
// * The ID of the notification
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.isScheduled = function (id, callback, scope) {
// this.core.isScheduled(id, callback, scope);
// };
/**
* Check if a notification is present.
*
* @param [ Int ] id The ID of the notification.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.isPresent = function (id, callback, scope) {
this.core.isPresent(id, callback, scope);
};
// *
// * Check if a notification with an ID was triggered.
// *
// * @param {String} id
// * The ID of the notification
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
/**
* Check if a notification is scheduled.
*
* @param [ Int ] id The ID of the notification.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.isScheduled = function (id, callback, scope) {
this.core.isScheduled(id, callback, scope);
};
// exports.isTriggered = function (id, callback, scope) {
// this.core.isTriggered(id, callback, scope);
// };
/**
* Check if a notification was triggered.
*
* @param [ Int ] id The ID of the notification.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.isTriggered = function (id, callback, scope) {
this.core.isTriggered(id, callback, scope);
};
// /**
// * List all local notification IDs.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getAllIds = function (callback, scope) {
// this.core.getAllIds(callback, scope);
// };
/**
* List of all notification ids.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getAllIds = function (callback, scope) {
this.core.getAllIds(callback, scope);
};
// /**
// * Alias for `getAllIds`.
// */
// exports.getIds = function () {
// this.getAllIds.apply(this, arguments);
// };
/**
* Alias for `getAllIds`.
*/
exports.getIds = function () {
this.getAllIds.apply(this, arguments);
};
// /**
// * List all scheduled notification IDs.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getScheduledIds = function (callback, scope) {
// this.core.getScheduledIds(callback, scope);
// };
/**
* List of all scheduled notification IDs.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getScheduledIds = function (callback, scope) {
this.core.getScheduledIds(callback, scope);
};
// /**
// * List all triggered notification IDs.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getTriggeredIds = function (callback, scope) {
// this.core.getTriggeredIds(callback, scope);
// };
/**
* List of all triggered notification IDs.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getTriggeredIds = function (callback, scope) {
this.core.getTriggeredIds(callback, scope);
};
// /**
// * Property list for given local notifications.
// * If called without IDs, all notification will be returned.
// *
// * @param {Number[]?} ids
// * Set of notification IDs
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.get = function () {
// this.core.get.apply(this.core, arguments);
// };
/**
* List of local notifications specified by id.
* If called without IDs, all notification will be returned.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.get = function (ids, callback, scope) {
this.core.get(ids, callback, scope);
};
// /**
// * Property list for all local notifications.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getAll = function (callback, scope) {
// this.core.getAll(callback, scope);
// };
/**
* List for all notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getAll = function (callback, scope) {
this.core.getAll(callback, scope);
};
// /**
// * Property list for given scheduled notifications.
// * If called without IDs, all notification will be returned.
// *
// * @param {Number[]?} ids
// * Set of notification IDs
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getScheduled = function () {
// this.core.getScheduled.apply(this.core, arguments);
// };
/**
* List of scheduled notifications specified by id.
* If called without IDs, all notification will be returned.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getScheduled = function (ids, callback, scope) {
this.core.getScheduled(ids, callback, scope);
};
// /**
// * Property list for all scheduled notifications.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getAllScheduled = function (callback, scope) {
// this.core.getAllScheduled(callback, scope);
// };
/**
* List of all scheduled notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*/
exports.getAllScheduled = function (callback, scope) {
this.core.getAllScheduled(callback, scope);
};
// /**
// * Property list for given triggered notifications.
// * If called without IDs, all notification will be returned.
// *
// * @param {Number[]?} ids
// * Set of notification IDs
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getTriggered = function () {
// this.core.getTriggered.apply(this.core, arguments);
// };
/**
* List of triggered notifications specified by id.
* If called without IDs, all notification will be returned.
*
* @param [ Array<Int> ] ids The IDs of the notifications.
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*
* @return [ Void ]
*/
exports.getTriggered = function (ids, callback, scope) {
this.core.getTriggered(ids, callback, scope);
};
// /**
// * Property list for all triggered notifications.
// *
// * @param {Function} callback
// * A callback function to be called with the list
// * @param {Object?} scope
// * The scope for the callback function
// */
// exports.getAllTriggered = function (callback, scope) {
// this.core.getAllTriggered(callback, scope);
// };
/**
* List of all triggered notifications.
*
* @param [ Function ] callback The function to be exec as the callback.
* @param [ Object ] scope The callback function's scope.
*/
exports.getAllTriggered = function (callback, scope) {
this.core.getAllTriggered(callback, scope);
};
/**
* The (platform specific) default settings.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment