Fix crash al abrir Import Data en Mac Catalyst (@EnvironmentObject no heredado en sheets)

ImportDataView usa @EnvironmentObject (iapService/accountStore/tabSelection).
En Mac (Designed for iPad) las sheets no heredan el environment vía
PresentationHostingController → EnvironmentObject.error() / SIGTRAP al abrir
Import Data (ImportDataView.swift:247, shouldShowAccountSelection). Reinyectados
los 3 objects en las sheets de Settings, Dashboard y Onboarding.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L2p3gUZRNWW388rWFRjiU7
This commit is contained in:
alexandrev-tibco
2026-07-23 11:02:56 +02:00
parent d50926df76
commit 9539803d74
3 changed files with 21 additions and 0 deletions
@@ -6,6 +6,7 @@ import TipKit
struct DashboardView: View {
@EnvironmentObject var iapService: IAPService
@EnvironmentObject var accountStore: AccountStore
@EnvironmentObject var tabSelection: TabSelectionStore
@StateObject private var viewModel: DashboardViewModel
@StateObject private var goalsViewModel = GoalsViewModel()
@State private var showingImport = false
@@ -110,7 +111,12 @@ struct DashboardView: View {
goalsViewModel.refresh()
}
.sheet(isPresented: $showingImport) {
// Re-inject env objects: sheets don't inherit @EnvironmentObject on
// Mac Catalyst (Designed for iPad) ImportDataView crashed on open.
ImportDataView()
.environmentObject(iapService)
.environmentObject(accountStore)
.environmentObject(tabSelection)
}
.sheet(isPresented: $showingAddSource) {
AddSourceView()