Skip to content

Commit

Permalink
Merge branch 'bugfix-observe-tx' of https://github.com/dashevo/dash-w…
Browse files Browse the repository at this point in the history
…allet into bugfix-optimize-report
  • Loading branch information
HashEngineering committed Dec 20, 2024
2 parents 27bc4a8 + 3188687 commit 4671795
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ class CrowdNodeApiAggregator @Inject constructor(
* obtains the current CrowdNode fee on masternode rewards once per 24 hours
*/
private suspend fun refreshFees() {
val lastFeeRequest = 0;//config.get(CrowdNodeConfig.LAST_FEE_REQUEST)
val lastFeeRequest = config.get(CrowdNodeConfig.LAST_FEE_REQUEST)
if (lastFeeRequest == null || (lastFeeRequest + TimeUnit.DAYS.toMillis(1)) < System.currentTimeMillis()) {
val feeInfo = webApi.getFees(accountAddress)
log.info("crowdnode feeInfo: {}", feeInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ class TransactionResultViewModel @Inject constructor(
}
}

private suspend fun monitorTransactionMetadata(txId: Sha256Hash) {
withContext(Dispatchers.IO) {
private fun monitorTransactionMetadata(txId: Sha256Hash) {
// this might take some time, so let it run asynchronously
viewModelScope.launch(Dispatchers.IO) {
transactionMetadataProvider.importTransactionMetadata(txId)
transactionMetadataProvider.observeTransactionMetadata(txId).collect {
_transactionMetadata.value = it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ class TransactionDetailsDialogFragment : OffsetDialogFragment(R.layout.transacti
viewModel.init(txId)
viewModel.transaction.filterNotNull().observe(viewLifecycleOwner) { tx ->
// the transactionResultViewBinder.bind is called later
// if (tx == null) {
// // log.error("Transaction not found. TxId: {}", txId)
// return@observe
// }


viewModel.transactionIcon.observe(this) {
transactionResultViewBinder.setTransactionIcon(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import de.schildbach.wallet.util.WalletUtils
import de.schildbach.wallet_test.R
import de.schildbach.wallet_test.databinding.ActivitySuccessfulTransactionBinding
import de.schildbach.wallet_test.databinding.TransactionResultContentBinding
import kotlinx.coroutines.flow.filterNotNull
import org.bitcoinj.core.Sha256Hash
import org.bitcoinj.core.Transaction
import org.dash.wallet.common.services.analytics.AnalyticsConstants
Expand Down Expand Up @@ -151,27 +152,22 @@ class TransactionResultActivity : LockScreenActivity() {

viewModel.init(txId)

viewModel.transaction.observe(this) { tx ->
if (tx != null) {
transactionResultViewBinder.setTransactionIcon(R.drawable.check_animated)
contentBinding.openExplorerCard.setOnClickListener { viewOnExplorer(tx) }
contentBinding.taxCategoryLayout.setOnClickListener { viewOnTaxCategory() }
binding.transactionCloseBtn.setOnClickListener {
onTransactionDetailsDismiss()
}
contentBinding.reportIssueCard.setOnClickListener {
showReportIssue()
}

viewModel.transactionMetadata.observe(this) {
transactionResultViewBinder.setTransactionMetadata(it)
}
transactionResultViewBinder.setOnRescanTriggered { rescanBlockchain() }
} else {
log.error("Transaction not found. TxId: {}", txId)
finish()
return@observe
viewModel.transaction.filterNotNull().observe(this) { tx ->
transactionResultViewBinder.setTransactionIcon(R.drawable.check_animated)
contentBinding.openExplorerCard.setOnClickListener { viewOnExplorer(tx) }
contentBinding.taxCategoryLayout.setOnClickListener { viewOnTaxCategory() }
binding.transactionCloseBtn.setOnClickListener {
onTransactionDetailsDismiss()
}
contentBinding.reportIssueCard.setOnClickListener {
showReportIssue()
}

viewModel.transactionMetadata.observe(this) {
transactionResultViewBinder.setTransactionMetadata(it)
}
transactionResultViewBinder.setOnRescanTriggered { rescanBlockchain() }


viewModel.transactionMetadata.observe(this) {
transactionResultViewBinder.setTransactionMetadata(it)
Expand Down

0 comments on commit 4671795

Please sign in to comment.