Mode non-pure-black dark mode stuff to dedicated modifiers
This commit is contained in:
parent
4ea2dff8f1
commit
04ca932a01
|
@ -299,6 +299,7 @@
|
|||
D6C3F4F7298ED7F70009FCFF /* FavoritesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C3F4F6298ED7F70009FCFF /* FavoritesViewController.swift */; };
|
||||
D6C3F4F9298EDBF20009FCFF /* ConversationTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C3F4F8298EDBF20009FCFF /* ConversationTree.swift */; };
|
||||
D6C3F4FB299035650009FCFF /* TrendsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C3F4FA299035650009FCFF /* TrendsViewController.swift */; };
|
||||
D6C3F5172991C1A00009FCFF /* View+AppListStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C3F5162991C1A00009FCFF /* View+AppListStyle.swift */; };
|
||||
D6C693EF216192C2007D6A6D /* TuskerNavigationDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693EE216192C2007D6A6D /* TuskerNavigationDelegate.swift */; };
|
||||
D6C693FC2162FE6F007D6A6D /* LoadingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693FB2162FE6F007D6A6D /* LoadingViewController.swift */; };
|
||||
D6C693FE2162FEEA007D6A6D /* UIViewController+Children.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693FD2162FEEA007D6A6D /* UIViewController+Children.swift */; };
|
||||
|
@ -712,6 +713,7 @@
|
|||
D6C3F4F6298ED7F70009FCFF /* FavoritesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesViewController.swift; sourceTree = "<group>"; };
|
||||
D6C3F4F8298EDBF20009FCFF /* ConversationTree.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationTree.swift; sourceTree = "<group>"; };
|
||||
D6C3F4FA299035650009FCFF /* TrendsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrendsViewController.swift; sourceTree = "<group>"; };
|
||||
D6C3F5162991C1A00009FCFF /* View+AppListStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+AppListStyle.swift"; sourceTree = "<group>"; };
|
||||
D6C693EE216192C2007D6A6D /* TuskerNavigationDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TuskerNavigationDelegate.swift; sourceTree = "<group>"; };
|
||||
D6C693FB2162FE6F007D6A6D /* LoadingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingViewController.swift; sourceTree = "<group>"; };
|
||||
D6C693FD2162FEEA007D6A6D /* UIViewController+Children.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Children.swift"; sourceTree = "<group>"; };
|
||||
|
@ -1309,6 +1311,7 @@
|
|||
D63CC70F2911F1E4000E19DE /* UIScrollView+Top.swift */,
|
||||
D61F758F29353B4300C0B37F /* FileManager+Size.swift */,
|
||||
D61F75AC293AF39000C0B37F /* Filter+Helpers.swift */,
|
||||
D6C3F5162991C1A00009FCFF /* View+AppListStyle.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2246,6 +2249,7 @@
|
|||
D6E426B325337C7000C02E1C /* CustomEmojiImageView.swift in Sources */,
|
||||
D6D4DDD0212518A000E1C4BB /* AppDelegate.swift in Sources */,
|
||||
D61F75B3293BD89C00C0B37F /* UpdateFilterService.swift in Sources */,
|
||||
D6C3F5172991C1A00009FCFF /* View+AppListStyle.swift in Sources */,
|
||||
D65B4B6A297777D900DABDFB /* StatusNotFoundView.swift in Sources */,
|
||||
D6412B0924B0291E00F5412E /* MyProfileViewController.swift in Sources */,
|
||||
D601FA5D297B2E6F00A8E8B5 /* ConversationCollectionViewController.swift in Sources */,
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// View+AppListStyle.swift
|
||||
// Tusker
|
||||
//
|
||||
// Created by Shadowfacts on 2/6/23.
|
||||
// Copyright © 2023 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Combine
|
||||
|
||||
extension View {
|
||||
@ViewBuilder
|
||||
func appGroupedListBackground(container: UIAppearanceContainer.Type, applyBackground: Bool = true) -> some View {
|
||||
if #available(iOS 16.0, *) {
|
||||
if applyBackground {
|
||||
self
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.appGroupedBackground.edgesIgnoringSafeArea(.all))
|
||||
} else {
|
||||
self
|
||||
.scrollContentBackground(.hidden)
|
||||
}
|
||||
} else {
|
||||
self
|
||||
.onAppear {
|
||||
UITableView.appearance(whenContainedInInstancesOf: [container]).backgroundColor = .appGroupedBackground
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func appGroupedListRowBackground() -> some View {
|
||||
self.modifier(AppGroupedListRowBackground())
|
||||
}
|
||||
}
|
||||
|
||||
private struct AppGroupedListRowBackground: ViewModifier {
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
if colorScheme == .dark, !Preferences.shared.pureBlackDarkMode {
|
||||
content
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
} else {
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
|
@ -328,7 +328,7 @@ struct ComposeView: View {
|
|||
}
|
||||
}
|
||||
|
||||
private extension View {
|
||||
extension View {
|
||||
@available(iOS, obsoleted: 16.0)
|
||||
@ViewBuilder
|
||||
func scrollDismissesKeyboardInteractivelyIfAvailable() -> some View {
|
||||
|
|
|
@ -16,7 +16,6 @@ struct AddHashtagPinnedTimelineRepresentable: UIViewControllerRepresentable {
|
|||
@Binding var pinnedTimelines: [PinnedTimeline]
|
||||
|
||||
func makeUIViewController(context: Context) -> UIHostingController<AddHashtagPinnedTimelineView> {
|
||||
UITableView.appearance(whenContainedInInstancesOf: [UIViewControllerType.self]).backgroundColor = .appGroupedBackground
|
||||
return UIHostingController(rootView: AddHashtagPinnedTimelineView(pinnedTimelines: $pinnedTimelines))
|
||||
}
|
||||
|
||||
|
@ -49,6 +48,8 @@ struct AddHashtagPinnedTimelineView: View {
|
|||
var body: some View {
|
||||
NavigationView {
|
||||
list
|
||||
.listStyle(.grouped)
|
||||
.appGroupedListBackground(container: AddHashtagPinnedTimelineRepresentable.UIViewControllerType.self)
|
||||
.navigationTitle("Add Hashtag")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.searchable(text: $viewModel.searchQuery, placement: .navigationBarDrawer(displayMode: .always), prompt: Text("Search for hashtags"))
|
||||
|
@ -89,7 +90,7 @@ struct AddHashtagPinnedTimelineView: View {
|
|||
.listRowBackground(EmptyView())
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
.listStyle(.grouped)
|
||||
|
||||
|
|
|
@ -31,15 +31,10 @@ struct CustomizeTimelinesList: View {
|
|||
if #available(iOS 16.0, *) {
|
||||
NavigationStack {
|
||||
navigationBody
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.appGroupedBackground)
|
||||
}
|
||||
} else {
|
||||
NavigationView {
|
||||
navigationBody
|
||||
.onAppear {
|
||||
UITableView.appearance(whenContainedInInstancesOf: [UIHostingController<CustomizeTimelinesView>.self]).backgroundColor = .appGroupedBackground
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
|
@ -56,7 +51,7 @@ struct CustomizeTimelinesList: View {
|
|||
private var navigationBody: some View {
|
||||
List {
|
||||
PinnedTimelinesView(accountPreferences: mastodonController.accountPreferences)
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
Toggle(isOn: $preferences.hideReblogsInTimelines) {
|
||||
|
@ -68,7 +63,7 @@ struct CustomizeTimelinesList: View {
|
|||
} header: {
|
||||
Text("Home Timeline")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
filtersForEach(unexpiredFilters)
|
||||
|
@ -82,7 +77,7 @@ struct CustomizeTimelinesList: View {
|
|||
} header: {
|
||||
Text("Active Filters")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
if !expiredFilters.isEmpty {
|
||||
Section {
|
||||
|
@ -90,10 +85,11 @@ struct CustomizeTimelinesList: View {
|
|||
} header: {
|
||||
Text("Expired Filters")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedListBackground(container: UIHostingController<CustomizeTimelinesList>.self)
|
||||
.navigationTitle(Text("Customize Timelines"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
|
|
@ -72,7 +72,7 @@ struct EditFilterView: View {
|
|||
filter.title = newValue
|
||||
}))
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
Section {
|
||||
|
@ -97,7 +97,7 @@ struct EditFilterView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
if mastodonController.instanceFeatures.filtersV2 {
|
||||
|
@ -122,7 +122,7 @@ struct EditFilterView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
ForEach(FilterV1.Context.allCases, id: \.rawValue) { context in
|
||||
|
@ -144,9 +144,10 @@ struct EditFilterView: View {
|
|||
} header: {
|
||||
Text("Contexts")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
.scrollContentBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: UIHostingController<CustomizeTimelinesList>.self)
|
||||
.scrollDismissesKeyboardInteractivelyIfAvailable()
|
||||
.navigationTitle(create ? "Add Filter" : "Edit Filter")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
@ -213,20 +214,6 @@ private struct FilterContextToggleStyle: ToggleStyle {
|
|||
}
|
||||
}
|
||||
|
||||
private extension View {
|
||||
@available(iOS, obsoleted: 16.0)
|
||||
@ViewBuilder
|
||||
func scrollContentBackgroundIfAvailable() -> some View {
|
||||
if #available(iOS 16.0, *) {
|
||||
self
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.appGroupedBackground)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//struct EditFilterView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// EditFilterView()
|
||||
|
|
|
@ -43,15 +43,10 @@ struct MuteAccountView: View {
|
|||
if #available(iOS 16.0, *) {
|
||||
NavigationStack {
|
||||
navigationViewContent
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.appGroupedBackground)
|
||||
}
|
||||
} else {
|
||||
NavigationView {
|
||||
navigationViewContent
|
||||
.onAppear {
|
||||
UITableView.appearance(whenContainedInInstancesOf: [UIHostingController<MuteAccountView>.self]).backgroundColor = .appGroupedBackground
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
|
@ -90,7 +85,7 @@ struct MuteAccountView: View {
|
|||
Text("This user's posts will be hidden from your timeline. You can still receive notifications from them.")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
Picker(selection: $duration) {
|
||||
|
@ -105,7 +100,7 @@ struct MuteAccountView: View {
|
|||
Text("The mute will automatically be removed after the selected time.")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Button(action: self.mute) {
|
||||
if isMuting {
|
||||
|
@ -120,8 +115,9 @@ struct MuteAccountView: View {
|
|||
}
|
||||
}
|
||||
.disabled(isMuting)
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
.appGroupedListBackground(container: UIHostingController<MuteAccountView>.self)
|
||||
.alertWithData("Erorr Muting", data: $error, actions: { error in
|
||||
Button("OK") {}
|
||||
}, message: { error in
|
||||
|
|
|
@ -42,7 +42,7 @@ struct AboutView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
Link("Website", destination: URL(string: "https://vaccor.space/tusker")!)
|
||||
|
@ -68,10 +68,10 @@ struct AboutView: View {
|
|||
Link("Source Code", destination: URL(string: "https://git.shadowfacts.net/shadowfacts/Tusker")!)
|
||||
Link("Issue Tracker", destination: URL(string: "https://git.shadowfacts.net/shadowfacts/Tusker/issues")!)
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.sheet(isPresented: $isShowingMailSheet) {
|
||||
MailSheet(logData: logData)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct AcknowledgementsView: View {
|
|||
Text(text)
|
||||
.padding(.horizontal, 16)
|
||||
}
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.navigationTitle("Acknowledgements")
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ struct AdvancedPrefsView : View {
|
|||
cachingSection
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.navigationBarTitle(Text("Advanced"))
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ struct AdvancedPrefsView : View {
|
|||
// see FB6838291
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
var cloudKitSection: some View {
|
||||
|
@ -77,7 +77,7 @@ struct AdvancedPrefsView : View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
.task {
|
||||
CKContainer.default().accountStatus { status, error in
|
||||
if let error {
|
||||
|
@ -103,7 +103,7 @@ struct AdvancedPrefsView : View {
|
|||
.lineLimit(nil)
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
var cachingSection: some View {
|
||||
|
@ -126,7 +126,7 @@ struct AdvancedPrefsView : View {
|
|||
}
|
||||
return Text(s)
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
.task {
|
||||
imageCacheSize = [
|
||||
ImageCache.avatars,
|
||||
|
|
|
@ -49,7 +49,7 @@ struct AppearancePrefsView : View {
|
|||
postsSection
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.navigationBarTitle(Text("Appearance"))
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ struct AppearancePrefsView : View {
|
|||
.onReceive(appearanceChangePublisher) { _ in
|
||||
NotificationCenter.default.post(name: .themePreferenceChanged, object: nil)
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var accountsSection: some View {
|
||||
|
@ -93,7 +93,7 @@ struct AppearancePrefsView : View {
|
|||
Text("Hide Custom Emoji in Usernames")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var postsSection: some View {
|
||||
|
@ -121,7 +121,7 @@ struct AppearancePrefsView : View {
|
|||
.navigationTitle("Trailing Swipe Actions")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ struct BehaviorPrefsView: View {
|
|||
contentWarningsSection
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.navigationBarTitle(Text("Behavior"))
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ struct BehaviorPrefsView: View {
|
|||
Text("Require Confirmation Before Reblogging")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var timelineSection: some View {
|
||||
|
@ -40,7 +40,7 @@ struct BehaviorPrefsView: View {
|
|||
} header: {
|
||||
Text("Timeline")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var linksSection: some View {
|
||||
|
@ -55,7 +55,7 @@ struct BehaviorPrefsView: View {
|
|||
Text("Always Use Reader Mode in In-App Safari")
|
||||
}.disabled(!preferences.useInAppSafari)
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var contentWarningsSection: some View {
|
||||
|
@ -72,7 +72,7 @@ struct BehaviorPrefsView: View {
|
|||
Text(preferences.expandAllContentWarnings ? "Collapse Posts with Keywords in CWs" : "Expand Posts with Keywords in CWs")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ struct ComposingPrefsView: View {
|
|||
writingSection
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.navigationBarTitle("Composing")
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ struct ComposingPrefsView: View {
|
|||
} footer: {
|
||||
Text("When starting a reply, Tusker will use your preferred visibility or the visibility of the post to which you're replying, whichever is narrower.")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
var composingSection: some View {
|
||||
|
@ -64,7 +64,7 @@ struct ComposingPrefsView: View {
|
|||
Text("Require Attachment Descriptions")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
var replyingSection: some View {
|
||||
|
@ -78,7 +78,7 @@ struct ComposingPrefsView: View {
|
|||
Text("Mention Reblogger")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
var writingSection: some View {
|
||||
|
@ -87,7 +87,7 @@ struct ComposingPrefsView: View {
|
|||
Text("Show @ and # on Keyboard")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ struct MediaPrefsView: View {
|
|||
viewingSection
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.navigationBarTitle("Media")
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct MediaPrefsView: View {
|
|||
Text("Show Uncropped Media Inline")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ struct OppositeCollapseKeywordsView: View {
|
|||
ZStack {
|
||||
// the background from the grouped ListStyle clips to the safe area, so when the keyboard is hiding/showing
|
||||
// the color behind it can be seen, which looks odd
|
||||
Color(UIColor.secondarySystemBackground)
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
// Color(UIColor.secondarySystemBackground)
|
||||
// .edgesIgnoringSafeArea(.bottom)
|
||||
|
||||
List {
|
||||
Section(footer: Text("A post matches if its content warning contains the text of a keyword, ignoring case.")) {
|
||||
|
@ -37,11 +37,11 @@ struct OppositeCollapseKeywordsView: View {
|
|||
|
||||
FocusableTextField(placeholder: "Add Keyword", text: $valueToAdd, becomeFirstResponder: $makeAddFieldFirstResponder, onCommit: self.addKeyword)
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
.animation(.default, value: keywords.map(\.id))
|
||||
.listStyle(.grouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
}
|
||||
.onAppear(perform: updateAppearance)
|
||||
.navigationBarTitle(preferences.expandAllContentWarnings ? "Collapse Post CW Keywords" : "Expand Post CW Keywords")
|
||||
|
|
|
@ -24,14 +24,9 @@ struct PreferencesView: View {
|
|||
aboutSection
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.navigationBarTitle("Preferences")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.onAppear {
|
||||
if #unavailable(iOS 16.0) {
|
||||
UITableView.appearance(whenContainedInInstancesOf: [PreferencesNavigationController.self]).backgroundColor = .appGroupedBackground
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var accountsSection: some View {
|
||||
|
@ -90,7 +85,7 @@ struct PreferencesView: View {
|
|||
} header: {
|
||||
Text("Accounts")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var preferencesSection: some View {
|
||||
|
@ -114,7 +109,7 @@ struct PreferencesView: View {
|
|||
Text("Advanced")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var aboutSection: some View {
|
||||
|
@ -129,7 +124,7 @@ struct PreferencesView: View {
|
|||
AcknowledgementsView()
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
func logoutPressed() {
|
||||
|
@ -137,20 +132,6 @@ struct PreferencesView: View {
|
|||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
@available(iOS, obsoleted: 16.0)
|
||||
@ViewBuilder
|
||||
func appGroupedScrollBackgroundIfAvailable() -> some View {
|
||||
if #available(iOS 16.0, *) {
|
||||
self
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color.appGroupedBackground)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#if DEBUG
|
||||
//struct PreferencesView_Previews : PreviewProvider {
|
||||
// static var previews: some View {
|
||||
|
|
|
@ -20,7 +20,7 @@ struct WellnessPrefsView: View {
|
|||
hideTrends
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedScrollBackgroundIfAvailable()
|
||||
.appGroupedListBackground(container: PreferencesNavigationController.self)
|
||||
.navigationBarTitle(Text("Digital Wellness"))
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ struct WellnessPrefsView: View {
|
|||
Text("Favorite and Reblog Counts in Conversations")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var notificationsMode: some View {
|
||||
|
@ -41,7 +41,7 @@ struct WellnessPrefsView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var grayscaleImages: some View {
|
||||
|
@ -50,7 +50,7 @@ struct WellnessPrefsView: View {
|
|||
Text("Grayscale Images")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var disableInfiniteScrolling: some View {
|
||||
|
@ -59,7 +59,7 @@ struct WellnessPrefsView: View {
|
|||
Text("Disable Infinite Scrolling")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
|
||||
private var hideTrends: some View {
|
||||
|
@ -68,7 +68,7 @@ struct WellnessPrefsView: View {
|
|||
Text("Hide Trends")
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ struct ReportAddStatusView: View {
|
|||
ReportStatusView(status: status, mastodonController: mastodonController)
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
.modifier(ScrollBackgroundModifier())
|
||||
} else {
|
||||
|
|
|
@ -47,7 +47,7 @@ struct ReportSelectRulesView: View {
|
|||
.foregroundColor(selectedRuleIDs.contains(rule.id) ? .accentColor : .clear)
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
.withAppBackgroundIfAvailable()
|
||||
.navigationTitle("Rules")
|
||||
|
|
|
@ -31,22 +31,12 @@ struct ReportView: View {
|
|||
var body: some View {
|
||||
if #available(iOS 16.0, *) {
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
// .background doesn't work because it somehow changes color when the keyboard appears
|
||||
Color.appGroupedBackground
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
|
||||
navigationViewContent
|
||||
.scrollContentBackground(.hidden)
|
||||
.scrollDismissesKeyboard(.interactively)
|
||||
}
|
||||
navigationViewContent
|
||||
.scrollDismissesKeyboard(.interactively)
|
||||
}
|
||||
} else {
|
||||
NavigationView {
|
||||
navigationViewContent
|
||||
.onAppear {
|
||||
UITableView.appearance(whenContainedInInstancesOf: [UIHostingController<ReportView>.self]).backgroundColor = .appGroupedBackground
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(.stack)
|
||||
}
|
||||
|
@ -104,14 +94,14 @@ struct ReportView: View {
|
|||
} header: {
|
||||
Text("Reason")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
ComposeTextView(text: $report.comment, placeholder: Text("Add any additional comments"))
|
||||
.backgroundColor(.clear)
|
||||
.listRowInsets(EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8))
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
ForEach(report.statusIDs, id: \.self) { id in
|
||||
|
@ -129,14 +119,14 @@ struct ReportView: View {
|
|||
} footer: {
|
||||
Text("Attach posts to your report to provide additional context for moderators.")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Section {
|
||||
Toggle("Forward", isOn: $report.forward)
|
||||
} footer: {
|
||||
Text("You can choose to anonymously forward your report to the moderators of **\(account.url.host!)**.")
|
||||
}
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
|
||||
Button(action: self.sendReport) {
|
||||
if isReporting {
|
||||
|
@ -149,8 +139,10 @@ struct ReportView: View {
|
|||
}
|
||||
}
|
||||
.disabled(isReporting)
|
||||
.listRowBackground(Color.appGroupedCellBackground)
|
||||
.appGroupedListRowBackground()
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
.appGroupedListBackground(container: UIHostingController<ReportView>.self, applyBackground: true)
|
||||
.alertWithData("Error Reporting", data: $error, actions: { error in
|
||||
Button("OK") {}
|
||||
}, message: { error in
|
||||
|
|
Loading…
Reference in New Issue