Analytics: Send the Event `CreatedRoom()` (#4716)
This commit is contained in:
parent
7a6f3cbcf7
commit
3e125bcccf
|
@ -30,6 +30,8 @@ import im.vector.app.core.di.MavericksAssistedViewModelFactory
|
|||
import im.vector.app.core.di.hiltMavericksViewModelFactory
|
||||
import im.vector.app.core.extensions.exhaustive
|
||||
import im.vector.app.core.platform.VectorViewModel
|
||||
import im.vector.app.features.analytics.AnalyticsTracker
|
||||
import im.vector.app.features.analytics.plan.CreatedRoom
|
||||
import im.vector.app.features.raw.wellknown.getElementWellknown
|
||||
import im.vector.app.features.raw.wellknown.isE2EByDefault
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -52,10 +54,12 @@ import org.matrix.android.sdk.api.session.room.model.create.CreateRoomPreset
|
|||
import org.matrix.android.sdk.api.session.room.model.create.RestrictedRoomPreset
|
||||
import timber.log.Timber
|
||||
|
||||
class CreateRoomViewModel @AssistedInject constructor(@Assisted private val initialState: CreateRoomViewState,
|
||||
private val session: Session,
|
||||
private val rawService: RawService,
|
||||
appStateHandler: AppStateHandler
|
||||
class CreateRoomViewModel @AssistedInject constructor(
|
||||
@Assisted private val initialState: CreateRoomViewState,
|
||||
private val session: Session,
|
||||
private val rawService: RawService,
|
||||
appStateHandler: AppStateHandler,
|
||||
private val analyticsTracker: AnalyticsTracker
|
||||
) : VectorViewModel<CreateRoomViewState, CreateRoomAction, CreateRoomViewEvents>(initialState) {
|
||||
|
||||
@AssistedFactory
|
||||
|
@ -296,7 +300,7 @@ class CreateRoomViewModel @AssistedInject constructor(@Assisted private val init
|
|||
viewModelScope.launch {
|
||||
runCatching { session.createRoom(createRoomParams) }.fold(
|
||||
{ roomId ->
|
||||
|
||||
analyticsTracker.capture(CreatedRoom(isDM = createRoomParams.isDirect.orFalse()))
|
||||
if (state.parentSpaceId != null) {
|
||||
// add it as a child
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue