From 6e2f6bb8e9fc31ee0c5e1212a5954a8dcce0217e Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 6 Feb 2023 19:53:15 -0500 Subject: [PATCH] Apply non-pure black dark mode to Drafts screen --- Tusker/Screens/Compose/ComposeView.swift | 2 +- Tusker/Screens/Compose/DraftsView.swift | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Tusker/Screens/Compose/ComposeView.swift b/Tusker/Screens/Compose/ComposeView.swift index 164caba0..1d178f3a 100644 --- a/Tusker/Screens/Compose/ComposeView.swift +++ b/Tusker/Screens/Compose/ComposeView.swift @@ -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) { diff --git a/Tusker/Screens/Compose/DraftsView.swift b/Tusker/Screens/Compose/DraftsView.swift index e22ff499..4c872566 100644 --- a/Tusker/Screens/Compose/DraftsView.swift +++ b/Tusker/Screens/Compose/DraftsView.swift @@ -8,6 +8,21 @@ import SwiftUI +@available(iOS, obsoleted: 16.0) +struct DraftsRepresentable: UIViewControllerRepresentable { + typealias UIViewControllerType = UIHostingController + + let currentDraft: Draft + let mastodonController: MastodonController + + func makeUIViewController(context: Context) -> UIHostingController { + return UIHostingController(rootView: DraftsView(currentDraft: currentDraft, mastodonController: mastodonController)) + } + + func updateUIViewController(_ uiViewController: UIHostingController, 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 {