Fixes an approve/reject dialog on web3 transactions on Android
This commit is contained in:
+9
-1
@@ -151,6 +151,7 @@ public class BraveWalletDAppsActivity extends BraveWalletBaseActivity
|
||||
finish();
|
||||
}
|
||||
});
|
||||
final AccountInfo[] accounts = accountInfosTemp;
|
||||
mPendingTxHelper.mSelectedPendingRequest.observe(this, transactionInfo -> {
|
||||
if (transactionInfo == null
|
||||
|| mPendingTxHelper.getPendingTransactions().size() == 0) {
|
||||
@@ -162,10 +163,17 @@ public class BraveWalletDAppsActivity extends BraveWalletBaseActivity
|
||||
// onNextTransaction implementation is done
|
||||
approveTxBottomSheetDialogFragment.dismiss();
|
||||
}
|
||||
String accountName = "";
|
||||
for (AccountInfo accountInfo : accounts) {
|
||||
if (accountInfo.address.equals(transactionInfo.fromAddress)) {
|
||||
accountName = accountInfo.name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
approveTxBottomSheetDialogFragment =
|
||||
ApproveTxBottomSheetDialogFragment.newInstance(
|
||||
mPendingTxHelper.getPendingTransactions(),
|
||||
transactionInfo, "", this);
|
||||
transactionInfo, accountName, this);
|
||||
approveTxBottomSheetDialogFragment.show(getSupportFragmentManager(),
|
||||
ApproveTxBottomSheetDialogFragment.TAG_FRAGMENT);
|
||||
mPendingTxHelper.mTransactionInfoLd.observe(this, transactionInfos -> {
|
||||
|
||||
+7
@@ -220,6 +220,7 @@ public class ApproveTxBottomSheetDialogFragment extends BottomSheetDialogFragmen
|
||||
assert blockchainRegistry != null;
|
||||
TokenUtils.getAllTokensFiltered(getBraveWalletService(), blockchainRegistry,
|
||||
chainId, TokenUtils.TokenType.ERC20, tokens -> {
|
||||
boolean foundToken = false;
|
||||
for (BlockchainToken token : tokens) {
|
||||
// Replace USDC and DAI contract addresses for Ropsten network
|
||||
token.contractAddress = Utils.getContractAddress(
|
||||
@@ -238,9 +239,15 @@ public class ApproveTxBottomSheetDialogFragment extends BottomSheetDialogFragmen
|
||||
.baseData.to.toLowerCase(
|
||||
Locale.getDefault()))) {
|
||||
fillAssetDependentControls(symbol, view, decimals);
|
||||
foundToken = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Most likely we have a native asset transfer on a custom EVM
|
||||
// compatible network
|
||||
if (!foundToken) {
|
||||
fillAssetDependentControls(mChainSymbol, view, mChainDecimals);
|
||||
}
|
||||
});
|
||||
} else if (mTxInfo.txType == TransactionType.ERC721_TRANSFER_FROM
|
||||
|| mTxInfo.txType == TransactionType.ERC721_SAFE_TRANSFER_FROM) {
|
||||
|
||||
Reference in New Issue
Block a user