CleverTap / clevertap-android-sdk

CleverTap Android SDK
MIT License
80 stars 74 forks source link

docs(SDK-4028) - Fixes PushPrimer issue when allow button is clicked … #658

Closed Anush-Shand closed 2 months ago

Anush-Shand commented 2 months ago

…on half interstitial

vasct commented 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
            }
        }