Skip to content

Commit

Permalink
Add events
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarvis Lin committed Feb 6, 2024
1 parent 0c319da commit 778919c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import org.greenrobot.eventbus.EventBus
import org.wordpress.android.R
import org.wordpress.android.analytics.AnalyticsTracker
import org.wordpress.android.analytics.AnalyticsTracker.NOTIFICATIONS_SELECTED_FILTER
import org.wordpress.android.analytics.AnalyticsTracker.Stat.NOTIFICATIONS_MARK_ALL_READ_TAPPED
import org.wordpress.android.analytics.AnalyticsTracker.Stat.NOTIFICATION_MENU_TAPPED
import org.wordpress.android.analytics.AnalyticsTracker.Stat.NOTIFICATION_TAPPED_SEGMENTED_CONTROL
import org.wordpress.android.databinding.NotificationsListFragmentBinding
import org.wordpress.android.fluxc.store.AccountStore
Expand Down Expand Up @@ -64,6 +66,7 @@ import org.wordpress.android.util.PermissionUtils
import org.wordpress.android.util.WPPermissionUtils
import org.wordpress.android.util.WPPermissionUtils.NOTIFICATIONS_PERMISSION_REQUEST_CODE
import org.wordpress.android.util.WPUrlUtils
import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
import org.wordpress.android.util.extensions.setLiftOnScrollTargetViewIdAndRequestLayout
import org.wordpress.android.viewmodel.observeEvent
import javax.inject.Inject
Expand All @@ -79,6 +82,9 @@ class NotificationsListFragment : Fragment(R.layout.notifications_list_fragment)
@Inject
lateinit var uiHelpers: UiHelpers

@Inject
lateinit var analyticsTrackerWrapper: AnalyticsTrackerWrapper

private val viewModel: NotificationsListViewModel by viewModels()

private var shouldRefreshNotifications = false
Expand Down Expand Up @@ -284,6 +290,7 @@ class NotificationsListFragment : Fragment(R.layout.notifications_list_fragment)
val notificationActions = menu.findItem(R.id.notifications_actions)
notificationActions.isVisible = accountStore.hasAccessToken()
notificationActions.actionView?.setOnClickListener {
analyticsTrackerWrapper.track(NOTIFICATION_MENU_TAPPED)
showNotificationActionsPopup(it)
}
super.onPrepareOptionsMenu(menu)
Expand Down Expand Up @@ -320,6 +327,7 @@ class NotificationsListFragment : Fragment(R.layout.notifications_list_fragment)
* For marking the status of every notification as read
*/
private fun markAllAsRead() {
analyticsTrackerWrapper.track(NOTIFICATIONS_MARK_ALL_READ_TAPPED)
// TODO("not yet implemented")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,9 @@ public enum Stat {
SITE_MONITORING_SCREEN_SHOWN,
OPENED_SITE_MONITORING,
SITE_MONITORING_TAB_SHOWN,
SITE_MONITORING_TAB_LOADING_ERROR
SITE_MONITORING_TAB_LOADING_ERROR,
NOTIFICATION_MENU_TAPPED,
NOTIFICATIONS_MARK_ALL_READ_TAPPED
}

private static final List<Tracker> TRACKERS = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2703,6 +2703,10 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) {
return "site_monitoring_tab_shown";
case SITE_MONITORING_TAB_LOADING_ERROR:
return "site_monitoring_tab_loading_error";
case NOTIFICATION_MENU_TAPPED:
return "notification_menu_tapped";
case NOTIFICATIONS_MARK_ALL_READ_TAPPED:
return "notifications_mark_all_read_tapped";
}
return null;
}
Expand Down

0 comments on commit 778919c

Please sign in to comment.