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
@@ -13,6 +13,12 @@ struct OnboardingView: View {
@State private var showingImportSheet = false
@State private var showingAddSource = false
// Forwarded into the ImportDataView sheet sheets don't inherit
// @EnvironmentObject on Mac Catalyst, which crashed the import screen.
@EnvironmentObject private var iapService: IAPService
@EnvironmentObject private var accountStore: AccountStore
@EnvironmentObject private var tabSelection: TabSelectionStore
private let pages: [OnboardingPage] = [
OnboardingPage(
icon: "chart.line.uptrend.xyaxis",
@@ -123,6 +129,9 @@ struct OnboardingView: View {
}
.sheet(isPresented: $showingImportSheet) {
ImportDataView(importContext: .onboarding)
.environmentObject(iapService)
.environmentObject(accountStore)
.environmentObject(tabSelection)
}
.sheet(isPresented: $showingAddSource) {
AddSourceView()