mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 02:15:35 +03:00
Start DM on first message when selecting "direct message" from the room member details
This commit is contained in:
parent
0dcab56e34
commit
519855445e
3 changed files with 11 additions and 4 deletions
1
changelog.d/5525.wip
Normal file
1
changelog.d/5525.wip
Normal file
|
@ -0,0 +1 @@
|
|||
Create DM room only on first message - Trigger the flow when the "Direct Message" action is selected from the room member details screen
|
|
@ -132,10 +132,10 @@ class CreateDirectRoomViewModel @AssistedInject constructor(
|
|||
if (vectorFeatures.shouldStartDmOnFirstMessage()) {
|
||||
session.roomService().createLocalRoom(roomParams)
|
||||
} else {
|
||||
analyticsTracker.capture(CreatedRoom(isDM = roomParams.isDirect.orFalse()))
|
||||
session.roomService().createRoom(roomParams)
|
||||
}
|
||||
}
|
||||
analyticsTracker.capture(CreatedRoom(isDM = roomParams.isDirect.orFalse()))
|
||||
|
||||
setState {
|
||||
copy(
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package im.vector.app.features.createdirect
|
||||
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.features.analytics.AnalyticsTracker
|
||||
import im.vector.app.features.analytics.plan.CreatedRoom
|
||||
import im.vector.app.features.raw.wellknown.getElementWellknown
|
||||
|
@ -30,7 +31,8 @@ import javax.inject.Inject
|
|||
class DirectRoomHelper @Inject constructor(
|
||||
private val rawService: RawService,
|
||||
private val session: Session,
|
||||
private val analyticsTracker: AnalyticsTracker
|
||||
private val analyticsTracker: AnalyticsTracker,
|
||||
private val vectorFeatures: VectorFeatures,
|
||||
) {
|
||||
|
||||
suspend fun ensureDMExists(userId: String): String {
|
||||
|
@ -48,8 +50,12 @@ class DirectRoomHelper @Inject constructor(
|
|||
setDirectMessage()
|
||||
enableEncryptionIfInvitedUsersSupportIt = adminE2EByDefault
|
||||
}
|
||||
roomId = session.roomService().createRoom(roomParams)
|
||||
analyticsTracker.capture(CreatedRoom(isDM = roomParams.isDirect.orFalse()))
|
||||
roomId = if (vectorFeatures.shouldStartDmOnFirstMessage()) {
|
||||
session.roomService().createLocalRoom(roomParams)
|
||||
} else {
|
||||
analyticsTracker.capture(CreatedRoom(isDM = roomParams.isDirect.orFalse()))
|
||||
session.roomService().createRoom(roomParams)
|
||||
}
|
||||
}
|
||||
return roomId
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue