Skip to content

Commit

Permalink
Add showBannersInForeground property
Browse files Browse the repository at this point in the history
See: #45

Fix #45
  • Loading branch information
patrykmol committed Sep 5, 2018
1 parent 4a7b2ee commit a5b1024
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ios/src/ESFBMessaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@property (strong, readonly) NSString *instanceId;
@property (strong, readonly) NSString *token;
@property (strong, readonly) NSDictionary *launchData;
@property (assign) BOOL showBannersInForeground;
@property (assign) BOOL tokenChangedListener;
@property (assign) BOOL instanceIdChangedListener;
@property (assign) BOOL messageListener;
Expand Down
5 changes: 4 additions & 1 deletion src/ios/src/ESFBMessaging.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ @implementation ESFBMessaging
@synthesize tokenChangedListener = _tokenChangedListener;
@synthesize instanceIdChangedListener = _instanceIdChangedListener;
@synthesize messageListener = _messageListener;
@synthesize showBannersInForeground = _showBannersInForeground;

static ESFBMessagingDelegate *messagingDelegate;
static NSDictionary *launchData;
Expand All @@ -62,6 +63,7 @@ + (NSMutableSet *)remoteObjectProperties {
[properties addObject:@"tokenChangedListener"];
[properties addObject:@"instanceIdChangedListener"];
[properties addObject:@"messageListener"];
[properties addObject:@"showBannersInForeground"];
return properties;
}

Expand Down Expand Up @@ -208,7 +210,8 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNot
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
NSDictionary *userInfo = notification.request.content.userInfo;
[self.instance sendMessage:userInfo];
completionHandler(UNNotificationPresentationOptionNone);
UNNotificationPresentationOptions presentation = self.instance.showBannersInForeground ? UNNotificationPresentationOptionBadge : UNNotificationPresentationOptionNone;
completionHandler(presentation);
}
#endif

Expand Down

0 comments on commit a5b1024

Please sign in to comment.