Send failure verified user : resolve ui and logic

This commit is contained in:
ganfra 2024-09-13 11:44:19 +02:00
parent 416810acca
commit ff368b4072
29 changed files with 1103 additions and 85 deletions

View file

@ -37,6 +37,7 @@ import io.element.android.libraries.designsystem.theme.temporaryColorBgSpecial
* @param resourceId the resource id of the icon to display, exclusive with [imageVector]
* @param imageVector the image vector of the icon to display, exclusive with [resourceId]
* @param tint the tint to apply to the icon
* @param backgroundTint the tint to apply to the icon background
*/
@Composable
fun RoundedIconAtom(
@ -44,13 +45,14 @@ fun RoundedIconAtom(
size: RoundedIconAtomSize = RoundedIconAtomSize.Large,
resourceId: Int? = null,
imageVector: ImageVector? = null,
tint: Color = MaterialTheme.colorScheme.secondary
tint: Color = MaterialTheme.colorScheme.secondary,
backgroundTint: Color = ElementTheme.colors.temporaryColorBgSpecial,
) {
Box(
modifier = modifier
.size(size.toContainerSize())
.background(
color = ElementTheme.colors.temporaryColorBgSpecial,
color = backgroundTint,
shape = RoundedCornerShape(size.toCornerSize())
)
) {

View file

@ -27,6 +27,7 @@ import io.element.android.libraries.designsystem.icons.CompoundDrawables
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.designsystem.theme.temporaryColorBgSpecial
/**
* IconTitleSubtitleMolecule is a molecule which displays an icon, a title and a subtitle.
@ -37,6 +38,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
* @param iconResourceId the resource id of the icon to display, exclusive with [iconImageVector]
* @param iconImageVector the image vector of the icon to display, exclusive with [iconResourceId]
* @param iconTint the tint to apply to the icon
* @param iconBackgroundTint the tint to apply to the icon background
*/
@Composable
fun IconTitleSubtitleMolecule(
@ -46,6 +48,7 @@ fun IconTitleSubtitleMolecule(
iconResourceId: Int? = null,
iconImageVector: ImageVector? = null,
iconTint: Color = MaterialTheme.colorScheme.primary,
iconBackgroundTint: Color = ElementTheme.colors.temporaryColorBgSpecial,
) {
Column(modifier) {
RoundedIconAtom(
@ -55,6 +58,7 @@ fun IconTitleSubtitleMolecule(
resourceId = iconResourceId,
imageVector = iconImageVector,
tint = iconTint,
backgroundTint = iconBackgroundTint,
)
Spacer(modifier = Modifier.height(16.dp))
Text(

View file

@ -80,11 +80,11 @@ fun ListItem(
/**
* A List Item component to be used in lists and menus with simple layouts, matching the Material 3 guidelines.
* @param headlineContent The main content of the list item, usually a text.
* @param colors The colors to use for the list item. You can use [ListItemDefaults.colors] to create this.
* @param modifier The modifier to be applied to the list item.
* @param supportingContent The content to be displayed below the headline content.
* @param leadingContent The content to be displayed before the headline content.
* @param trailingContent The content to be displayed after the headline content.
* @param colors The colors to use for the list item.
* @param enabled Whether the list item is enabled. When disabled, will change the color of the headline content and the leading content to use disabled tokens.
* @param onClick The callback to be called when the list item is clicked.
*/
@ -412,8 +412,8 @@ private object PreviewItems {
) {
ElementThemedPreview {
ListItem(
headlineContent = PreviewItems.headline(),
supportingContent = PreviewItems.text(),
headlineContent = headline(),
supportingContent = text(),
leadingContent = leadingContent,
trailingContent = trailingContent,
style = style,
@ -431,8 +431,8 @@ private object PreviewItems {
) {
ElementThemedPreview {
ListItem(
headlineContent = PreviewItems.headline(),
supportingContent = PreviewItems.textSingleLine(),
headlineContent = headline(),
supportingContent = textSingleLine(),
leadingContent = leadingContent,
trailingContent = trailingContent,
style = style,
@ -451,7 +451,7 @@ private object PreviewItems {
) {
ElementThemedPreview {
ListItem(
headlineContent = PreviewItems.headline(),
headlineContent = headline(),
leadingContent = leadingContent,
trailingContent = trailingContent,
enabled = enabled,

View file

@ -354,5 +354,4 @@ interface MatrixRoom : Closeable {
suspend fun withdrawVerificationAndResend(userIds: List<UserId>, transactionId: TransactionId): Result<Unit>
override fun close() = destroy()
}

View file

@ -647,10 +647,9 @@ class RustMatrixRoom(
override suspend fun ignoreDeviceTrustAndResend(devices: Map<UserId, List<DeviceId>>, transactionId: TransactionId) = runCatching {
innerRoom.ignoreDeviceTrustAndResend(
devices = devices
.entries.associate { entry ->
entry.key.value to entry.value.map { it.value }
},
devices = devices.entries.associate { entry ->
entry.key.value to entry.value.map { it.value }
},
transactionId = transactionId.value
)
}

View file

@ -80,7 +80,7 @@ class FakeMatrixRoom(
private var roomPermalinkResult: () -> Result<String> = { lambdaError() },
private var eventPermalinkResult: (EventId) -> Result<String> = { lambdaError() },
private val sendCallNotificationIfNeededResult: () -> Result<Unit> = { lambdaError() },
private val userDisplayNameResult: () -> Result<String?> = { lambdaError() },
private val userDisplayNameResult: (UserId) -> Result<String?> = { lambdaError() },
private val userAvatarUrlResult: () -> Result<String?> = { lambdaError() },
private val userRoleResult: () -> Result<RoomMember.Role> = { lambdaError() },
private val getUpdatedMemberResult: (UserId) -> Result<RoomMember> = { lambdaError() },
@ -137,7 +137,6 @@ class FakeMatrixRoom(
private val subscribeToSyncLambda: () -> Unit = { lambdaError() },
private val ignoreDeviceTrustAndResendResult: (Map<UserId, List<DeviceId>>, TransactionId) -> Result<Unit> = { _, _ -> lambdaError() },
private val withdrawVerificationAndResendResult: (List<UserId>, TransactionId) -> Result<Unit> = { _, _ -> lambdaError() },
) : MatrixRoom {
private val _roomInfoFlow: MutableSharedFlow<MatrixRoomInfo> = MutableSharedFlow(replay = 1)
override val roomInfoFlow: Flow<MatrixRoomInfo> = _roomInfoFlow
@ -203,7 +202,7 @@ class FakeMatrixRoom(
override fun destroy() = Unit
override suspend fun userDisplayName(userId: UserId): Result<String?> = simulateLongTask {
userDisplayNameResult()
userDisplayNameResult(userId)
}
override suspend fun userAvatarUrl(userId: UserId): Result<String?> = simulateLongTask {
@ -230,7 +229,7 @@ class FakeMatrixRoom(
return toggleReactionResult(emoji, uniqueId)
}
override suspend fun retrySendMessage(transactionId: TransactionId): Result<Unit> {
override suspend fun retrySendMessage(transactionId: TransactionId): Result<Unit> = simulateLongTask {
return retrySendMessageResult(transactionId)
}
@ -496,11 +495,11 @@ class FakeMatrixRoom(
return getWidgetDriverResult(widgetSettings)
}
override suspend fun ignoreDeviceTrustAndResend(devices: Map<UserId, List<DeviceId>>, transactionId: TransactionId): Result<Unit> {
override suspend fun ignoreDeviceTrustAndResend(devices: Map<UserId, List<DeviceId>>, transactionId: TransactionId): Result<Unit> = simulateLongTask {
return ignoreDeviceTrustAndResendResult(devices, transactionId)
}
override suspend fun withdrawVerificationAndResend(userIds: List<UserId>, transactionId: TransactionId): Result<Unit> {
override suspend fun withdrawVerificationAndResend(userIds: List<UserId>, transactionId: TransactionId): Result<Unit> = simulateLongTask {
return withdrawVerificationAndResendResult(userIds, transactionId)
}