From 71ab8d558aba8c38ce66fda4bfe8bb329a86f446 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sun, 19 Nov 2023 08:26:07 +0100 Subject: [PATCH] Fix / simplify account content warning --- .../App/Tabs/Settings/AccountSettingView.swift | 1 - .../Sources/Account/Edit/EditAccountView.swift | 16 ++-------------- Packages/Env/Sources/Env/CustomEnvValues.swift | 9 --------- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/IceCubesApp/App/Tabs/Settings/AccountSettingView.swift b/IceCubesApp/App/Tabs/Settings/AccountSettingView.swift index 9daf223d..b1d52861 100644 --- a/IceCubesApp/App/Tabs/Settings/AccountSettingView.swift +++ b/IceCubesApp/App/Tabs/Settings/AccountSettingView.swift @@ -98,7 +98,6 @@ struct AccountSettingsView: View { } .sheet(isPresented: $isEditingAccount, content: { EditAccountView() - .environment(\.contentSettingsFactory, AnyView(ContentSettingsView())) }) .sheet(isPresented: $isEditingFilters, content: { FiltersListView() diff --git a/Packages/Account/Sources/Account/Edit/EditAccountView.swift b/Packages/Account/Sources/Account/Edit/EditAccountView.swift index f7f7049b..7a3a0ffd 100644 --- a/Packages/Account/Sources/Account/Edit/EditAccountView.swift +++ b/Packages/Account/Sources/Account/Edit/EditAccountView.swift @@ -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 diff --git a/Packages/Env/Sources/Env/CustomEnvValues.swift b/Packages/Env/Sources/Env/CustomEnvValues.swift index 10da21ee..fa79adce 100644 --- a/Packages/Env/Sources/Env/CustomEnvValues.swift +++ b/Packages/Env/Sources/Env/CustomEnvValues.swift @@ -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 } - } }