- 
                Notifications
    
You must be signed in to change notification settings  - Fork 54
 
Integrate BannerSetupService into onboarding flow #1351
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
base: main
Are you sure you want to change the base?
Conversation
BannerSetupService is now injected and used throughout onboarding and wallet creation flows. The VerifyPhraseViewModel uses BannerSetupService to set up onboarding banners after wallet import. Service injection and environment propagation have been updated across navigation stacks, view models, and service factories. BannerSetupService's onboarding logic is refactored for direct invocation.
          Summary of ChangesHello @DRadmir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the process of setting up onboarding banners by integrating the  Highlights
 Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either  
 Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a  Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request successfully integrates BannerSetupService into the onboarding and wallet creation flows. The dependency is now correctly propagated through the necessary view models and navigation stacks. The logic for displaying onboarding banners has been refactored for a more direct invocation, which simplifies the process. I've included a couple of suggestions to enhance error handling and to clarify a logic change that occurred during the refactoring concerning view-only wallets. Overall, the changes are well-implemented.
| let wallet = try await walletService.importWallet(name: name, type: .phrase(words: self.words, chains: AssetConfiguration.allChains)) | ||
| 
               | 
          ||
| WalletPreferences(walletId: wallet.id).completeInitialSynchronization() | ||
| try? bannerSetupService.setupOnboarding(wallet: wallet) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The importWallet() function is marked as throws, but the potential error from bannerSetupService.setupOnboarding(wallet: wallet) is being suppressed with try?. This means if adding the onboarding banner fails, the error will be silently ignored. It would be better to let the error propagate to the caller, onImportWallet(), which already has a do-catch block to handle errors and inform the user.
| try? bannerSetupService.setupOnboarding(wallet: wallet) | |
| try bannerSetupService.setupOnboarding(wallet: wallet) | 
| public func setupOnboarding(wallet: Wallet) throws { | ||
| try store.addBanners([ | ||
| NewBanner.onboarding(walletId: wallet.walletId) | ||
| ]) | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous implementation of setupOnboarding included a check to avoid showing the banner for view-only wallets. This check was removed during refactoring. This might be unintentional, as view-only wallets have limited functionality and some onboarding steps may not be relevant. If this was an oversight, consider re-introducing a check for the wallet type to avoid showing this banner for view-only wallets.
| public func setupOnboarding(wallet: Wallet) throws { | |
| try store.addBanners([ | |
| NewBanner.onboarding(walletId: wallet.walletId) | |
| ]) | |
| } | |
| public func setupOnboarding(wallet: Wallet) throws { | |
| guard wallet.type != .view else { return } | |
| try store.addBanners([ | |
| NewBanner.onboarding(walletId: wallet.walletId) | |
| ]) | |
| } | 
BannerSetupService is now injected and used throughout onboarding and wallet creation flows. The VerifyPhraseViewModel uses BannerSetupService to set up onboarding banners after wallet import. Service injection and environment propagation have been updated across navigation stacks, view models, and service factories. BannerSetupService's onboarding logic is refactored for direct invocation.
Features/Onboarding/Sources/Scenes/ShowSecretDataScene.swift minor fix