Skip to content

Commit 81a83e2

Browse files
authored
Merge pull request #943 from OneSignal/fix/images_not_displaying
Fix images not displaying with new NSE method
2 parents de698d3 + 41d4fe3 commit 81a83e2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

iOS_SDK/OneSignalSDK/Source/OneSignalNotificationServiceExtensionHandler.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ + (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotif
7373

7474
// Trigger the notification to be shown with the replacementContent
7575
if (contentHandler) {
76-
contentHandler(replacementContent);
7776
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
7877
[self onNotificationReceived:receivedNotificationId withBlockingTask:semaphore];
7978
// Download Media Attachments after kicking off the confirmed delivery task
8079
[OneSignalHelper addAttachments:notification toNotificationContent:replacementContent];
80+
contentHandler(replacementContent);
8181
dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, MAX_NSE_LIFETIME_SECOUNDS * NSEC_PER_SEC));
8282
} else {
8383
[self onNotificationReceived:receivedNotificationId withBlockingTask:nil];

iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1839,7 +1839,7 @@ - (void)testAddingSharedKeysIfMissing {
18391839
}
18401840

18411841
// iOS 10 - Notification Service Extension test - local file
1842-
- (void) testDidReceiveNotificationExtensionRequestLocalFile {
1842+
- (void)testDidReceiveNotificationExtensionRequestLocalFile {
18431843
id userInfo = @{@"aps": @{
18441844
@"mutable-content": @1,
18451845
@"alert": @"Message Body"
@@ -1910,6 +1910,9 @@ - (void) testServiceExtensionContentHandlerFired {
19101910
[contentExpectation fulfill];
19111911
// Make sure butons were added.
19121912
XCTAssertEqualObjects(content.categoryIdentifier, @"__onesignal__dynamic__b2f7f966-d8cc-11e4-bed1-df8f05be55ba");
1913+
// Make sure attachments were added.
1914+
XCTAssertEqualObjects(content.attachments[0].identifier, @"id");
1915+
XCTAssertEqualObjects(content.attachments[0].URL.scheme, @"file");
19131916
});
19141917
[self waitForExpectations:@[contentExpectation] timeout:1];
19151918
}

0 commit comments

Comments
 (0)