Skip to content
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

chore(wallet): Migrate Report Tx Sent P3A question into core #22360

Merged
merged 12 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,12 @@

import com.google.android.material.tabs.TabLayout;

import org.chromium.base.CommandLine;
import org.chromium.base.Log;
import org.chromium.brave_wallet.mojom.AccountInfo;
import org.chromium.brave_wallet.mojom.AssetRatioService;
import org.chromium.brave_wallet.mojom.BlockchainRegistry;
import org.chromium.brave_wallet.mojom.BlockchainToken;
import org.chromium.brave_wallet.mojom.BraveWalletConstants;
import org.chromium.brave_wallet.mojom.BraveWalletP3a;
import org.chromium.brave_wallet.mojom.BraveWalletService;
import org.chromium.brave_wallet.mojom.CoinType;
import org.chromium.brave_wallet.mojom.JsonRpcService;
import org.chromium.brave_wallet.mojom.KeyringService;
import org.chromium.brave_wallet.mojom.NetworkInfo;
Expand All @@ -64,7 +60,6 @@
import org.chromium.chrome.browser.crypto_wallet.util.TokenUtils;
import org.chromium.chrome.browser.crypto_wallet.util.TransactionUtils;
import org.chromium.chrome.browser.crypto_wallet.util.Utils;
import org.chromium.chrome.browser.crypto_wallet.util.WalletConstants;
import org.chromium.chrome.browser.util.LiveDataUtil;
import org.chromium.chrome.browser.util.TabUtils;

Expand Down Expand Up @@ -181,15 +176,6 @@ private KeyringService getKeyringService() {
return null;
}

private BraveWalletP3a getBraveWalletP3A() {
Activity activity = getActivity();
if (activity instanceof BraveWalletBaseActivity) {
return ((BraveWalletBaseActivity) activity).getBraveWalletP3A();
}

return null;
}

@Override
public void show(FragmentManager manager, String tag) {
try {
Expand Down Expand Up @@ -514,7 +500,6 @@ private void approveTransaction() {
"approveTransaction", providerError, errorMessage);
return;
}
reportTransactionForP3A();
mApproved = true;
if (mTransactionConfirmationListener != null) {
mTransactionConfirmationListener.onApproveTransaction();
Expand All @@ -523,22 +508,6 @@ private void approveTransaction() {
});
}

private void reportTransactionForP3A() {
if (!WalletConstants.SEND_TRANSACTION_TYPES.contains(mTxInfo.txType)
&& !(mCoinType == CoinType.FIL && mTxInfo.txType == TransactionType.OTHER)) {
return;
}
BraveWalletP3a braveWalletP3A = getBraveWalletP3A();
assert braveWalletP3A != null;

boolean countTestNetworks = CommandLine.getInstance().hasSwitch(
BraveWalletConstants.P3A_COUNT_TEST_NETWORKS_SWITCH);
if (countTestNetworks
|| !WalletConstants.KNOWN_TEST_CHAIN_IDS.contains(mTxNetwork.chainId)) {
braveWalletP3A.reportTransactionSent(mCoinType, true);
}
}

private boolean canUpdateUi() {
return isAdded() && getActivity() != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,4 @@ public final class WalletConstants {

public static final List<String> KNOWN_TEST_CHAIN_IDS =
new ArrayList<>(KNOWN_TEST_CHAINS_MAP.keySet());

public static final List<Integer> SEND_TRANSACTION_TYPES = Arrays.asList(
TransactionType.ETH_SEND, TransactionType.ERC20_TRANSFER,
TransactionType.SOLANA_SYSTEM_TRANSFER, TransactionType.SOLANA_SPL_TOKEN_TRANSFER,
TransactionType.SOLANA_SPL_TOKEN_TRANSFER_WITH_ASSOCIATED_TOKEN_ACCOUNT_CREATION);
}
Loading
Loading