2023-01-25 06:28:16 +01:00
|
|
|
import AppAccount
|
|
|
|
import DesignSystem
|
|
|
|
import Env
|
|
|
|
import Models
|
|
|
|
import Network
|
|
|
|
import NukeUI
|
|
|
|
import SwiftUI
|
|
|
|
import UserNotifications
|
|
|
|
|
|
|
|
struct ContentSettingsView: View {
|
|
|
|
@EnvironmentObject private var userPreferences: UserPreferences
|
|
|
|
@EnvironmentObject private var theme: Theme
|
2023-01-27 20:36:40 +01:00
|
|
|
|
2023-01-25 06:28:16 +01:00
|
|
|
var body: some View {
|
|
|
|
Form {
|
2023-02-01 18:56:06 +01:00
|
|
|
Section("settings.content.boosts") {
|
|
|
|
Toggle(isOn: $userPreferences.suppressDupeReblogs) {
|
|
|
|
Text("settings.content.hide-repeated-boosts")
|
|
|
|
}
|
|
|
|
}.listRowBackground(theme.primaryBackgroundColor)
|
|
|
|
|
2023-02-14 22:13:48 +01:00
|
|
|
Section("settings.content.media") {
|
2023-02-22 18:57:48 +01:00
|
|
|
Toggle(isOn: $userPreferences.autoPlayVideo) {
|
|
|
|
Text("settings.other.autoplay-video")
|
|
|
|
}
|
2023-02-14 22:13:48 +01:00
|
|
|
Toggle(isOn: $userPreferences.showAltTextForMedia) {
|
2023-02-18 07:26:48 +01:00
|
|
|
Text("settings.content.media.show.alt")
|
2023-02-14 22:13:48 +01:00
|
|
|
}
|
|
|
|
}.listRowBackground(theme.primaryBackgroundColor)
|
2023-07-19 07:46:25 +02:00
|
|
|
|
2023-06-26 11:45:14 +02:00
|
|
|
Section("settings.content.sharing") {
|
|
|
|
Picker("settings.content.sharing.share-button-behavior", selection: $userPreferences.shareButtonBehavior) {
|
|
|
|
ForEach(PreferredShareButtonBehavior.allCases, id: \.rawValue) { option in
|
|
|
|
Text(option.title)
|
|
|
|
.tag(option)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2023-02-14 22:13:48 +01:00
|
|
|
|
2023-02-01 18:56:06 +01:00
|
|
|
Section("settings.content.instance-settings") {
|
2023-01-25 06:28:16 +01:00
|
|
|
Toggle(isOn: $userPreferences.useInstanceContentSettings) {
|
|
|
|
Text("settings.content.use-instance-settings")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
|
|
|
.onChange(of: userPreferences.useInstanceContentSettings) { newVal in
|
|
|
|
if newVal {
|
|
|
|
userPreferences.appAutoExpandSpoilers = userPreferences.autoExpandSpoilers
|
|
|
|
userPreferences.appAutoExpandMedia = userPreferences.autoExpandMedia
|
|
|
|
userPreferences.appDefaultPostsSensitive = userPreferences.postIsSensitive
|
|
|
|
userPreferences.appDefaultPostVisibility = userPreferences.postVisibility
|
|
|
|
}
|
|
|
|
}
|
2023-01-27 20:36:40 +01:00
|
|
|
|
2023-02-26 17:32:09 +01:00
|
|
|
Section {
|
2023-01-25 06:28:16 +01:00
|
|
|
Toggle(isOn: $userPreferences.appAutoExpandSpoilers) {
|
|
|
|
Text("settings.content.expand-spoilers")
|
|
|
|
}
|
|
|
|
.disabled(userPreferences.useInstanceContentSettings)
|
2023-03-13 13:38:28 +01:00
|
|
|
|
2023-01-25 06:28:16 +01:00
|
|
|
Picker("settings.content.expand-media", selection: $userPreferences.appAutoExpandMedia) {
|
|
|
|
ForEach(ServerPreferences.AutoExpandMedia.allCases, id: \.rawValue) { media in
|
|
|
|
Text(media.description).tag(media)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.disabled(userPreferences.useInstanceContentSettings)
|
2023-03-13 13:38:28 +01:00
|
|
|
|
2023-02-26 17:32:09 +01:00
|
|
|
Toggle(isOn: $userPreferences.collapseLongPosts) {
|
|
|
|
Text("settings.content.collapse-long-posts")
|
|
|
|
}
|
|
|
|
} header: {
|
|
|
|
Text("settings.content.reading")
|
|
|
|
} footer: {
|
|
|
|
Text("settings.content.collapse-long-posts-hint")
|
|
|
|
}
|
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
2023-01-27 20:36:40 +01:00
|
|
|
|
2023-01-25 06:28:16 +01:00
|
|
|
Section("settings.content.posting") {
|
|
|
|
Picker("settings.content.default-visibility", selection: $userPreferences.appDefaultPostVisibility) {
|
|
|
|
ForEach(Visibility.allCases, id: \.rawValue) { vis in
|
|
|
|
Text(vis.title).tag(vis)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.disabled(userPreferences.useInstanceContentSettings)
|
2023-07-19 11:49:06 +02:00
|
|
|
|
|
|
|
Picker("settings.content.default-reply-visibility", selection: $userPreferences.appDefaultReplyVisibility) {
|
|
|
|
ForEach(Visibility.allCases, id: \.rawValue) { vis in
|
|
|
|
if UserPreferences.getIntOfVisibility(vis) <=
|
|
|
|
UserPreferences.getIntOfVisibility(userPreferences.postVisibility) {
|
|
|
|
Text(vis.title).tag(vis)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.onChange(of: userPreferences.postVisibility) { newValue in
|
|
|
|
userPreferences.conformReplyVisibilityConstraints()
|
|
|
|
}
|
|
|
|
|
2023-01-25 06:28:16 +01:00
|
|
|
Toggle(isOn: $userPreferences.appDefaultPostsSensitive) {
|
|
|
|
Text("settings.content.default-sensitive")
|
|
|
|
}
|
|
|
|
.disabled(userPreferences.useInstanceContentSettings)
|
|
|
|
}
|
2023-02-14 22:13:48 +01:00
|
|
|
|
2023-01-25 06:28:16 +01:00
|
|
|
.listRowBackground(theme.primaryBackgroundColor)
|
|
|
|
}
|
|
|
|
.navigationTitle("settings.content.navigation-title")
|
|
|
|
.scrollContentBackground(.hidden)
|
|
|
|
.background(theme.secondaryBackgroundColor)
|
|
|
|
}
|
|
|
|
}
|