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

[VDG] UI Decoupling #24 #10730

Merged
merged 45 commits into from Jun 16, 2023
Merged

Conversation

ichthus1604
Copy link
Collaborator

  • Removes the automatic save feature from WalletSettingsModel introduced in [VDG] UI Decoupling #22 #10716 because it doesn't really make sense.
  • Abstracts Wallet Creation and Recovery workflows into IWalletListModel. This abstraction has now become effectively the Wallet Repository, and thus needs to be renamed. This rename will happen in the next PR.
  • CreateNewWalletAsync() and RecoverWalletAsync() both return IWalletSettingsModel, to properly represent the fact that the wallet hasn't been created at that point, which happens in IWalletListModel.SaveWallet() which does properly return IWalletModel.
  • Changes WalletSettingsModel to work with a KeyManager instead of a Wallet due to the above.
  • Removes the KeyManager.SetAnonScore(int anonScore, bool toFile) method since it's no longer used
  • Removes the bool toFile parameter from KeyManager.SetFeeRateMedianTimeFrame() method since it's no longer used.
  • Greatly simplifies how the UI deals with saving wallet settings / coinjoin profiles / persisting new wallets / adding them to the wallet list.
  • Introduces the IWalletSettingsModel.IsNewWallet property which is internally set when creating / recovering wallets, removing the need to pass this value as a loose boolean parameter manually between ViewModels.
  • Significant change in the workflow: before this PR, the wallet was added to the WalletManager in the OnNavigatedTo() event of the AddedWalletPageViewModel. This doesn't really make sense because wallet persistence should not depend on whether a particular dialog is shown or not in the UI. This logic has been moved to CoinjoinProfilesViewModel.OnNext() so that the wallet is persisted and added to WalletManager immediately after the user hits Next on that screen.

@ichthus1604 ichthus1604 changed the title [VDG] [DO NOT MERGE] UI Decoupling #24 [VDG] UI Decoupling #24 May 18, 2023
return new WalletSettingsModel(keyManager, true);
}

public IWalletModel SaveWallet(IWalletSettingsModel walletSettings)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The result is not used anywhere ?

using NBitcoin;
using System.Threading.Tasks;
using WalletWasabi.Fluent.Models.Wallets;

namespace WalletWasabi.Fluent.Models.UI;

#nullable disable
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not fix nullable annotations in IWalletListModel ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also public IWalletModel? DefaultWallet => null; has nullable annotation which results in warning.

.Subscribe();

DefaultWallet =
wallets.FirstOrDefault(item => item.Name == Services.UiConfig.LastSelectedWallet)
?? wallets.FirstOrDefault();
_wallets.FirstOrDefault(item => item.Name == Services.UiConfig.LastSelectedWallet)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not part of this PR but I wonder isn't second FirstOrDefault() really needed ?

@wieslawsoltes
Copy link
Collaborator

@ichthus1604 LGTM just added some comments

@wieslawsoltes
Copy link
Collaborator

@ichthus1604 Fixed DS issues and CF issues (remaining are not part of this PR).

wieslawsoltes
wieslawsoltes previously approved these changes Jun 15, 2023
@wieslawsoltes
Copy link
Collaborator

@molnard Seems CF did not update properly, all of the issues are already fixed. This PR can be merged but I can't because of CF.

@wieslawsoltes wieslawsoltes merged commit c5e46d6 into zkSNACKs:master Jun 16, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants