Fix crash when opening Drafts screen on macOS

This commit is contained in:
Shadowfacts 2022-11-12 22:54:55 -05:00
parent 6d2830cf78
commit 0fe9edfdbc
2 changed files with 8 additions and 7 deletions

View File

@ -111,7 +111,7 @@ struct ComposeView: View {
})
.navigationTitle(navTitle)
.sheet(isPresented: $uiState.isShowingDraftsList) {
DraftsView(currentDraft: draft)
DraftsView(currentDraft: draft, mastodonController: mastodonController)
}
.actionSheet(isPresented: $uiState.isShowingSaveDraftSheet, content: self.saveAndCloseSheet)
.alert(isPresented: $isShowingPostErrorAlert) {

View File

@ -10,8 +10,9 @@ import SwiftUI
struct DraftsView: View {
let currentDraft: Draft
// don't pass this in via the environment b/c it crashes on macOS (at least, in Designed for iPad mode) since the environment doesn't get propagated through the modal popup window or something
let mastodonController: MastodonController
@EnvironmentObject var uiState: ComposeUIState
@EnvironmentObject var mastodonController: MastodonController
@StateObject private var draftsManager = DraftsManager.shared
@State private var draftForDifferentReply: Draft?
@ -112,8 +113,8 @@ struct DraftView: View {
}
}
struct DraftsView_Previews: PreviewProvider {
static var previews: some View {
DraftsView(currentDraft: Draft(accountID: ""))
}
}
//struct DraftsView_Previews: PreviewProvider {
// static var previews: some View {
// DraftsView(currentDraft: Draft(accountID: ""))
// }
//}