Fix crash when opening Drafts screen on macOS
This commit is contained in:
parent
6d2830cf78
commit
0fe9edfdbc
|
@ -111,7 +111,7 @@ struct ComposeView: View {
|
||||||
})
|
})
|
||||||
.navigationTitle(navTitle)
|
.navigationTitle(navTitle)
|
||||||
.sheet(isPresented: $uiState.isShowingDraftsList) {
|
.sheet(isPresented: $uiState.isShowingDraftsList) {
|
||||||
DraftsView(currentDraft: draft)
|
DraftsView(currentDraft: draft, mastodonController: mastodonController)
|
||||||
}
|
}
|
||||||
.actionSheet(isPresented: $uiState.isShowingSaveDraftSheet, content: self.saveAndCloseSheet)
|
.actionSheet(isPresented: $uiState.isShowingSaveDraftSheet, content: self.saveAndCloseSheet)
|
||||||
.alert(isPresented: $isShowingPostErrorAlert) {
|
.alert(isPresented: $isShowingPostErrorAlert) {
|
||||||
|
|
|
@ -10,8 +10,9 @@ import SwiftUI
|
||||||
|
|
||||||
struct DraftsView: View {
|
struct DraftsView: View {
|
||||||
let currentDraft: Draft
|
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 uiState: ComposeUIState
|
||||||
@EnvironmentObject var mastodonController: MastodonController
|
|
||||||
@StateObject private var draftsManager = DraftsManager.shared
|
@StateObject private var draftsManager = DraftsManager.shared
|
||||||
@State private var draftForDifferentReply: Draft?
|
@State private var draftForDifferentReply: Draft?
|
||||||
|
|
||||||
|
@ -112,8 +113,8 @@ struct DraftView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DraftsView_Previews: PreviewProvider {
|
//struct DraftsView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
// static var previews: some View {
|
||||||
DraftsView(currentDraft: Draft(accountID: ""))
|
// DraftsView(currentDraft: Draft(accountID: ""))
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
Loading…
Reference in New Issue