mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Rename CreateRoomParamsBuilder to CreateRoomParams for clarity
This commit is contained in:
parent
ded8acc836
commit
e097bd8117
12 changed files with 28 additions and 28 deletions
|
@ -29,7 +29,7 @@ Translations 🗣:
|
|||
-
|
||||
|
||||
SDK API changes ⚠️:
|
||||
- CreateRoomParams has been replaced by CreateRoomParamsBuilder
|
||||
- CreateRoomParams has been updated
|
||||
|
||||
Build 🧱:
|
||||
- Upgrade some dependencies
|
||||
|
|
|
@ -32,7 +32,7 @@ import im.vector.matrix.android.api.session.pushers.Pusher
|
|||
import im.vector.matrix.android.api.session.room.RoomSummaryQueryParams
|
||||
import im.vector.matrix.android.api.session.room.members.ChangeMembershipState
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.api.session.sync.SyncState
|
||||
import im.vector.matrix.android.api.session.user.model.User
|
||||
import im.vector.matrix.android.api.session.widgets.model.Widget
|
||||
|
@ -110,7 +110,7 @@ class RxSession(private val session: Session) {
|
|||
.startWithCallable { session.getThreePids() }
|
||||
}
|
||||
|
||||
fun createRoom(roomParams: CreateRoomParamsBuilder): Single<String> = singleBuilder {
|
||||
fun createRoom(roomParams: CreateRoomParams): Single<String> = singleBuilder {
|
||||
session.createRoom(roomParams, it)
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import im.vector.matrix.android.api.session.events.model.toContent
|
|||
import im.vector.matrix.android.api.session.room.Room
|
||||
import im.vector.matrix.android.api.session.room.model.Membership
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.api.session.room.roomSummaryQueryParams
|
||||
import im.vector.matrix.android.api.session.room.timeline.Timeline
|
||||
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
|
||||
|
@ -65,7 +65,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
|
|||
val aliceSession = mTestHelper.createAccount(TestConstants.USER_ALICE, defaultSessionParams)
|
||||
|
||||
val roomId = mTestHelper.doSync<String> {
|
||||
aliceSession.createRoom(CreateRoomParamsBuilder().apply { name = "MyRoom" }, it)
|
||||
aliceSession.createRoom(CreateRoomParams().apply { name = "MyRoom" }, it)
|
||||
}
|
||||
|
||||
if (encryptedRoom) {
|
||||
|
@ -286,7 +286,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
|
|||
fun createDM(alice: Session, bob: Session): String {
|
||||
val roomId = mTestHelper.doSync<String> {
|
||||
alice.createRoom(
|
||||
CreateRoomParamsBuilder().apply {
|
||||
CreateRoomParams().apply {
|
||||
invitedUserIds.add(bob.myUserId)
|
||||
setDirectMessage()
|
||||
enableEncryptionIfInvitedUsersSupportIt = true
|
||||
|
|
|
@ -27,7 +27,7 @@ import im.vector.matrix.android.api.session.crypto.verification.VerificationTran
|
|||
import im.vector.matrix.android.api.session.crypto.verification.VerificationTxState
|
||||
import im.vector.matrix.android.api.session.events.model.toModel
|
||||
import im.vector.matrix.android.api.session.room.model.RoomDirectoryVisibility
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.common.CommonTestHelper
|
||||
import im.vector.matrix.android.common.CryptoTestHelper
|
||||
import im.vector.matrix.android.common.SessionTestParams
|
||||
|
@ -66,7 +66,7 @@ class KeyShareTests : InstrumentedTest {
|
|||
// Create an encrypted room and add a message
|
||||
val roomId = mTestHelper.doSync<String> {
|
||||
aliceSession.createRoom(
|
||||
CreateRoomParamsBuilder().apply {
|
||||
CreateRoomParams().apply {
|
||||
visibility = RoomDirectoryVisibility.PRIVATE
|
||||
enableEncryption()
|
||||
},
|
||||
|
|
|
@ -20,7 +20,7 @@ import androidx.lifecycle.LiveData
|
|||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.session.room.members.ChangeMembershipState
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.api.util.Cancelable
|
||||
import im.vector.matrix.android.api.util.Optional
|
||||
|
||||
|
@ -32,7 +32,7 @@ interface RoomService {
|
|||
/**
|
||||
* Create a room asynchronously
|
||||
*/
|
||||
fun createRoom(createRoomParams: CreateRoomParamsBuilder,
|
||||
fun createRoom(createRoomParams: CreateRoomParams,
|
||||
callback: MatrixCallback<String>): Cancelable
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ import im.vector.matrix.android.api.session.room.model.RoomDirectoryVisibility
|
|||
import im.vector.matrix.android.api.session.room.model.RoomHistoryVisibility
|
||||
import im.vector.matrix.android.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||
|
||||
class CreateRoomParamsBuilder {
|
||||
class CreateRoomParams {
|
||||
var visibility: RoomDirectoryVisibility? = null
|
||||
var roomAliasName: String? = null
|
||||
var name: String? = null
|
|
@ -23,7 +23,7 @@ import im.vector.matrix.android.api.session.room.RoomService
|
|||
import im.vector.matrix.android.api.session.room.RoomSummaryQueryParams
|
||||
import im.vector.matrix.android.api.session.room.members.ChangeMembershipState
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.api.util.Cancelable
|
||||
import im.vector.matrix.android.api.util.Optional
|
||||
import im.vector.matrix.android.internal.session.room.alias.GetRoomIdByAliasTask
|
||||
|
@ -49,7 +49,7 @@ internal class DefaultRoomService @Inject constructor(
|
|||
private val taskExecutor: TaskExecutor
|
||||
) : RoomService {
|
||||
|
||||
override fun createRoom(createRoomParams: CreateRoomParamsBuilder, callback: MatrixCallback<String>): Cancelable {
|
||||
override fun createRoom(createRoomParams: CreateRoomParams, callback: MatrixCallback<String>): Cancelable {
|
||||
return createRoomTask
|
||||
.configureWith(createRoomParams) {
|
||||
this.callback = callback
|
||||
|
|
|
@ -22,7 +22,7 @@ import im.vector.matrix.android.api.session.events.model.EventType
|
|||
import im.vector.matrix.android.api.session.events.model.toContent
|
||||
import im.vector.matrix.android.api.session.identity.IdentityServiceError
|
||||
import im.vector.matrix.android.api.session.identity.toMedium
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.internal.crypto.DeviceListManager
|
||||
import im.vector.matrix.android.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM
|
||||
import im.vector.matrix.android.internal.di.AuthenticatedIdentity
|
||||
|
@ -43,7 +43,7 @@ internal class CreateRoomParamsInternalBuilder @Inject constructor(
|
|||
private val accessTokenProvider: AccessTokenProvider
|
||||
) {
|
||||
|
||||
suspend fun build(builder: CreateRoomParamsBuilder): CreateRoomBody {
|
||||
suspend fun build(builder: CreateRoomParams): CreateRoomBody {
|
||||
val invite3pids = builder.invite3pids
|
||||
.takeIf { it.isNotEmpty() }
|
||||
.let {
|
||||
|
@ -85,7 +85,7 @@ internal class CreateRoomParamsInternalBuilder @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private fun buildHistoryVisibilityEvent(builder: CreateRoomParamsBuilder): Event? {
|
||||
private fun buildHistoryVisibilityEvent(builder: CreateRoomParams): Event? {
|
||||
return builder.historyVisibility
|
||||
?.let {
|
||||
val contentMap = mapOf("history_visibility" to it)
|
||||
|
@ -100,7 +100,7 @@ internal class CreateRoomParamsInternalBuilder @Inject constructor(
|
|||
/**
|
||||
* Add the crypto algorithm to the room creation parameters.
|
||||
*/
|
||||
private suspend fun buildEncryptionWithAlgorithmEvent(builder: CreateRoomParamsBuilder): Event? {
|
||||
private suspend fun buildEncryptionWithAlgorithmEvent(builder: CreateRoomParams): Event? {
|
||||
if (builder.algorithm == null
|
||||
&& canEnableEncryption(builder)) {
|
||||
// Enable the encryption
|
||||
|
@ -121,7 +121,7 @@ internal class CreateRoomParamsInternalBuilder @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun canEnableEncryption(builder: CreateRoomParamsBuilder): Boolean {
|
||||
private suspend fun canEnableEncryption(builder: CreateRoomParams): Boolean {
|
||||
return (builder.enableEncryptionIfInvitedUsersSupportIt
|
||||
&& crossSigningService.isCrossSigningVerified()
|
||||
&& builder.invite3pids.isEmpty())
|
||||
|
|
|
@ -18,7 +18,7 @@ package im.vector.matrix.android.internal.session.room.create
|
|||
|
||||
import com.zhuinden.monarchy.Monarchy
|
||||
import im.vector.matrix.android.api.session.room.failure.CreateRoomFailure
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.internal.database.awaitNotEmptyResult
|
||||
import im.vector.matrix.android.internal.database.model.RoomEntity
|
||||
import im.vector.matrix.android.internal.database.model.RoomEntityFields
|
||||
|
@ -38,7 +38,7 @@ import org.greenrobot.eventbus.EventBus
|
|||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
internal interface CreateRoomTask : Task<CreateRoomParamsBuilder, String>
|
||||
internal interface CreateRoomTask : Task<CreateRoomParams, String>
|
||||
|
||||
internal class DefaultCreateRoomTask @Inject constructor(
|
||||
private val roomAPI: RoomAPI,
|
||||
|
@ -52,7 +52,7 @@ internal class DefaultCreateRoomTask @Inject constructor(
|
|||
private val eventBus: EventBus
|
||||
) : CreateRoomTask {
|
||||
|
||||
override suspend fun execute(params: CreateRoomParamsBuilder): String {
|
||||
override suspend fun execute(params: CreateRoomParams): String {
|
||||
val createRoomParams = createRoomParamsInternalBuilder.build(params)
|
||||
|
||||
val createRoomResponse = executeRequest<CreateRoomResponse>(eventBus) {
|
||||
|
@ -75,7 +75,7 @@ internal class DefaultCreateRoomTask @Inject constructor(
|
|||
return roomId
|
||||
}
|
||||
|
||||
private suspend fun handleDirectChatCreation(params: CreateRoomParamsBuilder, roomId: String) {
|
||||
private suspend fun handleDirectChatCreation(params: CreateRoomParams, roomId: String) {
|
||||
val otherUserId = params.getFirstInvitedUserId()
|
||||
?: throw IllegalStateException("You can't create a direct room without an invitedUser")
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.airbnb.mvrx.ViewModelContext
|
|||
import com.squareup.inject.assisted.Assisted
|
||||
import com.squareup.inject.assisted.AssistedInject
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.rx.rx
|
||||
import im.vector.riotx.core.extensions.exhaustive
|
||||
import im.vector.riotx.core.platform.VectorViewModel
|
||||
|
@ -54,7 +54,7 @@ class CreateDirectRoomViewModel @AssistedInject constructor(@Assisted
|
|||
}
|
||||
|
||||
private fun createRoomAndInviteSelectedUsers(invitees: Set<PendingInvitee>) {
|
||||
val roomParams = CreateRoomParamsBuilder()
|
||||
val roomParams = CreateRoomParams()
|
||||
.apply {
|
||||
invitees.forEach {
|
||||
when (it) {
|
||||
|
|
|
@ -43,7 +43,7 @@ import im.vector.matrix.android.api.session.crypto.verification.VerificationServ
|
|||
import im.vector.matrix.android.api.session.crypto.verification.VerificationTransaction
|
||||
import im.vector.matrix.android.api.session.crypto.verification.VerificationTxState
|
||||
import im.vector.matrix.android.api.session.events.model.LocalEcho
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.api.util.MatrixItem
|
||||
import im.vector.matrix.android.api.util.toMatrixItem
|
||||
import im.vector.matrix.android.internal.crypto.crosssigning.fromBase64
|
||||
|
@ -235,7 +235,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
pendingRequest = Loading()
|
||||
)
|
||||
}
|
||||
val roomParams = CreateRoomParamsBuilder()
|
||||
val roomParams = CreateRoomParams()
|
||||
.apply {
|
||||
invitedUserIds.add(otherUserId)
|
||||
setDirectMessage()
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.squareup.inject.assisted.AssistedInject
|
|||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.matrix.android.api.session.room.model.RoomDirectoryVisibility
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParamsBuilder
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
|
||||
import im.vector.matrix.android.api.session.room.model.create.CreateRoomPreset
|
||||
import im.vector.riotx.core.platform.EmptyViewEvents
|
||||
import im.vector.riotx.core.platform.VectorViewModel
|
||||
|
@ -84,7 +84,7 @@ class CreateRoomViewModel @AssistedInject constructor(@Assisted initialState: Cr
|
|||
copy(asyncCreateRoomRequest = Loading())
|
||||
}
|
||||
|
||||
val createRoomParams = CreateRoomParamsBuilder()
|
||||
val createRoomParams = CreateRoomParams()
|
||||
.apply {
|
||||
name = state.roomName.takeIf { it.isNotBlank() }
|
||||
// Directory visibility
|
||||
|
|
Loading…
Reference in a new issue