Skip to content

Commit

Permalink
Android: Moved UI updates when signing load hex transactions to onPos…
Browse files Browse the repository at this point in the history
…tExecute.
  • Loading branch information
Aldin-SXR committed Jun 6, 2021
1 parent bf71bbc commit d93715a
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -170,7 +170,7 @@ fun canBroadcast(tx: PyObject): Boolean {
/**
* Sign a loaded transaction dialog.
*/
class SignPasswordDialog : PasswordDialog<Unit>() {
class SignPasswordDialog : PasswordDialog<PyObject>() {
val coldLoadDialog by lazy { targetFragment as ColdLoadDialog }
// Schnorr signing is supported by standard and imported private key wallets.
val signSchnorr = daemonModel.walletType in listOf("standard", "imported_privkey")
Expand All @@ -179,18 +179,18 @@ class SignPasswordDialog : PasswordDialog<Unit>() {
Kwarg("sign_schnorr", signSchnorr)) }
val wallet = daemonModel.wallet!!

override fun onPassword(password: String) {
override fun onPassword(password: String): PyObject {
wallet.callAttr("sign_transaction", tx, password)

postToUiThread {
coldLoadDialog.etTransaction.setText(tx.toString())
}
return tx
}

override fun onPostExecute(result: Unit) {
if (!canBroadcast(tx)) {
override fun onPostExecute(result: PyObject) {
coldLoadDialog.etTransaction.setText(result.toString())

if (!canBroadcast(result)) {
coldLoadDialog.dismiss()
copyToClipboard(tx.toString(), R.string.signed_transaction)
copyToClipboard(result.toString(), R.string.signed_transaction)
}
}
}

0 comments on commit d93715a

Please sign in to comment.