diff --git a/mParticle-Apple-SDK/AppNotifications/MPAppNotificationHandler.mm b/mParticle-Apple-SDK/AppNotifications/MPAppNotificationHandler.mm index c8113813..34fda3b3 100644 --- a/mParticle-Apple-SDK/AppNotifications/MPAppNotificationHandler.mm +++ b/mParticle-Apple-SDK/AppNotifications/MPAppNotificationHandler.mm @@ -184,7 +184,7 @@ - (void) didReceiveRemoteNotification:(NSDictionary *)userInfo { event:nil parameters:queueParameters messageType:MPMessageTypePushNotification - userInfo:nil + userInfo:userInfo ]; }); } @@ -227,7 +227,17 @@ - (void)userNotificationCenter:(nonnull UNUserNotificationCenter *)center willPr for (id kitRegister in activeKitsRegistry) { if ([kitRegister.wrapperInstance respondsToSelector:userNotificationCenterWillPresentNotification]) { - [kitRegister.wrapperInstance userNotificationCenter:center willPresentNotification:notification]; + MPKitExecStatus *execStatus = [kitRegister.wrapperInstance userNotificationCenter:center willPresentNotification:notification]; + + if (execStatus.success) { + MPForwardRecord *forwardRecord = [[MPForwardRecord alloc] initWithMessageType:MPMessageTypePushNotification execStatus:execStatus]; + + dispatch_async([MParticle messageQueue], ^{ + [[MParticle sharedInstance].persistenceController saveForwardRecord:forwardRecord]; + }); + + MPILogDebug(@"Forwarded user notifications call to kit: %@", kitRegister.name); + } } } }); @@ -255,14 +265,13 @@ - (void)userNotificationCenter:(nonnull UNUserNotificationCenter *)center didRec MPKitExecStatus *execStatus = [kitRegister.wrapperInstance userNotificationCenter:center didReceiveNotificationResponse:response]; if (execStatus.success) { - - MPForwardRecord *forwardRecord = [[MPForwardRecord alloc] initWithMessageType:MPMessageTypePushNotification execStatus:execStatus]; + MPForwardRecord *forwardRecord = [[MPForwardRecord alloc] initWithMessageType:MPMessageTypePushNotificationInteraction execStatus:execStatus]; dispatch_async([MParticle messageQueue], ^{ [[MParticle sharedInstance].persistenceController saveForwardRecord:forwardRecord]; }); - MPILogDebug(@"Forwarded user notifications call to kit: %@", kitRegister.name); + MPILogDebug(@"Forwarded user notifications response call to kit: %@", kitRegister.name); } } } diff --git a/mParticle-Apple-SDK/MPEnums.m b/mParticle-Apple-SDK/MPEnums.m index 2f438b85..f9312ad7 100644 --- a/mParticle-Apple-SDK/MPEnums.m +++ b/mParticle-Apple-SDK/MPEnums.m @@ -74,6 +74,8 @@ + (MPMessageType)messageTypeFromNSString:(NSString *)messageTypeString { return MPMessageTypeBreadcrumb; } else if ([messageTypeString isEqualToString:kMPMessageTypeStringProfile]) { return MPMessageTypeProfile; + } else if ([messageTypeString isEqualToString:kMPMessageTypeStringPushNotification]) { + return MPMessageTypePushNotification; } else if ([messageTypeString isEqualToString:kMPMessageTypeStringPushNotificationInteraction]) { return MPMessageTypePushNotificationInteraction; } else if ([messageTypeString isEqualToString:kMPMessageTypeStringCommerceEvent]) {