Apply non-pure black dark mode to Drafts screen

This commit is contained in:
Shadowfacts 2023-02-06 19:53:15 -05:00
parent 74d8adfffe
commit 6e2f6bb8e9
2 changed files with 18 additions and 1 deletions

View File

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

View File

@ -8,6 +8,21 @@
import SwiftUI
@available(iOS, obsoleted: 16.0)
struct DraftsRepresentable: UIViewControllerRepresentable {
typealias UIViewControllerType = UIHostingController<DraftsView>
let currentDraft: Draft
let mastodonController: MastodonController
func makeUIViewController(context: Context) -> UIHostingController<DraftsView> {
return UIHostingController(rootView: DraftsView(currentDraft: currentDraft, mastodonController: mastodonController))
}
func updateUIViewController(_ uiViewController: UIHostingController<DraftsView>, context: Context) {
}
}
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
@ -49,8 +64,10 @@ struct DraftsView: View {
.map { visibleDrafts[$0] }
.forEach { draftsManager.remove($0) }
}
.appGroupedListRowBackground()
}
.listStyle(.plain)
.appGroupedListBackground(container: DraftsRepresentable.UIViewControllerType.self)
.navigationTitle(Text("Drafts"))
.navigationBarTitleDisplayMode(.inline)
.toolbar {