Skip to content

Toggle address display on tap in list item#1771

Merged
DRadmir merged 2 commits intomainfrom
toggle-recipient-address
Mar 5, 2026
Merged

Toggle address display on tap in list item#1771
DRadmir merged 2 commits intomainfrom
toggle-recipient-address

Conversation

@DRadmir
Copy link
Contributor

@DRadmir DRadmir commented Mar 5, 2026

Allow tapping an address list item to toggle showing the (short) address. Adds a showAddress @State and uses it to switch the ListItemImageView subtitle between model.subtitle and model.addressSubtitle. Adds canToggleAddress and addressSubtitle computed properties to the view model to control toggling (only when the account has a name different from the address). Preserves existing context menu and safari sheet behavior; also simplifies the view init formatting.

contact
Simulator Screenshot - iPhone 17 Pro - 2026-03-05 at 14 54 12
Simulator Screenshot - iPhone 17 Pro - 2026-03-05 at 14 54 15

plain address
Simulator Screenshot - iPhone 17 Pro - 2026-03-05 at 14 54 30

Allow tapping an address list item to toggle showing the (short) address. Adds a showAddress @State and uses it to switch the ListItemImageView subtitle between model.subtitle and model.addressSubtitle. Adds canToggleAddress and addressSubtitle computed properties to the view model to control toggling (only when the account has a name different from the address). Preserves existing context menu and safari sheet behavior; also simplifies the view init formatting.
@DRadmir DRadmir self-assigned this Mar 5, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 enhances the user experience by allowing users to quickly switch between an account's name and its short address directly within the list item view. This provides more immediate access to address details without navigating away or using context menus, while intelligently restricting the feature to relevant accounts. The change is implemented by introducing state management within the view and extending the view model with properties to control the display logic.

Highlights

  • Address Display Toggling: Implemented the ability to toggle the display of an account's short address by tapping on an AddressListItemView.
  • Conditional Toggling Logic: Introduced logic to enable address toggling only when an account has a name that is different from its address, preventing unnecessary toggles for plain address accounts.
  • View Model Enhancements: Added new computed properties, canToggleAddress and addressSubtitle, to the AddressListItemViewModel to support the new toggling functionality and provide the formatted short address.
  • UI/UX Preservation: Ensured that existing context menu and Safari sheet behaviors remain unchanged, maintaining current user interactions.

🧠 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.

Changelog
  • Packages/PrimitivesComponents/Sources/Components/AddressListItemView.swift
    • Added a new @State variable showAddress to control the visibility of the address subtitle.
    • Modified the subtitle parameter of ListItemImageView to conditionally display either the account name or the short address based on the showAddress state.
    • Implemented an onTapGesture modifier to toggle the showAddress state, guarded by the canToggleAddress property from the view model.
    • Added a contentShape(Rectangle()) modifier to ensure the entire list item is tappable.
    • Simplified the initializer formatting for AddressListItemView.
  • Packages/PrimitivesComponents/Sources/ViewModels/AddressListItemViewModel.swift
    • Introduced a new computed property canToggleAddress to determine if the address display can be toggled (i.e., if the account has a name different from its address).
    • Added a new computed property addressSubtitle to provide the short-formatted address string for display when toggled.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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 feature to toggle address display on tap, which is a good user experience improvement. The implementation is clean, using a new state variable in the view and computed properties in the view model. However, I've identified a potential edge case in the logic for canToggleAddress where an empty string for an account name is not handled, which could lead to unexpected UI behavior. My review includes a suggestion to make this logic more robust.

Comment on lines +69 to +71
public var canToggleAddress: Bool {
account.name != nil && account.name != account.address
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The current logic for canToggleAddress doesn't account for account.name being an empty string. If account.name is "", canToggleAddress will evaluate to true, which is likely not the desired behavior as it could allow toggling from an empty subtitle. An empty name should be treated as if there is no name. It's better to explicitly check for a non-empty name to prevent this.

    public var canToggleAddress: Bool {
        guard let name = account.name, !name.isEmpty else {
            return false
        }
        return name != account.address
    }

.url(title: model.addressExplorerText, onOpen: { isPresentingUrl = model.addressExplorerUrl })
]
)
.contentShape(Rectangle())
Copy link
Contributor

Choose a reason for hiding this comment

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

lets make a custom modiier content shape + ontap? So we can reuse later

Introduce TappableModifier with a View.onTap(_:) extension (uses contentShape + onTapGesture) and replace direct .contentShape/.onTapGesture usage in AddressListItemView with .onTap. Also tighten AddressListItemViewModel.canToggleAddress to treat empty names as non-toggleable and only allow toggling when a non-empty name differs from the address.
@DRadmir DRadmir merged commit e34cec9 into main Mar 5, 2026
1 check passed
@DRadmir DRadmir deleted the toggle-recipient-address branch March 5, 2026 15:31
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.

2 participants