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

NMA-615 | Contacts Page | Unregistered Users #519

Merged
merged 21 commits into from
Oct 6, 2020
Merged

NMA-615 | Contacts Page | Unregistered Users #519

merged 21 commits into from
Oct 6, 2020

Conversation

desamtralized
Copy link
Contributor

Issue being fixed or feature implemented

Related PR's and Dependencies

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

Copy link
Collaborator

@HashEngineering HashEngineering left a comment

Choose a reason for hiding this comment

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

I left a few comments. It seems that this PR is not based on the most recent commit from the evonet-develop branch, though, GitHub does not point this out.

This PR will have conflicts with #516 (Merging the Master Branch into evonet-develop to add many of the fixes for the past few releases of Dash Wallet). We will need to determine the best merge order.

One issue found is this:

  1. From Home Screen with no username, click on the contacts Screen.
  2. On Contacts Screen, click upgrade.
  3. Cancel / go back to the home screen, the Contacts button in the footer is still highlighted
  4. Clicking on the Contacts button on the footer doesn't return to the Contacts Screen

@desamtralized
Copy link
Contributor Author

I left a few comments. It seems that this PR is not based on the most recent commit from the evonet-develop branch, though, GitHub does not point this out.

This PR will have conflicts with #516 (Merging the Master Branch into evonet-develop to add many of the fixes for the past few releases of Dash Wallet). We will need to determine the best merge order.

One issue found is this:

  1. From Home Screen with no username, click on the contacts Screen.
  2. On Contacts Screen, click upgrade.
  3. Cancel / go back to the home screen, the Contacts button in the footer is still highlighted
  4. Clicking on the Contacts button on the footer doesn't return to the Contacts Screen

Good find, @HashEngineering! Issue addressed.

…ity and fragments with modern one based on shared view model.
@tomasz-ludek
Copy link
Collaborator

tomasz-ludek commented Oct 2, 2020

I'm all for refactoring WalletFragment and MainActivity but let's do it right!
I've limited time today so decided to commit proposed improvements instead of just describing them in comments.
Please have a look at ef6db8a
First of all callback based communication between fragment and activity is so old school... Let's switch to shared view model: https://developer.android.com/topic/libraries/architecture/viewmodel#sharing
Also, in DashPayViewModel we should keep only common methods/LiveDatas used by different Activities/Fragments whereas less common stuff should be kept in dedicated ViewModels. That is why isPlatformAvailable has been moved to MainActivityViewModel.

@sambarboza I think UpgradeToEvolutionFragment should listen to WalletCoinsReceivedEvent and WalletCoinsSentEvent in order to enable Upgrade button when wallet.canAffordIdentityCreation() (similarly as in WalletFragment), however instead of registering OnCoinsSentReceivedListener and CoinsSentEventListener in both fragments you could create a dedicated LiveData in MainActivityViewModel based on awesome ContactsBasedLiveData designed by @HashEngineering (instead of platformRepo.addContactsUpdatedListener you will have wallet.addCoinsReceivedEventListener, wallet.addCoinsSentEventListener).

Hopefully, all the changes I made are fully correct since I'm in hurry...

@HashEngineering let's merge this PR first (after improving it a bit) ant then l'll resolve all the conflicts with #516.

Comment on lines 120 to 125
viewModel.blockchainStateData.observe(this, Observer {
// just to trigger data loading
})
viewModel.isPlatformAvailableData.observe(this, Observer {
// just to trigger data loading
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Those empty observers could be replaced by other way of triggering data loading but let's leave it as it is
I'll fix it when working on "JoinDash" shortcut when #516 in merged (it will be merged after this PR)

@@ -119,27 +132,7 @@ class WalletFragment : Fragment() {
showHideJoinDashPayAction()
}

fun setBlockchainState(blockchainState: BlockchainState?) {
this.blockchainState = blockchainState
if (isDetached || !isVisible) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this shouldn't be needed when using LiveDatas

@tomasz-ludek
Copy link
Collaborator

I couldn't resist myself from implementing further improvements in MainActivityViewModel.
Please have a look 3cc66d3
The most important part is MainActivityViewModel.isAbleToCreateIdentityData which combines all the needed data all together.
WalletBalanceBasedLiveData based on mentioned before Eric's ContactsBasedLiveData.

…no-user

# Conflicts:
#	wallet/res/values-th/strings-extra.xml
#	wallet/src/de/schildbach/wallet/ui/WalletFragment.kt
Copy link
Collaborator

@HashEngineering HashEngineering left a comment

Choose a reason for hiding this comment

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

Looks good with the new LiveData's. Works well.

@HashEngineering HashEngineering merged commit 19a683e into dashpay:evonet-develop Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants