Closed Anush-Shand closed 2 months ago
The null check solution will work. However I think it would be better to leave the action
in inAppNotificationActionTriggered
as @NonNull
and instead create a close action if it is null in CTInAppBaseFragment
(since the click actions in the fragment always dismiss the in-app). This looks more semantically correct, since it would be strange to call the method inAppNotificationActionTriggered
with null
action and the method will still execute some logic (create a bundle and send notification clicked event). Here is an example of the alternate solution:
CTInAppBaseFragment
private Bundle didClick(CTInAppNotificationButton button) {
CTInAppAction action = button.getAction();
if (action == null) {
action = CTInAppAction.createCloseAction();
}
return notifyActionTriggered(action, button.getText(), null);
}
CTInAppAction
@JvmStatic
fun createCloseAction(): CTInAppAction {
return CTInAppAction(null).apply {
type = CLOSE
}
}
…on half interstitial