Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications add tracks events for inline actions #20182

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
antonis marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ public enum Stat {
SITE_MONITORING_TAB_LOADING_ERROR,
NOTIFICATION_MENU_TAPPED,
NOTIFICATIONS_MARK_ALL_READ_TAPPED,
NOTIFICATIONS_INLINE_ACTION_TAPPED,
WEBVIEW_TOO_LARGE_PAYLOAD_ERROR,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,8 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) {
return "notification_menu_tapped";
case NOTIFICATIONS_MARK_ALL_READ_TAPPED:
return "notifications_mark_all_read_tapped";
case NOTIFICATIONS_INLINE_ACTION_TAPPED:
return "notifications_inline_action_tapped";
case WEBVIEW_TOO_LARGE_PAYLOAD_ERROR:
return "webview_too_large_payload_error";
}
Expand Down
Loading