[DO NOT MERGE] refactor: simplify Screen and Toolbar component usage#3900
[DO NOT MERGE] refactor: simplify Screen and Toolbar component usage#3900
Conversation
WalkthroughThis pull request refactors the Changes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
VultisigApp/VultisigApp/Views/FunctionCall/FunctionCallPairScreen.swift (1)
20-43:⚠️ Potential issue | 🟡 MinorAdd
.screenBackButtonHidden()for consistency with similar screen migrations.The screen now shows a title and toolbar (via
.screenTitle()and.screenToolbar()), but it's missing.screenBackButtonHidden()which should be included to preserve the original behavior whereScreen(showNavigationBar: false)suppressed the back button. All similar screens in the codebase that display a title (PreferredAssetSelectionView, AddressBookChainSelectionScreen, ReceiveChainSelectionScreen, AssetSelectionListScreen) consistently include.screenBackButtonHidden()when migrating from the old pattern.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@VultisigApp/VultisigApp/Views/FunctionCall/FunctionCallPairScreen.swift` around lines 20 - 43, The Screen wrapper for FunctionCallPairScreen is missing the .screenBackButtonHidden() modifier so the back button is suppressed like the original Screen(showNavigationBar: false) behavior; update the view chain that includes KeysignDiscoveryView (inside Screen { ... }) to append .screenBackButtonHidden() alongside the existing .screenTitle("pair".localized) and .screenToolbar { ... } so this screen matches the other migrated screens (PreferredAssetSelectionView, AddressBookChainSelectionScreen, ReceiveChainSelectionScreen, AssetSelectionListScreen).VultisigApp/VultisigApp/Views/Settings/SettingsMainScreen/SettingsMainScreen.swift (1)
68-87:⚠️ Potential issue | 🔴 CriticalAdd
.screenNavigationBarHidden(true)to restore the hidden navigation bar behavior.The old initializer explicitly set
showNavigationBar: false, but the refactored code omits the equivalent.screenNavigationBarHidden()modifier. SinceScreenNavigationBarHiddenKeydefaults tofalse(nav bar shown), the Settings screen will now display a navigation bar that was previously hidden—a visual regression.Add
.screenNavigationBarHidden(true)after.screenToolbarto restore the original behavior.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@VultisigApp/VultisigApp/Views/Settings/SettingsMainScreen/SettingsMainScreen.swift` around lines 68 - 87, SettingsMainScreen lost the previous hidden navigation bar behavior after refactor: add the .screenNavigationBarHidden(true) view modifier to the Screen chain (e.g., after .screenToolbar) in the SettingsMainScreen view so the navigation bar is hidden again; locate the Screen declaration and modifiers around Screen, .screenTitle, .screenEdgeInsets and .screenToolbar and append .screenNavigationBarHidden(true) to restore the original behavior.
🧹 Nitpick comments (2)
VultisigApp/VultisigApp/Views/Vault/RegisterVaultView.swift (1)
21-51: LGTM!Title migration to
.screenTitleis correct. Minor pre-existing note: the struct nameRegisterVaultViewwraps a full screen withScreen— per coding guidelines, it should be namedRegisterVaultScreen. Worth addressing in a follow-up. Based on learnings: "Use theScreencomponent as the standard wrapper for all full-screen views and suffix screen struct names withScreen".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@VultisigApp/VultisigApp/Views/Vault/RegisterVaultView.swift` around lines 21 - 51, The struct currently named RegisterVaultView wraps a full-screen Screen and should be renamed to RegisterVaultScreen to follow the guideline of suffixing full-screen components with "Screen"; update the type declaration from RegisterVaultView to RegisterVaultScreen, rename any previews, initializers, navigation pushes/instantiations, and references (e.g., previews, parent views, or routing) that use RegisterVaultView, and ensure the .screenTitle("registerVault".localized) and onLoad(setData) usages remain unchanged after the rename.VultisigApp/VultisigApp/Features/Onboarding/ImportVault/KeyImport/ChainsSetup/KeyImportChainsSetupScreen.swift (1)
47-48: Minor: duplicatedviewModel.state == .activeChainsexpression.Lines 47 and 48 both evaluate the same predicate. Extracting it to a local
letor computed property reduces the risk of the two conditions diverging in a future edit.♻️ Suggested extraction
+ let isActiveChains = viewModel.state == .activeChains .screenIgnoresTopEdge(isActiveChains) - .screenIgnoresTopEdge(viewModel.state == .activeChains) .screenBackground(isActiveChains ? .gradient : .plain) - .screenBackground(viewModel.state == .activeChains ? .gradient : .plain)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@VultisigApp/VultisigApp/Features/Onboarding/ImportVault/KeyImport/ChainsSetup/KeyImportChainsSetupScreen.swift` around lines 47 - 48, The two calls that use the same predicate (viewModel.state == .activeChains) — screenIgnoresTopEdge(...) and screenBackground(...) — should use a single local boolean to avoid duplication; introduce a local let (e.g., let isActiveChains = viewModel.state == .activeChains) or a computed property and use isActiveChains in both screenIgnoresTopEdge and screenBackground so the conditions remain consistent and easier to maintain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@VultisigApp/VultisigApp/Views/Send/Screens/SendDoneScreen.swift`:
- Around line 30-31: Replace the native SwiftUI modifier
.navigationBarBackButtonHidden(true) on the SendDoneScreen's Screen view with
the custom .screenBackButtonHidden() modifier so the Screen's custom navigation
bar respects the back-button hide state; locate the Screen that currently chains
.screenTitle("done".localized).navigationBarBackButtonHidden(true) and change
that last modifier to .screenBackButtonHidden() (keep the .screenTitle call
unchanged).
---
Outside diff comments:
In `@VultisigApp/VultisigApp/Views/FunctionCall/FunctionCallPairScreen.swift`:
- Around line 20-43: The Screen wrapper for FunctionCallPairScreen is missing
the .screenBackButtonHidden() modifier so the back button is suppressed like the
original Screen(showNavigationBar: false) behavior; update the view chain that
includes KeysignDiscoveryView (inside Screen { ... }) to append
.screenBackButtonHidden() alongside the existing .screenTitle("pair".localized)
and .screenToolbar { ... } so this screen matches the other migrated screens
(PreferredAssetSelectionView, AddressBookChainSelectionScreen,
ReceiveChainSelectionScreen, AssetSelectionListScreen).
In
`@VultisigApp/VultisigApp/Views/Settings/SettingsMainScreen/SettingsMainScreen.swift`:
- Around line 68-87: SettingsMainScreen lost the previous hidden navigation bar
behavior after refactor: add the .screenNavigationBarHidden(true) view modifier
to the Screen chain (e.g., after .screenToolbar) in the SettingsMainScreen view
so the navigation bar is hidden again; locate the Screen declaration and
modifiers around Screen, .screenTitle, .screenEdgeInsets and .screenToolbar and
append .screenNavigationBarHidden(true) to restore the original behavior.
---
Nitpick comments:
In
`@VultisigApp/VultisigApp/Features/Onboarding/ImportVault/KeyImport/ChainsSetup/KeyImportChainsSetupScreen.swift`:
- Around line 47-48: The two calls that use the same predicate (viewModel.state
== .activeChains) — screenIgnoresTopEdge(...) and screenBackground(...) — should
use a single local boolean to avoid duplication; introduce a local let (e.g.,
let isActiveChains = viewModel.state == .activeChains) or a computed property
and use isActiveChains in both screenIgnoresTopEdge and screenBackground so the
conditions remain consistent and easier to maintain.
In `@VultisigApp/VultisigApp/Views/Vault/RegisterVaultView.swift`:
- Around line 21-51: The struct currently named RegisterVaultView wraps a
full-screen Screen and should be renamed to RegisterVaultScreen to follow the
guideline of suffixing full-screen components with "Screen"; update the type
declaration from RegisterVaultView to RegisterVaultScreen, rename any previews,
initializers, navigation pushes/instantiations, and references (e.g., previews,
parent views, or routing) that use RegisterVaultView, and ensure the
.screenTitle("registerVault".localized) and onLoad(setData) usages remain
unchanged after the rename.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (69)
VultisigApp/VultisigApp.xcodeproj/project.pbxprojVultisigApp/VultisigApp/Features/Defi/Protocols/Circle/CircleDepositView.swiftVultisigApp/VultisigApp/Features/Defi/Protocols/Circle/CircleView.swiftVultisigApp/VultisigApp/Features/Defi/Protocols/Circle/CircleWithdrawView.swiftVultisigApp/VultisigApp/Features/Defi/Protocols/Tron/TronFreezeView.swiftVultisigApp/VultisigApp/Features/Defi/Protocols/Tron/TronUnfreezeView.swiftVultisigApp/VultisigApp/Features/Defi/Protocols/Tron/TronView.swiftVultisigApp/VultisigApp/Features/FunctionTransaction/FormScreen.swiftVultisigApp/VultisigApp/Features/FunctionTransaction/Maya/AssetSelectionList/AssetSelectionListScreen.swiftVultisigApp/VultisigApp/Features/Onboarding/ImportVault/ImportVaultSelectionSheet/ImportVaultSelectionSheet.swiftVultisigApp/VultisigApp/Features/Onboarding/ImportVault/KeyImport/ChainsSetup/KeyImportChainsSetupScreen.swiftVultisigApp/VultisigApp/Features/Onboarding/ImportVault/KeyImport/DeviceCount/OnboardingDevicesSelectionScreen.swiftVultisigApp/VultisigApp/Features/Onboarding/ImportVault/KeyImport/OnboardingOverviewScreen.swiftVultisigApp/VultisigApp/Features/Onboarding/ImportVault/KeyImport/OnboardingVaultSetupScreen.swiftVultisigApp/VultisigApp/Features/Onboarding/ImportVault/KeyImport/OnboardingYourVaultSetupScreen.swiftVultisigApp/VultisigApp/Features/Onboarding/ImportVault/Main/Views/ImportVaultShareScreen.swiftVultisigApp/VultisigApp/Features/Onboarding/ImportVault/VaultSetup/VaultSetupScreen.swiftVultisigApp/VultisigApp/Features/VultDiscountTiers/VultDiscountTiersScreen.swiftVultisigApp/VultisigApp/Features/Wallet/Receive/Screens/ReceiveChainSelectionScreen.swiftVultisigApp/VultisigApp/Views/Address Book/AddAddressBookScreen.swiftVultisigApp/VultisigApp/Views/Address Book/AddressBookChainSelectionScreen.swiftVultisigApp/VultisigApp/Views/Address Book/AddressBookScreen.swiftVultisigApp/VultisigApp/Views/Address Book/EditAddressBookScreen.swiftVultisigApp/VultisigApp/Views/Components/Screen/Screen.swiftVultisigApp/VultisigApp/Views/Components/Screen/ScreenEnvironmentKeys.swiftVultisigApp/VultisigApp/Views/Components/Toolbar/CrossPlatformToolbar/CrossPlatformToolbarModifier.swiftVultisigApp/VultisigApp/Views/Components/banxa/BanxaDisclaimer.swiftVultisigApp/VultisigApp/Views/FunctionCall/FunctionCallDetailsScreen.swiftVultisigApp/VultisigApp/Views/FunctionCall/FunctionCallPairScreen.swiftVultisigApp/VultisigApp/Views/FunctionCall/FunctionCallVerifyScreen.swiftVultisigApp/VultisigApp/Views/Keygen/PeerDiscoveryScreen.swiftVultisigApp/VultisigApp/Views/Keygen/ReviewYourVaultsScreen.swiftVultisigApp/VultisigApp/Views/Onboarding/OnboardingSummaryScreen.swiftVultisigApp/VultisigApp/Views/Referral/CreateReferralDetailsView.swiftVultisigApp/VultisigApp/Views/Referral/EditReferralDetailsView.swiftVultisigApp/VultisigApp/Views/Referral/PreferredAssetSelectionView.swiftVultisigApp/VultisigApp/Views/Referral/ReferralInitialScreen.swiftVultisigApp/VultisigApp/Views/Referral/ReferralMainScreen.swiftVultisigApp/VultisigApp/Views/Referral/ReferralVaultSelectionScreen.swiftVultisigApp/VultisigApp/Views/Referral/ReferredCodeFormScreen.swiftVultisigApp/VultisigApp/Views/Referral/ReferredOnboardingView.swiftVultisigApp/VultisigApp/Views/Send/Screens/SendDoneScreen.swiftVultisigApp/VultisigApp/Views/Send/Screens/SendKeysignScreen.swiftVultisigApp/VultisigApp/Views/Send/Screens/SendPairScreen.swiftVultisigApp/VultisigApp/Views/Send/Screens/SendVerifyScreen.swiftVultisigApp/VultisigApp/Views/Send/SendCryptoAddressBookView.swiftVultisigApp/VultisigApp/Views/Send/SendCryptoSecondaryDoneView.swiftVultisigApp/VultisigApp/Views/Settings/OnChainSecurity/OnChainSecurityScreen.swiftVultisigApp/VultisigApp/Views/Settings/SettingsCurrencySelectionView.swiftVultisigApp/VultisigApp/Views/Settings/SettingsFAQView.swiftVultisigApp/VultisigApp/Views/Settings/SettingsLanguageSelectionView.swiftVultisigApp/VultisigApp/Views/Settings/SettingsMainScreen/SettingsMainScreen.swiftVultisigApp/VultisigApp/Views/Swap/SwapCryptoDetailsView.swiftVultisigApp/VultisigApp/Views/Swap/SwapCryptoDoneView.swiftVultisigApp/VultisigApp/Views/Update Check/PhoneCheckUpdateView.swiftVultisigApp/VultisigApp/Views/Vault/Backup/ServerVaultCheckInboxScreen.swiftVultisigApp/VultisigApp/Views/Vault/Backup/VaultBackupNowScreen.swiftVultisigApp/VultisigApp/Views/Vault/Backup/VaultBackupPasswordScreen.swiftVultisigApp/VultisigApp/Views/Vault/Backup/VaultServerBackupScreen.swiftVultisigApp/VultisigApp/Views/Vault/RegisterVaultView.swiftVultisigApp/VultisigApp/Views/Vault/RenameVaultView.swiftVultisigApp/VultisigApp/Views/Vault/Settings/VaultAdvancedSettingsScreen.swiftVultisigApp/VultisigApp/Views/Vault/Settings/VaultSettingsScreen.swiftVultisigApp/VultisigApp/Views/Vault/VaultDeletionConfirmView.swiftVultisigApp/VultisigApp/Views/Vault/VaultDetail/VaultPairDetailView.swiftVultisigApp/VultisigApp/Views/Vault/VaultDetailQRCodeView.swiftVultisigApp/VultisigApp/iOS/View/Send/SendDetailsScreen+iOS.swiftVultisigApp/VultisigApp/macOS/Native/ServerBackupVerificationView.swiftVultisigApp/VultisigApp/macOS/View/Send/SendDetailsScreen+macOS.swift
| .screenTitle("done".localized) | ||
| .navigationBarBackButtonHidden(true) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find Screen.swift and examine screenBackButtonHidden usage
fd -t f "Screen\.swift" --path "*/Views/*" | head -5Repository: vultisig/vultisig-ios
Length of output: 298
🏁 Script executed:
#!/bin/bash
# Search for screenBackButtonHidden environment key usage
rg -n "screenBackButtonHidden" --type swift -A 2 -B 2Repository: vultisig/vultisig-ios
Length of output: 5787
🏁 Script executed:
#!/bin/bash
# Read SendDoneScreen.swift to verify current state
cat -n "VultisigApp/VultisigApp/Views/Send/Screens/SendDoneScreen.swift"Repository: vultisig/vultisig-ios
Length of output: 1033
🏁 Script executed:
#!/bin/bash
# Check for other screens in Send/Screens that use screenBackButtonHidden
fd -t f "Screen\.swift" "VultisigApp/VultisigApp/Views/Send/Screens/" | xargs -I {} sh -c 'echo "=== {} ===" && rg -n "screenBackButtonHidden|navigationBarBackButtonHidden" {} || true'Repository: vultisig/vultisig-ios
Length of output: 528
Replace .navigationBarBackButtonHidden(true) with .screenBackButtonHidden() on line 31.
Screen reads the screenBackButtonHidden environment key to control its custom navigation bar. The native .navigationBarBackButtonHidden(true) modifier has no effect on the Screen component's rendering. This is consistent with how other screens throughout the codebase (AddressBookChainSelectionScreen, ReceiveChainSelectionScreen, AssetSelectionListScreen, etc.) suppress the back button.
♻️ Proposed fix
.screenTitle("done".localized)
- .navigationBarBackButtonHidden(true)
+ .screenBackButtonHidden()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .screenTitle("done".localized) | |
| .navigationBarBackButtonHidden(true) | |
| .screenTitle("done".localized) | |
| .screenBackButtonHidden() |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@VultisigApp/VultisigApp/Views/Send/Screens/SendDoneScreen.swift` around lines
30 - 31, Replace the native SwiftUI modifier
.navigationBarBackButtonHidden(true) on the SendDoneScreen's Screen view with
the custom .screenBackButtonHidden() modifier so the Screen's custom navigation
bar respects the back-button hide state; locate the Screen that currently chains
.screenTitle("done".localized).navigationBarBackButtonHidden(true) and change
that last modifier to .screenBackButtonHidden() (keep the .screenTitle call
unchanged).
Description
Please include a summary of the change and which issue is fixed.
Fixes #
Which feature is affected?
Checklist
Screenshots (if applicable):
Additional context
Summary by CodeRabbit
Release Notes