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

Show test networks separately #19467

Merged
merged 6 commits into from
Jul 31, 2023
Merged

Conversation

Pavneet-Sing
Copy link

Resolves brave/brave-browser#31815
Resolves brave/brave-browser#31610
Resolves brave/brave-browser#24244

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

test-network-section.webm

@Pavneet-Sing Pavneet-Sing added CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-ios Do not run CI builds for iOS CI/skip-windows-x86 CI/skip-windows-x64 Do not run CI builds for Windows x64 unused-CI/skip-linux-x64 Do not run CI builds for Linux x64 labels Jul 28, 2023
@Pavneet-Sing Pavneet-Sing self-assigned this Jul 28, 2023
@Pavneet-Sing Pavneet-Sing requested a review from a team as a code owner July 28, 2023 09:44
} else if (WalletConstants.KNOWN_TEST_CHAIN_IDS.contains(
networkInfo.chainId)) {
test.add(networkInfo);
} else if (!WalletConstants.SUPPORTED_TOP_LEVEL_CHAIN_IDS.contains(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can just do else { ... without conditions check as they always pass on that stage because of 2 conditions above.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a matter of taste, but I would probably add a forth else where we log an error (as it should never happen), or throw an exception.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced with else d194853

Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strings++

@@ -65,6 +64,7 @@ public class NetworkModel implements JsonRpcServiceObserver {
private final MediatorLiveData<List<NetworkInfo>> _mPrimaryNetworks;
private final MediatorLiveData<List<NetworkInfo>> _mSecondaryNetworks;
private Map<String, NetworkSelectorModel> mNetworkSelectorMap;
private MutableLiveData<NetworkLists> _mNetworkLists;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be final.

Copy link
Author

@Pavneet-Sing Pavneet-Sing Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated d194853

@@ -65,6 +64,7 @@ public class NetworkModel implements JsonRpcServiceObserver {
private final MediatorLiveData<List<NetworkInfo>> _mPrimaryNetworks;
private final MediatorLiveData<List<NetworkInfo>> _mSecondaryNetworks;
private Map<String, NetworkSelectorModel> mNetworkSelectorMap;
private MutableLiveData<NetworkLists> _mNetworkLists;
private OriginInfo mOriginInfo;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mOriginInfo is unused and can be safely removed.

Copy link
Author

@Pavneet-Sing Pavneet-Sing Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated d194853

@@ -76,6 +76,7 @@ public class NetworkModel implements JsonRpcServiceObserver {
public final LiveData<NetworkInfo> mDefaultNetwork;
public final LiveData<List<NetworkInfo>> mPrimaryNetworks;
public final LiveData<List<NetworkInfo>> mSecondaryNetworks;
public LiveData<NetworkLists> mNetworkLists;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be final as well.

Copy link
Author

@Pavneet-Sing Pavneet-Sing Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated d194853

} else if (WalletConstants.KNOWN_TEST_CHAIN_IDS.contains(
networkInfo.chainId)) {
test.add(networkInfo);
} else if (!WalletConstants.SUPPORTED_TOP_LEVEL_CHAIN_IDS.contains(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a matter of taste, but I would probably add a forth else where we log an error (as it should never happen), or throw an exception.

@@ -43,7 +43,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

public class NetworkModel implements JsonRpcServiceObserver {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSubTestNetworks method is unused and can be safely removed now.

Copy link
Author

@Pavneet-Sing Pavneet-Sing Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated d194853

@Pavneet-Sing Pavneet-Sing merged commit 6215d4c into master Jul 31, 2023
@Pavneet-Sing Pavneet-Sing deleted the show-test-networks-separately branch July 31, 2023 08:30
@github-actions github-actions bot added this to the 1.58.x - Nightly milestone Jul 31, 2023
Pavneet-Sing pushed a commit that referenced this pull request Aug 3, 2023
Show test networks separately (#19467)
* Implement test network in separate section
* Collect networks as list
* Show network icon and remove default icon
* Fix eth icon flasing and add null check
* Update blockie size and clean up
* Minor review changes
@srirambv
Copy link
Contributor

srirambv commented Aug 8, 2023

Verification passed on Oppo Reno 5 with Android 13 running 1.58.77

  • Verified all test networks are listed under Test Networks heading
  • Verified selecting networks doesn't change position of any secondary or primary and test networks
  • Verified selecting a different network doesn't flash ETH icon on all networks
19467.mp4

kjozwiak pushed a commit that referenced this pull request Aug 8, 2023
Uplift of #19467 (squashed) to beta
Show test networks separately (#19467)
* Implement test network in separate section
* Collect networks as list
* Show network icon and remove default icon
* Fix eth icon flasing and add null check
* Update blockie size and clean up
* Minor review changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-ios Do not run CI builds for iOS CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-windows-x64 Do not run CI builds for Windows x64 feature/web3/wallet unused-CI/skip-linux-x64 Do not run CI builds for Linux x64
Projects
None yet
5 participants