change : knock message supporting text display number of characters
This commit is contained in:
parent
0fb5ffe3dc
commit
317188cdf1
4 changed files with 31 additions and 14 deletions
|
|
@ -48,8 +48,6 @@ import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.util.Optional
|
import java.util.Optional
|
||||||
|
|
||||||
private const val MAX_KNOCK_MESSAGE_LENGTH = 500
|
|
||||||
|
|
||||||
class JoinRoomPresenter @AssistedInject constructor(
|
class JoinRoomPresenter @AssistedInject constructor(
|
||||||
@Assisted private val roomId: RoomId,
|
@Assisted private val roomId: RoomId,
|
||||||
@Assisted private val roomIdOrAlias: RoomIdOrAlias,
|
@Assisted private val roomIdOrAlias: RoomIdOrAlias,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ import io.element.android.libraries.matrix.api.core.RoomIdOrAlias
|
||||||
import io.element.android.libraries.matrix.api.room.RoomType
|
import io.element.android.libraries.matrix.api.room.RoomType
|
||||||
import io.element.android.libraries.matrix.ui.model.InviteSender
|
import io.element.android.libraries.matrix.ui.model.InviteSender
|
||||||
|
|
||||||
|
internal const val MAX_KNOCK_MESSAGE_LENGTH = 500
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class JoinRoomState(
|
data class JoinRoomState(
|
||||||
val contentState: ContentState,
|
val contentState: ContentState,
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,6 @@ open class JoinRoomStateProvider : PreviewParameterProvider<JoinRoomState> {
|
||||||
aJoinRoomState(
|
aJoinRoomState(
|
||||||
contentState = aLoadedContentState(joinAuthorisationStatus = JoinAuthorisationStatus.CanJoin)
|
contentState = aLoadedContentState(joinAuthorisationStatus = JoinAuthorisationStatus.CanJoin)
|
||||||
),
|
),
|
||||||
aJoinRoomState(
|
|
||||||
contentState = aLoadedContentState(
|
|
||||||
joinAuthorisationStatus = JoinAuthorisationStatus.CanKnock,
|
|
||||||
topic = "lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt" +
|
|
||||||
" ut labore et dolore magna aliqua ut enim ad minim veniam quis nostrud exercitation ullamco" +
|
|
||||||
" laboris nisi ut aliquip ex ea commodo consequat duis aute irure dolor in reprehenderit in" +
|
|
||||||
" voluptate velit esse cillum dolore eu fugiat nulla pariatur excepteur sint occaecat cupidatat" +
|
|
||||||
" non proident sunt in culpa qui officia deserunt mollit anim id est laborum",
|
|
||||||
numberOfMembers = 888,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
aJoinRoomState(
|
aJoinRoomState(
|
||||||
contentState = aLoadedContentState(joinAuthorisationStatus = JoinAuthorisationStatus.IsInvited(null))
|
contentState = aLoadedContentState(joinAuthorisationStatus = JoinAuthorisationStatus.IsInvited(null))
|
||||||
),
|
),
|
||||||
|
|
@ -81,6 +70,29 @@ open class JoinRoomStateProvider : PreviewParameterProvider<JoinRoomState> {
|
||||||
isDm = true,
|
isDm = true,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
aJoinRoomState(
|
||||||
|
contentState = aLoadedContentState(
|
||||||
|
joinAuthorisationStatus = JoinAuthorisationStatus.CanKnock,
|
||||||
|
topic = "lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt" +
|
||||||
|
" ut labore et dolore magna aliqua ut enim ad minim veniam quis nostrud exercitation ullamco" +
|
||||||
|
" laboris nisi ut aliquip ex ea commodo consequat duis aute irure dolor in reprehenderit in" +
|
||||||
|
" voluptate velit esse cillum dolore eu fugiat nulla pariatur excepteur sint occaecat cupidatat" +
|
||||||
|
" non proident sunt in culpa qui officia deserunt mollit anim id est laborum",
|
||||||
|
numberOfMembers = 888,
|
||||||
|
)
|
||||||
|
),
|
||||||
|
aJoinRoomState(
|
||||||
|
knockMessage = "Let me in please!",
|
||||||
|
contentState = aLoadedContentState(
|
||||||
|
joinAuthorisationStatus = JoinAuthorisationStatus.CanKnock,
|
||||||
|
topic = "lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt" +
|
||||||
|
" ut labore et dolore magna aliqua ut enim ad minim veniam quis nostrud exercitation ullamco" +
|
||||||
|
" laboris nisi ut aliquip ex ea commodo consequat duis aute irure dolor in reprehenderit in" +
|
||||||
|
" voluptate velit esse cillum dolore eu fugiat nulla pariatur excepteur sint occaecat cupidatat" +
|
||||||
|
" non proident sunt in culpa qui officia deserunt mollit anim id est laborum",
|
||||||
|
numberOfMembers = 888,
|
||||||
|
)
|
||||||
|
),
|
||||||
aJoinRoomState(
|
aJoinRoomState(
|
||||||
contentState = aLoadedContentState(
|
contentState = aLoadedContentState(
|
||||||
name = "A knocked Room",
|
name = "A knocked Room",
|
||||||
|
|
|
||||||
|
|
@ -390,13 +390,18 @@ private fun DefaultLoadedContent(
|
||||||
)
|
)
|
||||||
} else if (contentState.joinAuthorisationStatus is JoinAuthorisationStatus.CanKnock) {
|
} else if (contentState.joinAuthorisationStatus is JoinAuthorisationStatus.CanKnock) {
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
|
val supportingText = if (knockMessage.isNotEmpty()) {
|
||||||
|
"${knockMessage.length}/$MAX_KNOCK_MESSAGE_LENGTH"
|
||||||
|
} else {
|
||||||
|
stringResource(R.string.screen_join_room_knock_message_description)
|
||||||
|
}
|
||||||
TextField(
|
TextField(
|
||||||
value = knockMessage,
|
value = knockMessage,
|
||||||
onValueChange = onKnockMessageUpdate,
|
onValueChange = onKnockMessageUpdate,
|
||||||
maxLines = 3,
|
maxLines = 3,
|
||||||
minLines = 3,
|
minLines = 3,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
supportingText = stringResource(R.string.screen_join_room_knock_message_description)
|
supportingText = supportingText
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue