Skip to content

Commit

Permalink
Implement in-app notification did show callback (#397)
Browse files Browse the repository at this point in the history
* Implement in-app notification did show callback

* Update changelog
  • Loading branch information
nzagorchev authored Jan 22, 2025
1 parent 83382c2 commit b6b9ab0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
- `getUserLastVisitTs()`: Get timestamp of user's last app visit
- `getUserAppLaunchCount()`: Get total number of times user has launched the app
- `getUserEventLogHistory()`: Get full event history for current user
- Adds `inAppNotificationDidShow:` to the `CleverTapInAppNotificationDelegate` delegate.

#### API Changes

Expand Down
9 changes: 9 additions & 0 deletions CleverTapSDK/CleverTapInAppNotificationDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,13 @@
@optional
- (void)inAppNotificationButtonTappedWithCustomExtras:(NSDictionary *)customExtras;

/*!
@discussion
This is called when an in-app notification is rendered.
@param notification The notification JSON object for this notification.
*/
@optional
- (void)inAppNotificationDidShow:(NSDictionary *)notification;

@end
7 changes: 7 additions & 0 deletions CleverTapSDK/InApps/CTInAppDisplayManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,12 @@ - (void)displayNotification:(CTInAppNotification*)notification {
#endif
}

- (void)notifyNotificationDidShow:(CTInAppNotification *)notification {
if (self.inAppNotificationDelegate && [self.inAppNotificationDelegate respondsToSelector:@selector(inAppNotificationDidShow:)]) {
[self.inAppNotificationDelegate inAppNotificationDidShow:notification.jsonDescription];
}
}

- (void)notifyNotificationDismissed:(CTInAppNotification *)notification {
if (self.inAppNotificationDelegate && [self.inAppNotificationDelegate respondsToSelector:@selector(inAppNotificationDismissedWithExtras:andActionExtras:)]) {
NSDictionary *extras;
Expand Down Expand Up @@ -589,6 +595,7 @@ - (void)notificationDidShow:(CTInAppNotification*)notification {
CleverTapLogInternal(self.config.logLevel, @"%@: InApp did show: %@", self, notification.campaignId);
[self.instance recordInAppNotificationStateEvent:NO forNotification:notification andQueryParameters:nil];
[self.inAppFCManager didShow:notification];
[self notifyNotificationDidShow:notification];
}

- (void)notifyNotificationButtonTappedWithCustomExtras:(NSDictionary *)customExtras {
Expand Down

0 comments on commit b6b9ab0

Please sign in to comment.