diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt index 1d1f76e21b..3dc17718c6 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt @@ -373,7 +373,7 @@ abstract class VectorBaseActivity : AppCompatActivity(), Maver override fun onPause() { super.onPause() - screenEvent?.send(analyticsTracker) + screenEvent?.send(analyticsTracker, analyticsScreenName) Timber.i("onPause Activity ${javaClass.simpleName}") rageShake.stop() diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/Screen.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/Screen.kt index 52c2fc76fc..bf44dfd2f9 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/Screen.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/Screen.kt @@ -43,6 +43,11 @@ data class Screen( */ DeactivateAccount, + /** + * The form for the forgot password use case + */ + ForgotPassword, + /** * Legacy: The screen that shows information about a specific group. */ @@ -53,6 +58,11 @@ data class Screen( */ Home, + /** + * The screen that displays the login flow (when the user already has an account). + */ + Login, + /** * The screen that displays the user's breadcrumbs. */ @@ -73,11 +83,6 @@ data class Screen( */ MobileInviteFriends, - /** - * The screen that displays the login flow. - */ - MobileLogin, - /** * The People tab on mobile that lists all the DM rooms you have joined. */ @@ -123,6 +128,11 @@ data class Screen( */ MyGroups, + /** + * The screen that displays the registration flow (when the user wants to create an account) + */ + Register, + /** * The screen that displays the messages and events received in a room. */ @@ -208,35 +218,20 @@ data class Screen( */ WebE2ESetup, - /** - * ? - */ - WebForgotPassword, - /** * ? */ WebLoading, - /** - * ? - */ - WebLogin, - - /** - * ? - */ - WebRegister, - /** * ? */ WebSoftLogout, /** - * ? + * The splash screen. */ - WebWelcome, + Welcome, } override fun getName() = screenName.name diff --git a/vector/src/main/java/im/vector/app/features/analytics/screen/ScreenEvent.kt b/vector/src/main/java/im/vector/app/features/analytics/screen/ScreenEvent.kt index 50008ce543..8e0513f25a 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/screen/ScreenEvent.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/screen/ScreenEvent.kt @@ -30,7 +30,11 @@ class ScreenEvent(val screenName: Screen.ScreenName) { // Protection to avoid multiple sending private var isSent = false - fun send(analyticsTracker: AnalyticsTracker) { + /** + * @param screenNameOverride can be used to override the screen name passed in constructor parameter + */ + fun send(analyticsTracker: AnalyticsTracker, + screenNameOverride: Screen.ScreenName? = null) { if (isSent) { Timber.w("Event $screenName Already sent!") return @@ -38,7 +42,7 @@ class ScreenEvent(val screenName: Screen.ScreenName) { isSent = true analyticsTracker.screen( Screen( - screenName = screenName, + screenName = screenNameOverride ?: screenName, durationMs = (SystemClock.elapsedRealtime() - startTime).toInt() ) ) diff --git a/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt b/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt index df0ab4623e..f1bf8ab4a9 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginActivity.kt @@ -83,7 +83,7 @@ open class LoginActivity : VectorBaseActivity(), ToolbarCo override fun getCoordinatorLayout() = views.coordinatorLayout override fun initUiAndData() { - analyticsScreenName = Screen.ScreenName.MobileLogin + analyticsScreenName = Screen.ScreenName.Login if (isFirstCreation()) { addFirstFragment() @@ -203,6 +203,10 @@ open class LoginActivity : VectorBaseActivity(), ToolbarCo private fun updateWithState(loginViewState: LoginViewState) { if (loginViewState.isUserLogged()) { + if (loginViewState.signMode == SignMode.SignUp) { + // change the screen name + analyticsScreenName = Screen.ScreenName.Register + } val intent = HomeActivity.newIntent( this, accountCreation = loginViewState.signMode == SignMode.SignUp