Transaction detail hotfix for pending transaction
This commit is contained in:
parent
739953de19
commit
0ea9c7ef51
|
@ -48,7 +48,8 @@ class SynchronizerProviderImpl(
|
|||
emit(synchronizer)
|
||||
}
|
||||
}
|
||||
}.flowOn(Dispatchers.IO)
|
||||
}
|
||||
.flowOn(Dispatchers.IO)
|
||||
.stateIn(
|
||||
scope = scope,
|
||||
started = SharingStarted.Lazily,
|
||||
|
|
|
@ -52,6 +52,7 @@ class BalanceWidgetViewModel(
|
|||
account == null -> null
|
||||
account.totalBalance == account.spendableShieldedBalance -> null
|
||||
account.totalBalance > account.spendableShieldedBalance &&
|
||||
account.spendableShieldedBalance == account.totalShieldedBalance &&
|
||||
account.totalTransparentBalance > Zatoshi(0) &&
|
||||
!account.isShieldingAvailable ->
|
||||
null
|
||||
|
|
|
@ -44,9 +44,9 @@ fun WalletRestoringMessage(
|
|||
Text(
|
||||
text =
|
||||
if (state.isSpendable) {
|
||||
stringResource(R.string.home_message_restoring_subtitle)
|
||||
} else {
|
||||
stringResource(R.string.home_message_restoring_subtitle_spendable)
|
||||
} else {
|
||||
stringResource(R.string.home_message_restoring_subtitle)
|
||||
},
|
||||
)
|
||||
},
|
||||
|
|
|
@ -33,7 +33,8 @@ object SendShieldStateFixture {
|
|||
TransactionDetailMemoState(content = stringRes("Short message"), onClick = {}),
|
||||
)
|
||||
),
|
||||
note = stringRes("None")
|
||||
note = stringRes("None"),
|
||||
isPending = false
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -49,7 +50,8 @@ object SendTransparentStateFixture {
|
|||
onTransactionAddressClick = {},
|
||||
fee = stringRes(Zatoshi(1011)),
|
||||
completedTimestamp = stringResByDateTime(ZonedDateTime.now(), true),
|
||||
note = stringRes("None")
|
||||
note = stringRes("None"),
|
||||
isPending = false
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -64,11 +66,12 @@ object ReceiveShieldedStateFixture {
|
|||
)
|
||||
)
|
||||
) = ReceiveShieldedState(
|
||||
memo = memo,
|
||||
transactionId = stringRes("Transaction ID"),
|
||||
onTransactionIdClick = {},
|
||||
completedTimestamp = stringResByDateTime(ZonedDateTime.now(), true),
|
||||
memo = memo,
|
||||
note = stringRes("None")
|
||||
note = stringRes("None"),
|
||||
isPending = false
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -79,7 +82,8 @@ object ReceiveTransparentStateFixture {
|
|||
transactionId = stringRes("Transaction ID"),
|
||||
onTransactionIdClick = {},
|
||||
completedTimestamp = stringResByDateTime(ZonedDateTime.now(), true),
|
||||
note = stringRes("None")
|
||||
note = stringRes("None"),
|
||||
isPending = false
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -91,6 +95,7 @@ object ShieldingStateFixture {
|
|||
onTransactionIdClick = {},
|
||||
completedTimestamp = stringResByDateTime(ZonedDateTime.now(), true),
|
||||
fee = stringRes(Zatoshi(1011)),
|
||||
note = stringRes("None")
|
||||
note = stringRes("None"),
|
||||
isPending = false
|
||||
)
|
||||
}
|
||||
|
|
|
@ -136,7 +136,8 @@ class TransactionDetailViewModel(
|
|||
onTransactionAddressClick = { onCopyToClipboard(transaction.recipientAddress.address) },
|
||||
fee = createFeeStringRes(transaction),
|
||||
completedTimestamp = createTimestampStringRes(transaction),
|
||||
note = transaction.metadata.note?.let { stringRes(it) }
|
||||
note = transaction.metadata.note?.let { stringRes(it) },
|
||||
isPending = isPending(transaction)
|
||||
)
|
||||
} else {
|
||||
SendShieldedState(
|
||||
|
@ -167,7 +168,8 @@ class TransactionDetailViewModel(
|
|||
}
|
||||
)
|
||||
},
|
||||
note = transaction.metadata.note?.let { stringRes(it) }
|
||||
note = transaction.metadata.note?.let { stringRes(it) },
|
||||
isPending = isPending(transaction)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +186,8 @@ class TransactionDetailViewModel(
|
|||
onCopyToClipboard(transaction.transaction.id.txIdString())
|
||||
},
|
||||
completedTimestamp = createTimestampStringRes(transaction),
|
||||
note = transaction.metadata.note?.let { stringRes(it) }
|
||||
note = transaction.metadata.note?.let { stringRes(it) },
|
||||
isPending = isPending(transaction)
|
||||
)
|
||||
} else {
|
||||
ReceiveShieldedState(
|
||||
|
@ -208,7 +211,8 @@ class TransactionDetailViewModel(
|
|||
}
|
||||
)
|
||||
},
|
||||
note = transaction.metadata.note?.let { stringRes(it) }
|
||||
note = transaction.metadata.note?.let { stringRes(it) },
|
||||
isPending = isPending(transaction)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +229,8 @@ class TransactionDetailViewModel(
|
|||
},
|
||||
completedTimestamp = createTimestampStringRes(transaction),
|
||||
fee = createFeeStringRes(transaction),
|
||||
note = transaction.metadata.note?.let { stringRes(it) }
|
||||
note = transaction.metadata.note?.let { stringRes(it) },
|
||||
isPending = isPending(transaction)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -264,6 +269,8 @@ class TransactionDetailViewModel(
|
|||
)
|
||||
} ?: stringRes(R.string.transaction_detail_pending)
|
||||
|
||||
private fun isPending(data: DetailedTransactionData) = data.transaction.timestamp == null
|
||||
|
||||
private fun onCopyToClipboard(text: String) {
|
||||
copyToClipboard(
|
||||
tag = "Clipboard",
|
||||
|
|
|
@ -68,7 +68,11 @@ fun ReceiveShielded(
|
|||
modifier = Modifier.fillMaxWidth(),
|
||||
state =
|
||||
TransactionDetailInfoRowState(
|
||||
title = stringRes(R.string.transaction_detail_info_transaction_completed),
|
||||
title = if (state.isPending) {
|
||||
stringRes(R.string.transaction_detail_info_transaction_status)
|
||||
} else {
|
||||
stringRes(R.string.transaction_detail_info_transaction_completed)
|
||||
},
|
||||
message = state.completedTimestamp,
|
||||
shape =
|
||||
if (state.note != null) {
|
||||
|
|
|
@ -54,7 +54,11 @@ fun ReceiveTransparent(
|
|||
modifier = Modifier.fillMaxWidth(),
|
||||
state =
|
||||
TransactionDetailInfoRowState(
|
||||
title = stringRes(R.string.transaction_detail_info_transaction_completed),
|
||||
title = if (state.isPending) {
|
||||
stringRes(R.string.transaction_detail_info_transaction_status)
|
||||
} else {
|
||||
stringRes(R.string.transaction_detail_info_transaction_completed)
|
||||
},
|
||||
message = state.completedTimestamp,
|
||||
shape =
|
||||
if (state.note != null) {
|
||||
|
|
|
@ -118,7 +118,11 @@ fun SendShielded(
|
|||
modifier = Modifier.fillMaxWidth(),
|
||||
state =
|
||||
TransactionDetailInfoRowState(
|
||||
title = stringRes(R.string.transaction_detail_info_transaction_completed),
|
||||
title = if (state.isPending) {
|
||||
stringRes(R.string.transaction_detail_info_transaction_status)
|
||||
} else {
|
||||
stringRes(R.string.transaction_detail_info_transaction_completed)
|
||||
},
|
||||
message = state.completedTimestamp,
|
||||
shape =
|
||||
if (state.note == null) {
|
||||
|
|
|
@ -115,7 +115,11 @@ fun SendTransparent(
|
|||
modifier = Modifier.fillMaxWidth(),
|
||||
state =
|
||||
TransactionDetailInfoRowState(
|
||||
title = stringRes(R.string.transaction_detail_info_transaction_completed),
|
||||
title = if (state.isPending) {
|
||||
stringRes(R.string.transaction_detail_info_transaction_status)
|
||||
} else {
|
||||
stringRes(R.string.transaction_detail_info_transaction_completed)
|
||||
},
|
||||
message = state.completedTimestamp,
|
||||
shape =
|
||||
if (state.note != null) {
|
||||
|
|
|
@ -54,7 +54,11 @@ fun Shielding(
|
|||
modifier = Modifier.fillMaxWidth(),
|
||||
state =
|
||||
TransactionDetailInfoRowState(
|
||||
title = stringRes(R.string.transaction_detail_info_transaction_completed),
|
||||
title = if (state.isPending) {
|
||||
stringRes(R.string.transaction_detail_info_transaction_status)
|
||||
} else {
|
||||
stringRes(R.string.transaction_detail_info_transaction_completed)
|
||||
},
|
||||
message = state.completedTimestamp,
|
||||
shape = TransactionDetailInfoShape.MIDDLE,
|
||||
)
|
||||
|
|
|
@ -16,7 +16,8 @@ data class SendShieldedState(
|
|||
val fee: StringResource,
|
||||
val completedTimestamp: StringResource,
|
||||
val memo: TransactionDetailMemosState?,
|
||||
val note: StringResource?
|
||||
val note: StringResource?,
|
||||
val isPending: Boolean
|
||||
) : TransactionDetailInfoState
|
||||
|
||||
@Immutable
|
||||
|
@ -29,7 +30,8 @@ data class SendTransparentState(
|
|||
val onTransactionAddressClick: () -> Unit,
|
||||
val fee: StringResource,
|
||||
val completedTimestamp: StringResource,
|
||||
val note: StringResource?
|
||||
val note: StringResource?,
|
||||
val isPending: Boolean
|
||||
) : TransactionDetailInfoState
|
||||
|
||||
@Immutable
|
||||
|
@ -38,7 +40,8 @@ data class ReceiveShieldedState(
|
|||
val transactionId: StringResource,
|
||||
val onTransactionIdClick: () -> Unit,
|
||||
val completedTimestamp: StringResource,
|
||||
val note: StringResource?
|
||||
val note: StringResource?,
|
||||
val isPending: Boolean
|
||||
) : TransactionDetailInfoState
|
||||
|
||||
@Immutable
|
||||
|
@ -46,7 +49,8 @@ data class ReceiveTransparentState(
|
|||
val transactionId: StringResource,
|
||||
val onTransactionIdClick: () -> Unit,
|
||||
val completedTimestamp: StringResource,
|
||||
val note: StringResource?
|
||||
val note: StringResource?,
|
||||
val isPending: Boolean
|
||||
) : TransactionDetailInfoState
|
||||
|
||||
@Immutable
|
||||
|
@ -55,7 +59,8 @@ data class ShieldingState(
|
|||
val onTransactionIdClick: () -> Unit,
|
||||
val completedTimestamp: StringResource,
|
||||
val fee: StringResource,
|
||||
val note: StringResource?
|
||||
val note: StringResource?,
|
||||
val isPending: Boolean
|
||||
) : TransactionDetailInfoState
|
||||
|
||||
@Immutable
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<string name="transaction_detail_info_transaction_details">Detalles de la Transacción</string>
|
||||
<string name="transaction_detail_info_transaction_id">ID de la Transacción</string>
|
||||
<string name="transaction_detail_info_transaction_completed">Completada</string>
|
||||
<string name="transaction_detail_info_transaction_status">Status</string>
|
||||
<string name="transaction_detail_info_transaction_fee">Tarifa</string>
|
||||
<string name="transaction_detail_info_address">Dirección</string>
|
||||
<string name="transaction_detail_info_sent_to">Enviado a</string>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<string name="transaction_detail_info_transaction_details">Transaction Details</string>
|
||||
<string name="transaction_detail_info_transaction_id">Transaction ID</string>
|
||||
<string name="transaction_detail_info_transaction_completed">Completed</string>
|
||||
<string name="transaction_detail_info_transaction_status">Status</string>
|
||||
<string name="transaction_detail_info_transaction_fee">Fee</string>
|
||||
<string name="transaction_detail_info_address">Address</string>
|
||||
<string name="transaction_detail_info_sent_to">Sent to</string>
|
||||
|
|
Loading…
Reference in New Issue