Analytics: Track some screen (#4715)

This commit is contained in:
Benoit Marty 2021-12-15 16:59:05 +01:00 committed by Benoit Marty
parent db3353feb5
commit 54108b8f8d
3 changed files with 29 additions and 0 deletions

View file

@ -17,6 +17,7 @@
package im.vector.app.features.call.dialpad
import android.content.ClipboardManager
import android.content.Context
import android.content.res.ColorStateList
import android.os.Bundle
import android.telephony.PhoneNumberFormattingTextWatcher
@ -37,6 +38,10 @@ import androidx.fragment.app.Fragment
import com.android.dialer.dialpadview.DialpadView
import com.android.dialer.dialpadview.DigitsEditText
import im.vector.app.R
import im.vector.app.core.extensions.singletonEntryPoint
import im.vector.app.features.analytics.AnalyticsTracker
import im.vector.app.features.analytics.plan.Screen
import im.vector.app.features.analytics.screen.ScreenEvent
import im.vector.app.features.themes.ThemeUtils
class DialPadFragment : Fragment(), TextWatcher {
@ -53,6 +58,25 @@ class DialPadFragment : Fragment(), TextWatcher {
private var enableDelete = true
private var enableFabOk = true
private lateinit var analyticsTracker: AnalyticsTracker
override fun onAttach(context: Context) {
super.onAttach(context)
val singletonEntryPoint = context.singletonEntryPoint()
analyticsTracker = singletonEntryPoint.analyticsTracker()
}
private var screenEvent: ScreenEvent? = null
override fun onResume() {
super.onResume()
screenEvent = ScreenEvent(Screen.ScreenName.MobileDialpad)
}
override fun onPause() {
super.onPause()
screenEvent?.send(analyticsTracker)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,

View file

@ -24,6 +24,7 @@ import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.extensions.replaceFragment
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivityFilteredRoomsBinding
import im.vector.app.features.analytics.plan.Screen
import im.vector.app.features.home.RoomListDisplayMode
import im.vector.app.features.home.room.list.RoomListFragment
import im.vector.app.features.home.room.list.RoomListParams
@ -42,6 +43,7 @@ class FilteredRoomsActivity : VectorBaseActivity<ActivityFilteredRoomsBinding>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
analyticsScreenName = Screen.ScreenName.RoomFilter
configureToolbar(views.filteredRoomsToolbar)
if (isFirstCreation()) {
val params = RoomListParams(RoomListDisplayMode.FILTERED)

View file

@ -40,6 +40,7 @@ import im.vector.app.core.extensions.exhaustive
import im.vector.app.core.platform.ToolbarConfigurable
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivityLoginBinding
import im.vector.app.features.analytics.plan.Screen
import im.vector.app.features.home.HomeActivity
import im.vector.app.features.login.terms.LoginTermsFragment
import im.vector.app.features.login.terms.LoginTermsFragmentArgument
@ -82,6 +83,8 @@ open class LoginActivity : VectorBaseActivity<ActivityLoginBinding>(), ToolbarCo
override fun getCoordinatorLayout() = views.coordinatorLayout
override fun initUiAndData() {
analyticsScreenName = Screen.ScreenName.MobileLogin
if (isFirstCreation()) {
addFirstFragment()
}