Skip to content

Conversation

@gemdev111
Copy link
Contributor

  • Extract domain-specific logic from AmountSceneViewModel into dedicated ViewModels (Staking, Perpetual, Freeze)
  • Introduce AmountTypeConfigurable protocol for unified domain selection API
  • Replace 3 optional domain properties with single AmountTypeModel enum
  • Replace optional delegation binding with value-based NavigationLink

Introduces AmountTypeModel and related view models (StakingAmountTypeViewModel, PerpetualAmountTypeViewModel, FreezeAmountTypeViewModel) to encapsulate logic for different amount types. Refactors AmountSceneViewModel and related views to use the new models, improving modularity and maintainability. Adds AmountTypeConfigurable protocol for consistent interface across amount type view models.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gemdev111, 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 significantly refactors the AmountSceneViewModel by delegating type-specific logic to new, specialized ViewModels (Staking, Perpetual, Freeze). This change enhances the architecture by centralizing related concerns, making the main ViewModel leaner and more focused. It also introduces a AmountTypeConfigurable protocol to standardize interactions with these new type-specific ViewModels, leading to a more scalable and maintainable codebase.

Highlights

  • Refactored AmountSceneViewModel: Extracted domain-specific logic for Staking, Perpetual, and Freeze operations into dedicated, protocol-based ViewModels to improve modularity and maintainability.
  • Introduced AmountTypeConfigurable Protocol: A new protocol, AmountTypeConfigurable, was added to provide a unified API for selecting domain-specific items across different amount types.
  • Unified Domain Selection: Replaced multiple optional domain properties within AmountSceneViewModel with a single AmountTypeModel enum, simplifying the ViewModel's state management.
  • Improved Navigation: Switched from optional delegation binding to value-based NavigationLink for a more robust and Swifty navigation pattern.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 introduces a significant and well-executed refactoring of the AmountSceneViewModel. By extracting domain-specific logic for Staking, Perpetual, and Freeze operations into dedicated, protocol-based ViewModels, the code is now much cleaner, more modular, and easier to maintain. The introduction of the AmountTypeConfigurable protocol and the AmountTypeModel enum are excellent choices for creating a unified and scalable architecture. My review includes a couple of high-severity suggestions to improve the robustness of handling leverage options within the new PerpetualAmountTypeViewModel, which will help prevent potential UI inconsistencies or runtime issues.

Updated the logic for selecting the default leverage option to ensure a valid item is always chosen. The fallback now uses the first available item if the preferred or candidate option is not present in the list. Also updated the LeveragePickerSheet to use the first item as a fallback for selected leverage.
@gemdev111 gemdev111 self-assigned this Dec 24, 2025
@gemdev111 gemdev111 closed this Dec 30, 2025
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