Merge pull request #3307 from element-hq/feature/bma/cleanup
Cleanup and add unit test for DefaultPinnedMessagesBannerFormatter
This commit is contained in:
commit
6b528596ed
5 changed files with 825 additions and 29 deletions
|
|
@ -29,7 +29,7 @@ data class UserEventPermissions(
|
|||
) {
|
||||
companion object {
|
||||
val DEFAULT = UserEventPermissions(
|
||||
canRedactOwn = false,
|
||||
canRedactOwn = true,
|
||||
canRedactOther = false,
|
||||
canSendMessage = true,
|
||||
canSendReaction = true,
|
||||
|
|
|
|||
|
|
@ -71,16 +71,15 @@ fun PinnedMessagesBannerView(
|
|||
onViewAllClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Box(modifier = modifier) {
|
||||
when (state) {
|
||||
PinnedMessagesBannerState.Hidden -> Unit
|
||||
is PinnedMessagesBannerState.Visible -> {
|
||||
PinnedMessagesBannerRow(
|
||||
state = state,
|
||||
onClick = onClick,
|
||||
onViewAllClick = onViewAllClick,
|
||||
)
|
||||
}
|
||||
when (state) {
|
||||
PinnedMessagesBannerState.Hidden -> Unit
|
||||
is PinnedMessagesBannerState.Visible -> {
|
||||
PinnedMessagesBannerRow(
|
||||
state = state,
|
||||
onClick = onClick,
|
||||
onViewAllClick = onViewAllClick,
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -136,18 +135,17 @@ private fun ViewAllButton(
|
|||
onViewAllClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Box(modifier = modifier) {
|
||||
val text = if (state is PinnedMessagesBannerState.Loaded) {
|
||||
stringResource(id = CommonStrings.screen_room_pinned_banner_view_all_button_title)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
TextButton(
|
||||
text = text,
|
||||
showProgress = state is PinnedMessagesBannerState.Loading,
|
||||
onClick = onViewAllClick
|
||||
)
|
||||
val text = if (state is PinnedMessagesBannerState.Loaded) {
|
||||
stringResource(id = CommonStrings.screen_room_pinned_banner_view_all_button_title)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
TextButton(
|
||||
text = text,
|
||||
showProgress = state is PinnedMessagesBannerState.Loading,
|
||||
onClick = onViewAllClick,
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
|
||||
private fun Modifier.drawBorder(borderColor: Color): Modifier {
|
||||
|
|
|
|||
|
|
@ -431,10 +431,9 @@ class MessageComposerPresenterTest {
|
|||
}
|
||||
val fakeMatrixRoom = FakeMatrixRoom(
|
||||
liveTimeline = timeline,
|
||||
typingNoticeResult = { Result.success(Unit) }
|
||||
).apply {
|
||||
this.editMessageLambda = roomEditMessageLambda
|
||||
}
|
||||
typingNoticeResult = { Result.success(Unit) },
|
||||
editMessageLambda = roomEditMessageLambda,
|
||||
)
|
||||
val presenter = createPresenter(
|
||||
this,
|
||||
fakeMatrixRoom,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue