Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: invisible buttons after changes in WireButton size parameters #2222

Merged
merged 6 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.extension.formatAsFingerPrint
import com.wire.android.util.extension.formatAsString
import com.wire.android.util.formatMediumDateTime
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.android.util.ui.UIText

@Composable
Expand Down Expand Up @@ -260,7 +261,8 @@ fun VerifyLabel(isVerified: Boolean, modifier: Modifier = Modifier) {
Text(
text = stringResource(id = if (isVerified) R.string.label_client_verified else R.string.label_client_unverified),
color = if (isVerified) MaterialTheme.wireColorScheme.primary else MaterialTheme.wireColorScheme.secondaryText,
style = MaterialTheme.wireTypography.label03.copy(textAlign = TextAlign.Center),
style = MaterialTheme.wireTypography.label03,
textAlign = TextAlign.Center,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier
Expand All @@ -283,3 +285,18 @@ fun PreviewDeviceItem() {
) {}
}
}

@PreviewMultipleThemes
@Composable
fun PreviewDeviceItemContent() {
DeviceItemContent(
device = Device(name = UIText.DynamicString("name")),
placeholder = false,
shouldShowVerifyLabel = true,
background = null,
isWholeItemClickable = false,
onRemoveDeviceClick = null,
leadingIcon = { Icon(painter = painterResource(id = R.drawable.ic_remove), contentDescription = "") },
leadingIconBorder = 1.dp,
)
}
10 changes: 10 additions & 0 deletions app/src/main/kotlin/com/wire/android/ui/common/AddContactButton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ import androidx.compose.ui.unit.dp
import com.wire.android.R
import com.wire.android.ui.common.button.IconAlignment
import com.wire.android.ui.common.button.WireSecondaryButton
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.wireDimensions
import com.wire.android.util.ui.PreviewMultipleThemes

@Composable
fun AddContactButton(
Expand All @@ -56,3 +58,11 @@ fun AddContactButton(
modifier = modifier
)
}

@PreviewMultipleThemes
@Composable
fun PreviewAddContactButton() {
WireTheme {
AddContactButton(onIconClicked = {})
}
}
17 changes: 14 additions & 3 deletions app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.wire.android.ui.common.button.WirePrimaryButton
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.home.conversationslist.common.FolderHeader
import com.wire.android.ui.home.settings.SettingsItem
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.ui.theme.wireDimensions
import com.wire.android.ui.theme.wireTypography
Expand Down Expand Up @@ -289,8 +290,8 @@ private fun ManualMigrationOptions(
},
actions = {
WirePrimaryButton(
minSize = MaterialTheme.wireDimensions.buttonMinSize,
minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize,
minSize = MaterialTheme.wireDimensions.buttonMediumMinSize,
minClickableSize = MaterialTheme.wireDimensions.buttonMediumMinClickableSize,
onClick = onManualMigrationClicked,
text = stringResource(R.string.start_manual_migration),
fillMaxWidth = false
Expand Down Expand Up @@ -425,7 +426,7 @@ private fun EnableEncryptedProteusStorageSwitch(
enabled = !isEnabled,
modifier = Modifier
.padding(end = dimensions().spacing8x)
.size(dimensions().buttonSmallMinSize)
.size(width = dimensions().buttonSmallMinSize.width, height = dimensions().buttonSmallMinSize.height)
)
}
)
Expand Down Expand Up @@ -454,3 +455,13 @@ fun PreviewOtherDebugOptions() {
onManualMigrationPressed = {}
)
}

@PreviewMultipleThemes
@Composable
fun PreviewDevelopmentApiVersioningOptions() {
WireTheme {
DevelopmentApiVersioningOptions(
onForceLatestDevelopmentApiChange = {}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -39,7 +37,10 @@ import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.util.CustomTabsHelper
import com.wire.android.util.EMPTY
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.android.util.ui.UIText
import com.wire.kalium.logic.data.user.UserId
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.persistentMapOf

@Composable
internal fun MessageSendFailureWarning(
Expand All @@ -54,7 +55,8 @@ internal fun MessageSendFailureWarning(
VerticalSpace.x4()
Text(
text = messageStatus.errorText.asString(),
style = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.error)
style = LocalTextStyle.current,
color = MaterialTheme.colorScheme.error
)
if (messageStatus is MessageFlowStatus.Failure.Send.Remotely) {
OfflineBackendsLearnMoreLink()
Expand Down Expand Up @@ -151,9 +153,6 @@ private fun MultiUserDeliveryFailure(
minClickableSize = dimensions().buttonSmallMinClickableSize,
shape = RoundedCornerShape(size = dimensions().corner12x),
contentPadding = PaddingValues(horizontal = dimensions().spacing12x, vertical = dimensions().spacing8x),
modifier = Modifier
.padding(top = dimensions().spacing4x)
.height(height = dimensions().spacing32x)
)
}
}
Expand Down Expand Up @@ -212,21 +211,22 @@ internal fun MessageDecryptionFailure(
VerticalSpace.x4()
Text(
text = decryptionStatus.errorText.asString(),
style = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.error)
style = LocalTextStyle.current,
color = MaterialTheme.colorScheme.error
)
Text(
modifier = Modifier
.clickable { CustomTabsHelper.launchUrl(context, learnMoreUrl) },
style = LocalTextStyle.current.copy(
color = MaterialTheme.wireColorScheme.onTertiaryButtonSelected,
textDecoration = TextDecoration.Underline
),
style = LocalTextStyle.current,
textDecoration = TextDecoration.Underline,
color = MaterialTheme.wireColorScheme.onTertiaryButtonSelected,
text = stringResource(R.string.label_learn_more)
)
VerticalSpace.x4()
Text(
text = stringResource(R.string.label_message_decryption_failure_informative_message),
style = LocalTextStyle.current.copy(color = MaterialTheme.colorScheme.error)
style = LocalTextStyle.current,
color = MaterialTheme.colorScheme.error
)
if (!decryptionStatus.isDecryptionResolved) {
Row {
Expand Down Expand Up @@ -293,3 +293,20 @@ fun PreviewMessageDecryptionFailure() {
MessageDecryptionFailure(mockHeader, MessageFlowStatus.Failure.Decryption(false)) { _, _ -> }
}
}

@PreviewMultipleThemes
@Composable
fun PreviewMultiUserDeliveryFailure() {
WireTheme {
MultiUserDeliveryFailure(
DeliveryStatusContent.PartialDelivery(
failedRecipients = persistentListOf(UIText.DynamicString("username")),
noClients = persistentMapOf(
"iOS" to listOf(UIText.DynamicString("ios")),
"Android" to listOf(UIText.DynamicString("android"))
),
),
LocalContext.current.resources
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ fun SystemMessageItem(
minClickableSize = dimensions().buttonSmallMinClickableSize,
shape = RoundedCornerShape(size = dimensions().corner12x),
contentPadding = PaddingValues(horizontal = dimensions().spacing12x, vertical = dimensions().spacing8x),
modifier = Modifier
.padding(top = dimensions().spacing4x)
.height(height = dimensions().spacing32x)
)
}
if (message.sendingFailed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ import com.wire.android.ui.common.colorsScheme
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.common.progress.WireCircularProgressIndicator
import com.wire.android.ui.common.spacers.HorizontalSpace
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.util.ui.PreviewMultipleThemes

@Composable
fun AudioMessage(
Expand Down Expand Up @@ -159,7 +161,8 @@ private fun SuccessfulAudioMessage(
} else {
Text(
text = audioDuration.formattedTimeLeft(),
style = MaterialTheme.typography.labelSmall.copy(color = MaterialTheme.wireColorScheme.secondaryText),
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.wireColorScheme.secondaryText,
maxLines = 1
)
}
Expand Down Expand Up @@ -249,3 +252,17 @@ private data class AudioDuration(val totalDurationInMs: AudioState.TotalTimeInMs
return UNKNOWN_DURATION_LABEL
}
}

@PreviewMultipleThemes
@Composable
private fun PreviewSuccessfulAudioMessage() {
WireTheme {
SuccessfulAudioMessage(
audioMediaPlayingState = AudioMediaPlayingState.Completed,
totalTimeInMs = AudioState.TotalTimeInMs.Known(10000),
currentPositionInMs = 5000,
onPlayButtonClick = {},
onSliderPositionChange = {}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ import com.wire.android.ui.common.dimensions
import com.wire.android.ui.common.progress.WireCircularProgressIndicator
import com.wire.android.ui.home.conversations.search.widget.SearchFailureBox
import com.wire.android.ui.home.newconversation.model.Contact
import com.wire.android.ui.theme.WireTheme
import com.wire.android.util.extension.folderWithElements
import com.wire.android.util.ui.PreviewMultipleThemes

private const val DEFAULT_SEARCH_RESULT_ITEM_SIZE = 4

Expand Down Expand Up @@ -364,3 +366,11 @@ private fun ShowButton(
}
}
}

@PreviewMultipleThemes
@Composable
fun PreviewShowButton() {
WireTheme {
ShowButton(isShownAll = false, onShowButtonClicked = {})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import com.wire.android.R
import com.wire.android.ui.common.button.WireSecondaryButton
Expand All @@ -54,8 +55,8 @@ fun MutedConversationBadge(onClick: () -> Unit) {
)
},
fillMaxWidth = false,
minSize = dimensions().badgeSmallMinSize,
minClickableSize = dimensions().badgeSmallMinClickableSize,
minSize = DpSize(width = dimensions().spacing24x, height = dimensions().spacing18x),
minClickableSize = DpSize(width = dimensions().spacing24x, height = dimensions().spacing18x),
shape = RoundedCornerShape(size = dimensions().spacing6x),
contentPadding = PaddingValues(0.dp),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ import com.wire.android.ui.common.spacers.VerticalSpace
import com.wire.android.ui.home.conversationslist.common.ConversationList
import com.wire.android.ui.home.conversationslist.model.ConversationFolder
import com.wire.android.ui.home.conversationslist.model.ConversationItem
import com.wire.android.ui.theme.WireTheme
import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.data.user.UserId
import kotlinx.collections.immutable.ImmutableMap
Expand Down Expand Up @@ -112,3 +114,11 @@ private fun EmptySearchResult(onNewConversationCLick: () -> Unit) {
)
}
}

@PreviewMultipleThemes
@Composable
fun PreviewEmptySearchResult() {
WireTheme {
EmptySearchResult(onNewConversationCLick = {})
}
}
Loading
Loading