diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fb86c84..d5ebfa90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ -(void)sendEmails:(NSString *)templateName templateValues:(NSDictionary *)templateValues envelope:(id)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 diff --git a/Pods/Backendless.podspec b/Pods/Backendless.podspec index 80fe71f3..4edae594 100644 --- a/Pods/Backendless.podspec +++ b/Pods/Backendless.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |spec| spec.summary = 'Backendless is a Mobile Backend and API Services Platform' spec.description = 'Backendless is a development and a run-time platform. It helps software developers to create mobile and desktop applications while removing the need for server-side coding.' spec.source = { :git => 'https://github.com/Backendless/ios-SDK.git', :tag => '5.3.8' } - spec.swift_version = '4.2' + spec.swift_version = '5.0' spec.ios.deployment_target = '8.0' spec.osx.deployment_target = '10.10' diff --git a/SDK/Podfile.lock b/SDK/Podfile.lock index 0f679003..302aa0e5 100644 --- a/SDK/Podfile.lock +++ b/SDK/Podfile.lock @@ -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) @@ -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 diff --git a/SDK/backendlessAPI/Classes/Messaging/BackendlessPushHelper.m b/SDK/backendlessAPI/Classes/Messaging/BackendlessPushHelper.m index 8aa161a0..b4ebb756 100644 --- a/SDK/backendlessAPI/Classes/Messaging/BackendlessPushHelper.m +++ b/SDK/backendlessAPI/Classes/Messaging/BackendlessPushHelper.m @@ -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"]; @@ -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"]) { @@ -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]; diff --git a/SDK/ios/backendless/backendless.a b/SDK/ios/backendless/backendless.a index 477d64bf..22cf9e80 100644 Binary files a/SDK/ios/backendless/backendless.a and b/SDK/ios/backendless/backendless.a differ