mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-09-03 00:23:49 +00:00
Add hint if the server post options are overridden (#1679)
If the content settings specify their own post settings and override the instance settings, a hint (and link to the content settings) is added to the instance settings (infos) since that setting might introduce confusion (As happened in #1677).
This commit is contained in:
parent
8bf36709ea
commit
12d92ab1ec
5 changed files with 46 additions and 0 deletions
|
@ -98,6 +98,7 @@ struct AccountSettingsView: View {
|
||||||
}
|
}
|
||||||
.sheet(isPresented: $isEditingAccount, content: {
|
.sheet(isPresented: $isEditingAccount, content: {
|
||||||
EditAccountView()
|
EditAccountView()
|
||||||
|
.environment(\.contentSettingsFactory, AnyView(ContentSettingsView()))
|
||||||
})
|
})
|
||||||
.sheet(isPresented: $isEditingFilters, content: {
|
.sheet(isPresented: $isEditingFilters, content: {
|
||||||
FiltersListView()
|
FiltersListView()
|
||||||
|
|
|
@ -12723,6 +12723,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"account.edit.post-settings.content-settings-reference" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"de" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Achtung: Diese Optionen werden durch die globalen Inhaltseinstellungen überschrieben"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Warning: These settings are overwritten by the global content settings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"account.edit.post-settings.privacy" : {
|
"account.edit.post-settings.privacy" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|
|
@ -19,6 +19,7 @@ let package = Package(
|
||||||
.package(name: "Network", path: "../Network"),
|
.package(name: "Network", path: "../Network"),
|
||||||
.package(name: "Models", path: "../Models"),
|
.package(name: "Models", path: "../Models"),
|
||||||
.package(name: "Status", path: "../Status"),
|
.package(name: "Status", path: "../Status"),
|
||||||
|
.package(name: "Env", path: "../Env"),
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(
|
||||||
|
@ -27,6 +28,7 @@ let package = Package(
|
||||||
.product(name: "Network", package: "Network"),
|
.product(name: "Network", package: "Network"),
|
||||||
.product(name: "Models", package: "Models"),
|
.product(name: "Models", package: "Models"),
|
||||||
.product(name: "Status", package: "Status"),
|
.product(name: "Status", package: "Status"),
|
||||||
|
.product(name: "Env", package: "Env"),
|
||||||
],
|
],
|
||||||
swiftSettings: [
|
swiftSettings: [
|
||||||
.enableExperimentalFeature("StrictConcurrency"),
|
.enableExperimentalFeature("StrictConcurrency"),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import DesignSystem
|
import DesignSystem
|
||||||
import Models
|
import Models
|
||||||
import Network
|
import Network
|
||||||
|
import Env
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
|
@ -8,8 +9,11 @@ public struct EditAccountView: View {
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
@Environment(Client.self) private var client
|
@Environment(Client.self) private var client
|
||||||
@Environment(Theme.self) private var theme
|
@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 viewModel = EditAccountViewModel()
|
||||||
|
@State private var showContentSettings = false
|
||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
|
@ -72,6 +76,19 @@ public struct EditAccountView: View {
|
||||||
|
|
||||||
private var postSettingsSection: some View {
|
private var postSettingsSection: some View {
|
||||||
Section("account.edit.post-settings.section-title") {
|
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)
|
||||||
|
}
|
||||||
Picker(selection: $viewModel.postPrivacy) {
|
Picker(selection: $viewModel.postPrivacy) {
|
||||||
ForEach(Models.Visibility.supportDefault, id: \.rawValue) { privacy in
|
ForEach(Models.Visibility.supportDefault, id: \.rawValue) { privacy in
|
||||||
Text(privacy.title).tag(privacy)
|
Text(privacy.title).tag(privacy)
|
||||||
|
|
|
@ -29,6 +29,10 @@ private struct IndentationLevel: EnvironmentKey {
|
||||||
static let defaultValue: UInt = 0
|
static let defaultValue: UInt = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private struct ContentSettingsFactory: EnvironmentKey {
|
||||||
|
static let defaultValue: AnyView = AnyView(EmptyView())
|
||||||
|
}
|
||||||
|
|
||||||
public extension EnvironmentValues {
|
public extension EnvironmentValues {
|
||||||
var isSecondaryColumn: Bool {
|
var isSecondaryColumn: Bool {
|
||||||
get { self[SecondaryColumnKey.self] }
|
get { self[SecondaryColumnKey.self] }
|
||||||
|
@ -64,4 +68,9 @@ public extension EnvironmentValues {
|
||||||
get { self[IndentationLevel.self] }
|
get { self[IndentationLevel.self] }
|
||||||
set { self[IndentationLevel.self] = newValue }
|
set { self[IndentationLevel.self] = newValue }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var contentSettingsFactory: AnyView {
|
||||||
|
get { self[ContentSettingsFactory.self] }
|
||||||
|
set { self[ContentSettingsFactory.self] = newValue }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue