Closed AW-STJ closed 3 years ago
@justindg - this is a continuation from the issue: https://github.com/AlphaWallet/alpha-wallet-android/issues/1804
We need to make the user flow aligned to what @colourfreak had designed. See the comment on what was proposed. https://github.com/AlphaWallet/alpha-wallet-android/issues/1804#issuecomment-824068805
Also need to align the current modal to the design. https://zpl.io/VDg41kq
@JamesSmartCell can you also provide the guidance required to Justin on how that should be done.
Background: If user deselects the network that is currently active in the dapp browser, currently we immediately ask them which network they would like to reset the dappbrowser to. This can happen one of two ways: either user switched between mainnets and testnets, or the user deselected the network from the 'Network Selection' page.
However, this may be slightly confusing for some users who aren't familiar with the concepts, and they may not even be using the dapp browser.
So, this issue is proposing that if the current dapp browser network is de-selected we note that there is no active network (this is ethereumNetworkRepository.setDefaultNetworkInfo
). We should perhaps set this to null (?); it should only be accessed from DappBrowserFragment. While defaultNetwork is null, the dappbrowser should be sent to the home page.
So, if the dappbrowser network is 'null', dappbrowser won't be doing anything. When Dappbrowser is selected via the navigation buttons, we should pop a non-dismissible dialog (Maybe a BottomSheetDialog to be in-line with iOS) that asks the user to set the current network. Once they click they go to SelectNetworkActivity in single selection mode.
@justindg The 'defaultNetwork' only should have meaning now in the DappBrowser, since everywhere else the wallet operates across all networks. If any other fragment or activity use 'defaultNetwork' it should probably not be.
I had a quick look it appears other places read this value, and it's redundant. EG in the redeem activity (which is legacy anyway) the network should be picked up from the token not the default network.
Can you do a small refactor and remove all these - there should be only one place where getDefaultNetwork is needed and that's dappbrowser. SetDefaultNetwork you'll need to access in SelectNetworkActivity and DappBrowserFragment.
It's used in the AddCustomToken activity as a hint, but this can be changed to purely be a local setting; the main reason we have this is if there's multiple tokens with the same address on different chains we can pinpoint the exact token we want by selecting the desired network. Just default it to Mainnet ID.
@JamesSmartCell @AW-STJ
Before I push the last batch of changes, I just need clarification for a specific scenario
Suppose Active Networks (Settings) are currently Ethereum and XDAI. Browser Network is Ethereum. User changes Browser Network to Binance.
What should be the desired outcome? a. Binance will be added to the list of active networks b. Binance completely replaces the list of active networks (therefore it becomes the only active network) c. Binance will not be added to the list of active networks.
The browser network switcher should not include Binance, only Ethereum and xDai.
Now fixed
Need to remove the prompt to select the browser default network.
Rather, when the user toggles between main-net and testnet, the browser should reset and start from scratch. We can prompt the user to select network, when the browser tab is clicked.