@@ -37,10 +37,12 @@ import to.bitkit.ext.rawId
3737import to.bitkit.ext.timestamp
3838import to.bitkit.ext.totalValue
3939import to.bitkit.ext.txType
40+ import to.bitkit.models.FeeRate
4041import to.bitkit.models.PrimaryDisplay
4142import to.bitkit.models.formatToModernDisplay
4243import to.bitkit.ui.LocalCurrencies
4344import to.bitkit.ui.activityListViewModel
45+ import to.bitkit.ui.blocktankViewModel
4446import to.bitkit.ui.components.BodyMSB
4547import to.bitkit.ui.components.CaptionB
4648import to.bitkit.ui.currencyViewModel
@@ -62,6 +64,11 @@ fun ActivityRow(
6264 onClick : (String ) -> Unit ,
6365 testTag : String ,
6466) {
67+ val blocktankInfo by blocktankViewModel?.info?.collectAsStateWithLifecycle() ? : remember {
68+ mutableStateOf(null )
69+ }
70+ val feeRates = blocktankInfo?.onchain?.feeRates
71+
6572 val status: PaymentState ? = when (item) {
6673 is Activity .Lightning -> item.v1.status
6774 is Activity .Onchain -> null
@@ -121,24 +128,26 @@ fun ActivityRow(
121128 isTransfer && isSent -> if (item.v1.confirmed) {
122129 stringResource(R .string.wallet__activity_transfer_spending_done)
123130 } else {
131+ val duration = FeeRate .getFeeDescription(item.v1.feeRate, feeRates)
124132 stringResource(R .string.wallet__activity_transfer_spending_pending)
125- .replace(" {duration}" , " 1h " ) // TODO: calculate confirmsIn text
133+ .replace(" {duration}" , duration.removeEstimationSymbol())
126134 }
127135
128136 isTransfer && ! isSent -> if (item.v1.confirmed) {
129137 stringResource(R .string.wallet__activity_transfer_savings_done)
130138 } else {
139+ val duration = FeeRate .getFeeDescription(item.v1.feeRate, feeRates)
131140 stringResource(R .string.wallet__activity_transfer_savings_pending)
132- .replace(" {duration}" , " 1h " ) // TODO: calculate confirmsIn text
141+ .replace(" {duration}" , duration.removeEstimationSymbol())
133142 }
134143
135144 confirmed == true -> formattedTime(timestamp)
136145
137146 else -> {
138- // TODO: calculate confirmsIn text
147+ val feeDescription = FeeRate .getFeeDescription(item.v1.feeRate, feeRates)
139148 stringResource(R .string.wallet__activity_confirms_in).replace(
140149 " {feeRateDescription}" ,
141- " ± 1h "
150+ feeDescription
142151 )
143152 }
144153 }
@@ -314,6 +323,10 @@ private fun formattedTime(timestamp: ULong): String {
314323 }
315324}
316325
326+ // TODO remove this method after transifex update
327+ private fun String.removeEstimationSymbol () = this .replace(" ±" , " " )
328+
329+
317330private class ActivityItemsPreviewProvider : PreviewParameterProvider <Activity > {
318331 override val values: Sequence <Activity > get() = previewActivityItems.asSequence()
319332}
0 commit comments