Fix / simplify account content warning

This commit is contained in:
Thomas Ricouard 2023-11-19 08:26:07 +01:00
parent 12d92ab1ec
commit 71ab8d558a
3 changed files with 2 additions and 24 deletions

View file

@ -98,7 +98,6 @@ struct AccountSettingsView: View {
}
.sheet(isPresented: $isEditingAccount, content: {
EditAccountView()
.environment(\.contentSettingsFactory, AnyView(ContentSettingsView()))
})
.sheet(isPresented: $isEditingFilters, content: {
FiltersListView()

View file

@ -10,15 +10,13 @@ public struct EditAccountView: View {
@Environment(Client.self) private var client
@Environment(Theme.self) private var theme
@Environment(UserPreferences.self) private var userPrefs
@Environment(\.contentSettingsFactory) private var contentSettings
@State private var viewModel = EditAccountViewModel()
@State private var showContentSettings = false
public init() {}
public var body: some View {
NavigationStack {
NavigationStack{
Form {
if viewModel.isLoading {
loadingSection
@ -77,17 +75,7 @@ public struct EditAccountView: View {
private var postSettingsSection: some View {
Section("account.edit.post-settings.section-title") {
if !userPrefs.useInstanceContentSettings {
HStack {
Button("account.edit.post-settings.content-settings-reference") {showContentSettings.toggle()}
.buttonStyle(.plain)
.navigationDestination(isPresented: $showContentSettings) {
contentSettings
}
Spacer()
Image(systemName: "chevron.right")
.font(.caption)
}
.foregroundStyle(Color.accentColor)
Text("account.edit.post-settings.content-settings-reference")
}
Picker(selection: $viewModel.postPrivacy) {
ForEach(Models.Visibility.supportDefault, id: \.rawValue) { privacy in

View file

@ -29,10 +29,6 @@ private struct IndentationLevel: EnvironmentKey {
static let defaultValue: UInt = 0
}
private struct ContentSettingsFactory: EnvironmentKey {
static let defaultValue: AnyView = AnyView(EmptyView())
}
public extension EnvironmentValues {
var isSecondaryColumn: Bool {
get { self[SecondaryColumnKey.self] }
@ -68,9 +64,4 @@ public extension EnvironmentValues {
get { self[IndentationLevel.self] }
set { self[IndentationLevel.self] = newValue }
}
var contentSettingsFactory: AnyView {
get { self[ContentSettingsFactory.self] }
set { self[ContentSettingsFactory.self] = newValue }
}
}