Skip to content

Commit

Permalink
Track inline action events for notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
mkevins committed Feb 14, 2024
1 parent 781dd16 commit 70bb7ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.wordpress.android.BuildConfig
import org.wordpress.android.R
import org.wordpress.android.WordPress
import org.wordpress.android.analytics.AnalyticsTracker.Stat.APP_REVIEWS_EVENT_INCREMENTED_BY_CHECKING_NOTIFICATION
import org.wordpress.android.analytics.AnalyticsTracker.Stat.NOTIFICATIONS_INLINE_ACTION_TAPPED
import org.wordpress.android.databinding.NotificationsListFragmentPageBinding
import org.wordpress.android.datasets.NotificationsTable
import org.wordpress.android.fluxc.model.CommentStatus
Expand Down Expand Up @@ -62,6 +63,7 @@ import org.wordpress.android.util.AppLog.T
import org.wordpress.android.util.DisplayUtils
import org.wordpress.android.util.NetworkUtils
import org.wordpress.android.util.WPSwipeToRefreshHelper
import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
import org.wordpress.android.util.helpers.SwipeToRefreshHelper
import org.wordpress.android.widgets.AppRatingDialog.incrementInteractions
import javax.inject.Inject
Expand All @@ -83,6 +85,9 @@ class NotificationsListFragmentPage : ViewPagerFragment(R.layout.notifications_l
@Inject
lateinit var gcmMessageHandler: GCMMessageHandler

@Inject
lateinit var analyticsTrackerWrapper: AnalyticsTrackerWrapper

private val showNewUnseenNotificationsRunnable = Runnable {
if (isAdded) {
binding?.notificationsList?.addOnScrollListener(mOnScrollListener)
Expand Down Expand Up @@ -421,6 +426,9 @@ class NotificationsListFragmentPage : ViewPagerFragment(R.layout.notifications_l
}

private fun handleInlineActionEvent(actionEvent: InlineActionEvent) {
analyticsTrackerWrapper.track(NOTIFICATIONS_INLINE_ACTION_TAPPED, mapOf(
InlineActionEvent.KEY_INLINE_ACTION to actionEvent::class.simpleName
))
when (actionEvent) {
is SharePostButtonTapped -> actionEvent.notification.let { postNotification ->
context?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,9 @@ class NotificationsListViewModel @Inject constructor(

sealed class InlineActionEvent {
data class SharePostButtonTapped(val notification: PostNotification): InlineActionEvent()

companion object {
val KEY_INLINE_ACTION = "inline_action"
}
}
}

0 comments on commit 70bb7ba

Please sign in to comment.