Commit 7022f6af by Sebastián Katzer

Added silent option for ios

parent 16de6fea
...@@ -507,7 +507,11 @@ ...@@ -507,7 +507,11 @@
[self fireEvent:@"trigger" notification:notification.request]; [self fireEvent:@"trigger" notification:notification.request];
} }
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert); if (notification.request.options.silent) {
completionHandler(UNNotificationPresentationOptionNone);
} else {
completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert);
}
} }
/** /**
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
@property (readonly, getter=subtitle) NSString* subtitle; @property (readonly, getter=subtitle) NSString* subtitle;
@property (readonly, getter=badge) NSNumber* badge; @property (readonly, getter=badge) NSNumber* badge;
@property (readonly, getter=text) NSString* text; @property (readonly, getter=text) NSString* text;
@property (readonly, getter=silent) BOOL silent;
@property (readonly, getter=sound) UNNotificationSound* sound; @property (readonly, getter=sound) UNNotificationSound* sound;
@property (readonly, getter=userInfo) NSDictionary* userInfo; @property (readonly, getter=userInfo) NSDictionary* userInfo;
@property (readonly, getter=actions) NSArray<UNNotificationAction *> * actions; @property (readonly, getter=actions) NSArray<UNNotificationAction *> * actions;
......
...@@ -115,6 +115,16 @@ ...@@ -115,6 +115,16 @@
} }
/** /**
* Show notification in foreground.
*
* @return [ BOOL ]
*/
- (BOOL) silent
{
return [[dict objectForKey:@"silent"] boolValue];
}
/**
* The badge number for the notification. * The badge number for the notification.
* *
* @return [ NSNumber* ] * @return [ NSNumber* ]
......
...@@ -30,8 +30,9 @@ exports._defaults = { ...@@ -30,8 +30,9 @@ exports._defaults = {
sound: 'res://platform_default', sound: 'res://platform_default',
badge: undefined, badge: undefined,
data: undefined, data: undefined,
trigger: { type: 'calendar' }, silent: false,
actions: [], actions: [],
trigger: { type: 'calendar' },
actionGroupId: undefined, actionGroupId: undefined,
attachments: [] attachments: []
}; };
...@@ -201,7 +202,8 @@ exports.convertTrigger = function (options) { ...@@ -201,7 +202,8 @@ exports.convertTrigger = function (options) {
var isCal = trigger.type == 'calendar'; var isCal = trigger.type == 'calendar';
if (isCal && !date) { if (isCal && !date) {
date = this.getValueFor(options, 'trigger', 'at', 'firstAt', 'date'); date = this.getValueFor(options, 'at', 'firstAt', 'date');
date = date || isObject && !cfg.getTime ? new Date() : options.trigger;
date = date || new Date(); date = date || new Date();
} }
......
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