From 0f4deb70670a0417d5039a567ed27161f2ab16bb Mon Sep 17 00:00:00 2001 From: bmarty Date: Mon, 5 Sep 2022 00:03:36 +0000 Subject: [PATCH 1/7] Sync analytics plan --- .../features/analytics/plan/Interaction.kt | 51 +++++++++++++++++++ .../features/analytics/plan/MobileScreen.kt | 15 ++++++ .../features/analytics/plan/UserProperties.kt | 28 ++++++++++ .../app/features/analytics/plan/ViewRoom.kt | 5 ++ 4 files changed, 99 insertions(+) diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt index 6336faa74c..1df1b35439 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/Interaction.kt @@ -40,6 +40,46 @@ data class Interaction( ) : VectorAnalyticsEvent { enum class Name { + /** + * User tapped the All filter in the All Chats filter tab. + */ + MobileAllChatsFilterAll, + + /** + * User tapped the Favourites filter in the All Chats filter tab. + */ + MobileAllChatsFilterFavourites, + + /** + * User tapped the People filter in the All Chats filter tab. + */ + MobileAllChatsFilterPeople, + + /** + * User tapped the Unreads filter in the All Chats filter tab. + */ + MobileAllChatsFilterUnreads, + + /** + * User disabled filters from the all chats layout settings. + */ + MobileAllChatsFiltersDisabled, + + /** + * User enabled filters from the all chats layout settings. + */ + MobileAllChatsFiltersEnabled, + + /** + * User disabled recents from the all chats layout settings. + */ + MobileAllChatsRecentsDisabled, + + /** + * User enabled recents from the all chats layout settings. + */ + MobileAllChatsRecentsEnabled, + /** * User tapped on Add to Home button on Room Details screen. */ @@ -60,6 +100,11 @@ data class Interaction( */ MobileRoomThreadSummaryItem, + /** + * User validated the creation of a new space. + */ + MobileSpaceCreationValidated, + /** * User tapped on the filter button on ThreadList screen. */ @@ -81,6 +126,12 @@ data class Interaction( */ SpacePanelSwitchSpace, + /** + * User tapped an unselected sub space from the space list -> space + * switching should occur. + */ + SpacePanelSwitchSubSpace, + /** * User clicked the create room button in the add existing room to space * dialog in Element Web/Desktop. diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/MobileScreen.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/MobileScreen.kt index 3ce3dfb578..7ea41e2d78 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/MobileScreen.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/MobileScreen.kt @@ -43,6 +43,11 @@ data class MobileScreen( */ CreateRoom, + /** + * The screen shown to create a new space. + */ + CreateSpace, + /** * The confirmation screen shown before deactivating an account. */ @@ -78,6 +83,11 @@ data class MobileScreen( */ InviteFriends, + /** + * Room accessed via space bottom sheet list. + */ + Invites, + /** * The screen that displays the login flow (when the user already has an * account). @@ -261,6 +271,11 @@ data class MobileScreen( */ Sidebar, + /** + * Room accessed via space bottom sheet list. + */ + SpaceBottomSheet, + /** * Screen that displays the list of rooms and spaces of a space. */ diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/UserProperties.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/UserProperties.kt index 77be2456cd..d6fa918b8e 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/UserProperties.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/UserProperties.kt @@ -44,6 +44,10 @@ data class UserProperties( * Whether the user has the people space enabled. */ val webMetaSpacePeopleEnabled: Boolean? = null, + /** + * The active filter in the All Chats screen + */ + val allChatsActiveFilter: AllChatsActiveFilter? = null, /** * The selected messaging use case during the onboarding flow. */ @@ -80,6 +84,29 @@ data class UserProperties( WorkMessaging, } + enum class AllChatsActiveFilter { + + /** + * Filters are activated and All is selected + */ + All, + + /** + * Filters are activated and Favourites is selected + */ + Favourites, + + /** + * Filters are activated and People is selected + */ + People, + + /** + * Filters are activated and Unreads is selected + */ + Unreads, + } + fun getProperties(): Map? { return mutableMapOf().apply { webMetaSpaceFavouritesEnabled?.let { put("WebMetaSpaceFavouritesEnabled", it) } @@ -87,6 +114,7 @@ data class UserProperties( webMetaSpaceHomeEnabled?.let { put("WebMetaSpaceHomeEnabled", it) } webMetaSpaceOrphansEnabled?.let { put("WebMetaSpaceOrphansEnabled", it) } webMetaSpacePeopleEnabled?.let { put("WebMetaSpacePeopleEnabled", it) } + allChatsActiveFilter?.let { put("allChatsActiveFilter", it.name) } ftueUseCaseSelection?.let { put("ftueUseCaseSelection", it.name) } numFavouriteRooms?.let { put("numFavouriteRooms", it) } numSpaces?.let { put("numSpaces", it) } diff --git a/vector/src/main/java/im/vector/app/features/analytics/plan/ViewRoom.kt b/vector/src/main/java/im/vector/app/features/analytics/plan/ViewRoom.kt index f6a724304b..366979025a 100644 --- a/vector/src/main/java/im/vector/app/features/analytics/plan/ViewRoom.kt +++ b/vector/src/main/java/im/vector/app/features/analytics/plan/ViewRoom.kt @@ -110,6 +110,11 @@ data class ViewRoom( */ MobileSearchContactDetail, + /** + * Room accessed via space bottom sheet list. + */ + MobileSpaceBottomSheet, + /** * Room accessed via interacting with direct chat item in the space * contact detail screen. From 16fad63e49eb408a4ccf066341e5b9cd5745fc66 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 6 Sep 2022 15:15:59 +0200 Subject: [PATCH 2/7] Better to call setAppLayoutOnboardingShown when we are sure the Activity has been run. --- .../vector/app/features/home/HomeActivityViewModel.kt | 1 - .../room/list/home/release/ReleaseNotesActivity.kt | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt index dd54285fb5..123ad2d83e 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt @@ -123,7 +123,6 @@ class HomeActivityViewModel @AssistedInject constructor( if (state.authenticationDescription == null && vectorFeatures.isNewAppLayoutEnabled()) { releaseNotesPreferencesStore.appLayoutOnboardingShown.onEach { isAppLayoutOnboardingShown -> if (!isAppLayoutOnboardingShown) { - releaseNotesPreferencesStore.setAppLayoutOnboardingShown(true) _viewEvents.post(HomeActivityViewEvents.ShowReleaseNotes) } }.launchIn(viewModelScope) diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/home/release/ReleaseNotesActivity.kt b/vector/src/main/java/im/vector/app/features/home/room/list/home/release/ReleaseNotesActivity.kt index c5cc55d7bb..4d8cfc9f23 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/list/home/release/ReleaseNotesActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/list/home/release/ReleaseNotesActivity.kt @@ -16,17 +16,20 @@ package im.vector.app.features.home.room.list.home.release +import androidx.lifecycle.lifecycleScope import dagger.hilt.android.AndroidEntryPoint import im.vector.app.core.extensions.addFragment import im.vector.app.core.platform.ScreenOrientationLocker import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.databinding.ActivitySimpleBinding +import kotlinx.coroutines.launch import javax.inject.Inject @AndroidEntryPoint class ReleaseNotesActivity : VectorBaseActivity() { @Inject lateinit var orientationLocker: ScreenOrientationLocker + @Inject lateinit var releaseNotesPreferencesStore: ReleaseNotesPreferencesStore override fun getBinding() = ActivitySimpleBinding.inflate(layoutInflater) @@ -38,4 +41,11 @@ class ReleaseNotesActivity : VectorBaseActivity() { addFragment(views.simpleFragmentContainer, ReleaseNotesFragment::class.java) } } + + override fun onResume() { + super.onResume() + lifecycleScope.launch { + releaseNotesPreferencesStore.setAppLayoutOnboardingShown(true) + } + } } From 593a04ea25cce918b5a01f0987888d947fbe3960 Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Tue, 6 Sep 2022 15:41:30 +0200 Subject: [PATCH 3/7] Adds missing space list header --- .../src/main/res/values/strings.xml | 1 + .../features/spaces/NewSpaceListHeaderItem.kt | 27 +++++++++++++++++++ .../spaces/NewSpaceSummaryController.kt | 7 +++++ .../res/layout/item_new_space_list_header.xml | 16 +++++++++++ 4 files changed, 51 insertions(+) create mode 100644 vector/src/main/java/im/vector/app/features/spaces/NewSpaceListHeaderItem.kt create mode 100644 vector/src/main/res/layout/item_new_space_list_header.xml diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml index 8c2af01e52..cbd56dc7ea 100644 --- a/library/ui-strings/src/main/res/values/strings.xml +++ b/library/ui-strings/src/main/res/values/strings.xml @@ -139,6 +139,7 @@ All Chats Start Chat Create Room + Change Space Explore Rooms Expand %s children diff --git a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceListHeaderItem.kt b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceListHeaderItem.kt new file mode 100644 index 0000000000..33bc547faa --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceListHeaderItem.kt @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.spaces + +import com.airbnb.epoxy.EpoxyModelClass +import im.vector.app.R +import im.vector.app.core.epoxy.VectorEpoxyHolder +import im.vector.app.core.epoxy.VectorEpoxyModel + +@EpoxyModelClass +abstract class NewSpaceListHeaderItem : VectorEpoxyModel(R.layout.item_new_space_list_header) { + class Holder : VectorEpoxyHolder() +} diff --git a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt index 24c7e13271..5061eb4036 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/NewSpaceSummaryController.kt @@ -52,12 +52,19 @@ class NewSpaceSummaryController @Inject constructor( } private fun buildGroupModels(viewState: SpaceListViewState) = with(viewState) { + addHeaderItem() addHomeItem(selectedSpace == null, homeAggregateCount) addSpaces(spaces, selectedSpace, rootSpacesOrdered, expandedStates) addInvites(selectedSpace, rootSpacesOrdered, inviters) addCreateItem() } + private fun addHeaderItem() { + newSpaceListHeaderItem { + id("space_list_header") + } + } + private fun addHomeItem(selected: Boolean, homeCount: RoomAggregateNotificationCount) { val host = this newHomeSpaceSummaryItem { diff --git a/vector/src/main/res/layout/item_new_space_list_header.xml b/vector/src/main/res/layout/item_new_space_list_header.xml new file mode 100644 index 0000000000..2c52304249 --- /dev/null +++ b/vector/src/main/res/layout/item_new_space_list_header.xml @@ -0,0 +1,16 @@ + + From f54979ce131195c2ae81a79a4531c0a3c9a7f05f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 6 Sep 2022 15:50:48 +0200 Subject: [PATCH 4/7] Add some debug tools about ReleaseNotesActivity. - reset the show status - display this Activity --- .../settings/DebugPrivateSettingsFragment.kt | 12 ++++++++++- .../DebugPrivateSettingsViewActions.kt | 1 + .../settings/DebugPrivateSettingsViewModel.kt | 20 +++++++++++++++++- .../settings/DebugPrivateSettingsViewState.kt | 3 ++- .../fragment_debug_private_settings.xml | 21 +++++++++++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) diff --git a/vector/src/debug/java/im/vector/app/features/debug/settings/DebugPrivateSettingsFragment.kt b/vector/src/debug/java/im/vector/app/features/debug/settings/DebugPrivateSettingsFragment.kt index 38253fe7c2..be3d41e0e1 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/settings/DebugPrivateSettingsFragment.kt +++ b/vector/src/debug/java/im/vector/app/features/debug/settings/DebugPrivateSettingsFragment.kt @@ -16,6 +16,8 @@ package im.vector.app.features.debug.settings +import android.annotation.SuppressLint +import android.content.Intent import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -24,6 +26,7 @@ import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.databinding.FragmentDebugPrivateSettingsBinding +import im.vector.app.features.home.room.list.home.release.ReleaseNotesActivity class DebugPrivateSettingsFragment : VectorBaseFragment() { @@ -35,7 +38,6 @@ class DebugPrivateSettingsFragment : VectorBaseFragment viewModel.handle(DebugPrivateSettingsViewActions.SetForceLoginFallbackEnabled(isChecked)) } + views.releaseNotesActivityHasBeenDisplayedReset.setOnClickListener { + viewModel.handle(DebugPrivateSettingsViewActions.ResetReleaseNotesActivityHasBeenDisplayed) + } + views.showReleaseNotesActivity.setOnClickListener { + startActivity(Intent(requireActivity(), ReleaseNotesActivity::class.java)) + } } override fun invalidate() = withState(viewModel) { @@ -57,5 +65,7 @@ class DebugPrivateSettingsFragment : VectorBaseFragment(initialState) { @AssistedFactory @@ -43,6 +45,15 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor( init { observeVectorOverrides() + observeReleaseNotesPreferencesStore() + } + + private fun observeReleaseNotesPreferencesStore() { + releaseNotesPreferencesStore.appLayoutOnboardingShown.setOnEach { + copy( + releaseNotesActivityHasBeenDisplayed = it + ) + } } private fun observeVectorOverrides() { @@ -72,6 +83,13 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor( is DebugPrivateSettingsViewActions.SetForceLoginFallbackEnabled -> handleSetForceLoginFallbackEnabled(action) is SetDisplayNameCapabilityOverride -> handleSetDisplayNameCapabilityOverride(action) is SetAvatarCapabilityOverride -> handleSetAvatarCapabilityOverride(action) + DebugPrivateSettingsViewActions.ResetReleaseNotesActivityHasBeenDisplayed -> handleResetReleaseNotesActivityHasBeenDisplayed() + } + } + + private fun handleResetReleaseNotesActivityHasBeenDisplayed() { + viewModelScope.launch { + releaseNotesPreferencesStore.setAppLayoutOnboardingShown(false) } } diff --git a/vector/src/debug/java/im/vector/app/features/debug/settings/DebugPrivateSettingsViewState.kt b/vector/src/debug/java/im/vector/app/features/debug/settings/DebugPrivateSettingsViewState.kt index 749b11a744..a390c94942 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/settings/DebugPrivateSettingsViewState.kt +++ b/vector/src/debug/java/im/vector/app/features/debug/settings/DebugPrivateSettingsViewState.kt @@ -22,7 +22,8 @@ import im.vector.app.features.debug.settings.OverrideDropdownView.OverrideDropdo data class DebugPrivateSettingsViewState( val dialPadVisible: Boolean = false, val forceLoginFallback: Boolean = false, - val homeserverCapabilityOverrides: HomeserverCapabilityOverrides = HomeserverCapabilityOverrides() + val homeserverCapabilityOverrides: HomeserverCapabilityOverrides = HomeserverCapabilityOverrides(), + val releaseNotesActivityHasBeenDisplayed: Boolean = false, ) : MavericksState data class HomeserverCapabilityOverrides( diff --git a/vector/src/debug/res/layout/fragment_debug_private_settings.xml b/vector/src/debug/res/layout/fragment_debug_private_settings.xml index c42ad68dce..55824930bc 100644 --- a/vector/src/debug/res/layout/fragment_debug_private_settings.xml +++ b/vector/src/debug/res/layout/fragment_debug_private_settings.xml @@ -49,6 +49,27 @@ android:layout_marginEnd="16dp" android:layout_marginBottom="4dp" /> + + +