Skip to content

Commit

Permalink
Merge pull request #229 from olgadanylova/master
Browse files Browse the repository at this point in the history
BKNDLSS-18579
  • Loading branch information
Olha Danylova authored Jun 6, 2019
2 parents e8fba3c + f18cf62 commit 5ca7699
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
-(void)sendEmails:(NSString *)templateName templateValues:(NSDictionary<NSString *, NSString*> *)templateValues envelope:(id<IEmailEnvelope>)envelope response:(void(^)(MessageStatus *))responseBlock error:(void(^)(Fault *))errorBlock;
```
* added groups support for push notifications (for iOS 12+)

## 5.2.13 May, 13 2019
* added support of sortBy and properties for LoadRelationsQueryBuilder
Expand Down
2 changes: 1 addition & 1 deletion Pods/Backendless.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions SDK/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- Socket.IO-Client-Swift (15.0.0):
- Socket.IO-Client-Swift (15.1.0):
- Starscream (~> 3.1)
- Starscream (3.1.0)

Expand All @@ -12,9 +12,9 @@ SPEC REPOS:
- Starscream

SPEC CHECKSUMS:
Socket.IO-Client-Swift: c039a808195d22a7192962841b8c035cb61ea49e
Socket.IO-Client-Swift: 7cb44c0ffb86e158cee32d0642d30ec5fdcf8f61
Starscream: 08172b481e145289c4930cb567230fb55897cfa4

PODFILE CHECKSUM: 675cc991d5f2f8cb6bcd0ce2d67444ed1b8f2a74

COCOAPODS: 1.7.0.beta.3
COCOAPODS: 1.7.1
64 changes: 41 additions & 23 deletions SDK/backendlessAPI/Classes/Messaging/BackendlessPushHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ -(NSDictionary *)dictionaryWithoutNulls:(NSDictionary *)dictionary {
-(UNNotificationRequest *)createRequestFromTemplate:(NSDictionary *)iosPushTemplate request:(UNNotificationRequest *)request {
UNMutableNotificationContent *content = [UNMutableNotificationContent new];
NSMutableDictionary *userInfo = [NSMutableDictionary new];
NSMutableDictionary *aps = [NSMutableDictionary new];
NSMutableDictionary *apsAlert = [NSMutableDictionary new];

// check if silent
NSNumber *contentAvailable = [iosPushTemplate valueForKey:@"contentAvailable"];
Expand All @@ -100,30 +102,55 @@ -(UNNotificationRequest *)createRequestFromTemplate:(NSDictionary *)iosPushTempl
else {
if ([request.content.userInfo valueForKey:@"message"]) {
content.body = [request.content.userInfo valueForKey:@"message"];
[apsAlert setObject:content.body forKey:@"body"];
}
else {
content.body = [[[request.content.userInfo valueForKey:@"aps"] valueForKey:@"alert"] valueForKey:@"body"];
[apsAlert setObject:content.body forKey:@"body"];
}

if ([request.content.userInfo valueForKey:@"ios-alert-title"]) {
content.title = [request.content.userInfo valueForKey:@"ios-alert-title"];
[apsAlert setObject:content.title forKey:@"title"];
}
else {
content.title = [iosPushTemplate valueForKey:@"alertTitle"];
[apsAlert setObject:content.title forKey:@"title"];
}

if ([request.content.userInfo valueForKey:@"ios-alert-subtitle"]) {
content.subtitle = [request.content.userInfo valueForKey:@"ios-alert-subtitle"];
[apsAlert setObject:content.subtitle forKey:@"subtitle"];
}
else {
content.subtitle = [iosPushTemplate valueForKey:@"alertSubtitle"];
[apsAlert setObject:content.subtitle forKey:@"subtitle"];
}
[aps setObject:apsAlert forKey:@"alert"];

if ([request.content.userInfo valueForKey:@"ios-alert-subtitle"]) {
content.subtitle = [request.content.userInfo valueForKey:@"ios-alert-subtitle"];
if ([iosPushTemplate valueForKey:@"sound"]) {
content.sound = [UNNotificationSound soundNamed:[iosPushTemplate valueForKey:@"sound"]];
[aps setObject:[iosPushTemplate valueForKey:@"sound"] forKey:@"sound"];
}
else {
content.subtitle = [iosPushTemplate valueForKey:@"alertSubtitle"];
content.sound = [UNNotificationSound defaultSound];
[aps setObject:@"default" forKey:@"sound"];
}

if (request.content.badge) {
content.badge = request.content.badge;
[aps setObject:content.badge forKey:@"badge"];
}
else {
NSNumber *badge = [iosPushTemplate valueForKey:@"badge"];
content.badge = badge;
[aps setObject:content.badge forKey:@"badge"];
}

[userInfo setObject:aps forKey:@"aps"];

if ([iosPushTemplate valueForKey:@"attachmentUrl"]) {
NSString *urlString = [iosPushTemplate valueForKey:@"attachmentUrl"];
[userInfo setObject:urlString forKey:@"attachment-url"];
}

if ([iosPushTemplate valueForKey:@"customHeaders"]) {
Expand All @@ -136,29 +163,20 @@ -(UNNotificationRequest *)createRequestFromTemplate:(NSDictionary *)iosPushTempl
[userInfo setObject:[customHeaders valueForKey:headerKey] forKey:headerKey];
}
}
content.userInfo = userInfo;
}

if (request.content.sound) {
content.sound = request.content.sound;
}
else {
content.sound = [UNNotificationSound defaultSound];
}

if (request.content.badge) {
content.badge = request.content.badge;
}
else {
NSNumber *badge = [iosPushTemplate valueForKey:@"badge"];
content.badge = badge;
if (@available(iOS 12.0, *)) {
if([iosPushTemplate valueForKey:@"threadId"]) {
content.threadIdentifier = [iosPushTemplate valueForKey:@"threadId"];
[userInfo setObject:content.threadIdentifier forKey:@"thread-id"];
}
if([iosPushTemplate valueForKey:@"summaryFormat"]) {
content.summaryArgument = [iosPushTemplate valueForKey:@"summaryFormat"];
[userInfo setObject:content.summaryArgument forKey:@"summary-arg"];
}
}

if ([iosPushTemplate valueForKey:@"attachmentUrl"]) {
NSString *urlString = [iosPushTemplate valueForKey:@"attachmentUrl"];
[userInfo setObject:urlString forKey:@"attachment-url"];
content.userInfo = userInfo;
}
content.userInfo = userInfo;

NSArray *actionsArray = [iosPushTemplate valueForKey:@"actions"];
content.categoryIdentifier = [self setActions:actionsArray];
Expand Down
Binary file modified SDK/ios/backendless/backendless.a
Binary file not shown.

0 comments on commit 5ca7699

Please sign in to comment.