Merge pull request #1860 from Electric-Coin-Company/feature/bugfixes
2.0.1 bugfixes
This commit is contained in:
commit
a5b06c41e8
|
@ -6,6 +6,10 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Homepage buttons now display correctly on small screen devices
|
||||
- Scan navigates back to zip 321 when insufficient funds detected
|
||||
|
||||
## [2.0.0 (934)] - 2025-04-25
|
||||
|
||||
### Added:
|
||||
|
|
|
@ -27,6 +27,7 @@ import androidx.compose.ui.input.pointer.changedToUp
|
|||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import co.electriccoin.zcash.ui.design.R
|
||||
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
|
||||
|
@ -91,21 +92,25 @@ fun ZashiBigIconButton(
|
|||
shadowElevation = shadowElevation
|
||||
) {
|
||||
Column(
|
||||
modifier = backgroundModifier.padding(16.dp),
|
||||
modifier = backgroundModifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Image(
|
||||
modifier = Modifier.padding(start = 16.dp, top = 16.dp, end = 16.dp),
|
||||
painter = painterResource(state.icon),
|
||||
contentDescription = state.text.getValue(),
|
||||
colorFilter = ColorFilter.tint(ZashiColors.Text.textPrimary)
|
||||
)
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text(
|
||||
modifier = Modifier.padding(bottom = 16.dp),
|
||||
text = state.text.getValue(),
|
||||
style = ZashiTypography.textXs,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = ZashiColors.Text.textPrimary
|
||||
color = ZashiColors.Text.textPrimary,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Clip
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package co.electriccoin.zcash.ui.common.usecase
|
|||
|
||||
import co.electriccoin.zcash.ui.NavigationRouter
|
||||
import co.electriccoin.zcash.ui.common.datasource.AccountDataSource
|
||||
import co.electriccoin.zcash.ui.common.datasource.TransactionProposalNotCreatedException
|
||||
import co.electriccoin.zcash.ui.common.model.KeystoneAccount
|
||||
import co.electriccoin.zcash.ui.common.model.ZashiAccount
|
||||
import co.electriccoin.zcash.ui.common.repository.KeystoneProposalRepository
|
||||
|
@ -77,6 +78,11 @@ class OnZip321ScannedUseCase(
|
|||
)
|
||||
)
|
||||
navigationRouter.replace(Send(), ReviewTransaction)
|
||||
} catch (_: TransactionProposalNotCreatedException) {
|
||||
prefillSend.requestFromZip321(zip321.payment)
|
||||
navigationRouter.replace(Send())
|
||||
zashiProposalRepository.clear()
|
||||
keystoneProposalRepository.clear()
|
||||
} catch (e: Exception) {
|
||||
navigateToErrorUseCase(ErrorArgs.General(e))
|
||||
zashiProposalRepository.clear()
|
||||
|
@ -113,6 +119,11 @@ class OnZip321ScannedUseCase(
|
|||
)
|
||||
)
|
||||
navigationRouter.forward(ReviewTransaction)
|
||||
} catch (_: TransactionProposalNotCreatedException) {
|
||||
prefillSend.requestFromZip321(zip321.payment)
|
||||
navigationRouter.back()
|
||||
zashiProposalRepository.clear()
|
||||
keystoneProposalRepository.clear()
|
||||
} catch (e: Exception) {
|
||||
navigateToErrorUseCase(ErrorArgs.General(e))
|
||||
zashiProposalRepository.clear()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package co.electriccoin.zcash.ui.common.usecase
|
||||
|
||||
import PaymentRequest
|
||||
import cash.z.ecc.android.sdk.ext.convertZecToZatoshi
|
||||
import cash.z.ecc.android.sdk.model.Zatoshi
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -15,7 +17,7 @@ class PrefillSendUseCase {
|
|||
|
||||
operator fun invoke() = bus.receiveAsFlow()
|
||||
|
||||
fun request(value: DetailedTransactionData) =
|
||||
fun requestFromTransactionDetail(value: DetailedTransactionData) =
|
||||
scope.launch {
|
||||
bus.send(
|
||||
PrefillSendData.All(
|
||||
|
@ -27,10 +29,20 @@ class PrefillSendUseCase {
|
|||
)
|
||||
}
|
||||
|
||||
fun request(value: PrefillSendData) =
|
||||
fun requestFromZip321(value: PaymentRequest) =
|
||||
scope.launch {
|
||||
bus.send(value)
|
||||
val request = value.payments.firstOrNull()
|
||||
bus.send(
|
||||
PrefillSendData.All(
|
||||
amount = request?.nonNegativeAmount?.value?.convertZecToZatoshi() ?: Zatoshi(0),
|
||||
address = request?.recipientAddress?.value,
|
||||
fee = null,
|
||||
memos = request?.message?.let { listOf(it) }
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun request(value: PrefillSendData) = scope.launch { bus.send(value) }
|
||||
}
|
||||
|
||||
sealed interface PrefillSendData {
|
||||
|
|
|
@ -8,7 +8,7 @@ class SendTransactionAgainUseCase(
|
|||
private val navigationRouter: NavigationRouter
|
||||
) {
|
||||
operator fun invoke(value: DetailedTransactionData) {
|
||||
prefillSendUseCase.request(value)
|
||||
prefillSendUseCase.requestFromTransactionDetail(value)
|
||||
navigationRouter.forward(
|
||||
Send(
|
||||
isScanZip321Enabled = false
|
||||
|
|
|
@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Column
|
|||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.offset
|
||||
|
@ -15,6 +14,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.layout
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.zIndex
|
||||
|
@ -128,7 +128,7 @@ private fun NavButtons(
|
|||
modifier =
|
||||
Modifier
|
||||
.weight(1f)
|
||||
.aspectRatio(1.06f)
|
||||
.minHeight106Percent()
|
||||
.testTag(HomeTags.RECEIVE),
|
||||
state = state.firstButton,
|
||||
)
|
||||
|
@ -136,27 +136,41 @@ private fun NavButtons(
|
|||
modifier =
|
||||
Modifier
|
||||
.weight(1f)
|
||||
.aspectRatio(1.06f)
|
||||
.minHeight106Percent()
|
||||
.testTag(HomeTags.SEND),
|
||||
state = state.secondButton,
|
||||
)
|
||||
ZashiBigIconButton(
|
||||
modifier =
|
||||
Modifier
|
||||
.aspectRatio(1.06f)
|
||||
.minHeight106Percent()
|
||||
.weight(1f),
|
||||
state = state.thirdButton,
|
||||
)
|
||||
ZashiBigIconButton(
|
||||
modifier =
|
||||
Modifier
|
||||
.aspectRatio(1.06f)
|
||||
.minHeight106Percent()
|
||||
.weight(1f),
|
||||
state = state.fourthButton,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
fun Modifier.minHeight106Percent(): Modifier =
|
||||
layout { measurable, constraints ->
|
||||
val placeable = measurable.measure(constraints)
|
||||
val minHeight = (placeable.width.toFloat() / (106f / 100f)).toInt()
|
||||
|
||||
val newConstraints = constraints.copy(minHeight = minHeight)
|
||||
val newPlaceable = measurable.measure(newConstraints)
|
||||
|
||||
layout(newPlaceable.width, newPlaceable.height) {
|
||||
newPlaceable.place(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
@PreviewScreens
|
||||
@Composable
|
||||
private fun Preview() {
|
||||
|
|
Loading…
Reference in New Issue