-
Notifications
You must be signed in to change notification settings - Fork 171
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: improve observe tx bugfixes #1340
Conversation
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should ensure support for the latest Android Studio
override val wrappers = listOf(wrapper) | ||
|
||
override fun tryInclude(tx: Transaction): Pair<Boolean, TransactionWrapper?> { | ||
if (wrapper.isComplete) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If 5 CrowdNode signup transactions are found, not need to check for more
android:singleLine="true" | ||
android:ellipsize="end" | ||
android:text="John Doe" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some UI bugs in the tx confirmation dialog when contacts are involved
fun wrapTransactions( | ||
transactions: Set<Transaction?>, | ||
vararg wrapperFactories: TransactionWrapperFactory | ||
): Collection<TransactionWrapper> { | ||
wrapperFactories.sortByDescending { it.maxTransactions } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoinJoin wrappers will have a much higher hit rate for including transactions, so checking them first
} | ||
added = true | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If one wrapper has tx included, no need to check more
log.info("NMA-243: Exception thrown obtaining Locale information: ", e) | ||
if (selectedCurrencyCode == null) { | ||
setDefaultCurrency() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a separate utility class
contacts.data?.forEach { result -> | ||
contactsByIdentity[result.dashPayProfile.userId] = result.dashPayProfile | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetching contacts/metadata in parallel
tx.txId == txInGroup.txId | ||
} != null | ||
val items = _transactions.value!!.toMutableMap() | ||
val txByHash = this.txByHash.toMutableMap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping exposed fields unmutable and creating mutable collections when modifying should help to avoid concurrent modification errors
override fun onItemClicked(view: View, usernameSearchResult: UsernameSearchResult) { | ||
handleString(usernameSearchResult.fromContactRequest!!.userId) | ||
handleContactId(usernameSearchResult.fromContactRequest!!.userId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes an error with payment to a contact from send
tab
@@ -130,7 +130,7 @@ class TransactionDetailsDialogFragment : OffsetDialogFragment(R.layout.transacti | |||
private fun initiateTransactionBinder(tx: Transaction, dashPayProfile: DashPayProfile?) { | |||
contentBinding = TransactionResultContentBinding.bind(binding.transactionResultContainer) | |||
transactionResultViewBinder.bind(tx, dashPayProfile) | |||
contentBinding.viewOnExplorer.setOnClickListener { viewOnBlockExplorer() } | |||
contentBinding.openExplorerCard.setOnClickListener { viewOnBlockExplorer() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes "explorer" row not being properly clickable
@@ -51,7 +52,8 @@ open class CrowdNodeBlockchainApi @Inject constructor( | |||
|
|||
suspend fun topUpAddress(accountAddress: Address, amount: Coin, emptyWallet: Boolean = false): Transaction { | |||
val topUpTx = paymentService.sendCoins(accountAddress, amount, null, emptyWallet) | |||
return walletData.observeTransactions(true, LockedTransaction(topUpTx.txId)).first() | |||
topUpTx.waitToMatchFilters(LockedTransaction()) | |||
return topUpTx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat different pattern here: if we already have a transaction, observe itself. If we don't observe the wallet.
The rest of CoinJoin transactions don't need this because we're waiting for response and not for them to become locked.
Issue being fixed or feature implemented
Some improvements to bugfix-observe-tx PR, see comments
Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist: