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:
@@ -6,6 +6,8 @@ struct SettingsView: View {
|
||||
private let iapService: IAPService
|
||||
@StateObject private var viewModel: SettingsViewModel
|
||||
@EnvironmentObject private var adMobService: AdMobService
|
||||
@EnvironmentObject private var accountStore: AccountStore
|
||||
@EnvironmentObject private var tabSelection: TabSelectionStore
|
||||
@AppStorage("showForecast") private var showForecast = true
|
||||
@AppStorage("cloudSyncEnabled") private var cloudSyncEnabled = false
|
||||
@AppStorage("faceIdEnabled") private var faceIdEnabled = false
|
||||
@@ -86,7 +88,11 @@ struct SettingsView: View {
|
||||
ActivityView(activityItems: [shareItem.url])
|
||||
}
|
||||
.sheet(isPresented: $viewModel.showingImportSheet) {
|
||||
// Sheets don't inherit @EnvironmentObject on Mac Catalyst → re-inject.
|
||||
ImportDataView()
|
||||
.environmentObject(iapService)
|
||||
.environmentObject(accountStore)
|
||||
.environmentObject(tabSelection)
|
||||
}
|
||||
.confirmationDialog(
|
||||
"Reset All Data",
|
||||
|
||||
Reference in New Issue
Block a user