Skip to content

Commit

Permalink
fix(wallet): Show correct balance and asset (uplift to 1.50.x) (#17554)
Browse files Browse the repository at this point in the history
Uplift of #17540 (squashed) to beta
  • Loading branch information
Pavneet Singh authored Mar 14, 2023
1 parent f6705f3 commit 405af88
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ public NetworkModel(JsonRpcService jsonRpcService, CryptoSharedData sharedData,
Triple.create(networkInfo.chainId, networkInfo, _mCryptoNetworks.getValue()));
});
_mChainNetworkAllNetwork.addSource(_mCryptoNetworks, networkInfos -> {
_mChainNetworkAllNetwork.postValue(
Triple.create(_mChainId.getValue(), _mDefaultNetwork.getValue(), networkInfos));
String chainId = _mChainId.getValue();
NetworkInfo networkInfo = _mDefaultNetwork.getValue();
if (networkInfo != null) {
chainId = networkInfo.chainId;
}
_mChainNetworkAllNetwork.postValue(Triple.create(chainId, networkInfo, networkInfos));
});
_mCustomNetworkIds.addSource(mSharedData.getCoinTypeLd(), coinType -> {
mJsonRpcService.getCustomNetworks(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright (c) 2021 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
* You can obtain one at https://mozilla.org/MPL/2.0/. */

package org.chromium.chrome.browser.crypto_wallet.activities;

Expand Down Expand Up @@ -231,11 +231,10 @@ public void onClick(View v) {
TabUtils.openLinkWithFocus(this, WalletConstants.URL_RAINBOW_AURORA);
}
});
} else {
mBtnSwap.setOnClickListener(v
-> Utils.openBuySendSwapActivity(AssetDetailActivity.this,
BuySendSwapActivity.ActivityType.SWAP, mAssetSymbol));
}
mBtnSwap.setOnClickListener(v
-> Utils.openBuySendSwapActivity(AssetDetailActivity.this,
BuySendSwapActivity.ActivityType.SWAP, mAssetSymbol));

adjustButtonsVisibilities();

Expand Down Expand Up @@ -497,9 +496,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
private void adjustButtonsVisibilities() {
showHideBuyUi();
if (Utils.allowSwap(mChainId)) {
if (!AssetUtils.isAuroraAddress(mContractAddress, mChainId)) {
mBtnSwap.setVisibility(View.VISIBLE);
}
mBtnSwap.setVisibility(View.VISIBLE);
} else {
mBtnSwap.setVisibility(View.GONE);
}
Expand Down
Loading

0 comments on commit 405af88

Please sign in to comment.