mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 17:51:01 +00:00
* Local settings for sensitive content. * Local sensitive content settings * Added the posting settings as well as the reading ones. * Menu item / nav title mismatch * Fixes Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
This commit is contained in:
parent
6e58bb8e3e
commit
ab4ac1b004
20 changed files with 232 additions and 10 deletions
|
@ -70,6 +70,7 @@
|
||||||
9FD542E72962D2FF0045321A /* Lists in Frameworks */ = {isa = PBXBuildFile; productRef = 9FD542E62962D2FF0045321A /* Lists */; };
|
9FD542E72962D2FF0045321A /* Lists in Frameworks */ = {isa = PBXBuildFile; productRef = 9FD542E62962D2FF0045321A /* Lists */; };
|
||||||
9FE151A6293C90F900E9683D /* IconSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE151A5293C90F900E9683D /* IconSelectorView.swift */; };
|
9FE151A6293C90F900E9683D /* IconSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE151A5293C90F900E9683D /* IconSelectorView.swift */; };
|
||||||
9FE3DB57296FEFCA00628CB0 /* AppAccount in Frameworks */ = {isa = PBXBuildFile; productRef = 9FE3DB56296FEFCA00628CB0 /* AppAccount */; };
|
9FE3DB57296FEFCA00628CB0 /* AppAccount in Frameworks */ = {isa = PBXBuildFile; productRef = 9FE3DB56296FEFCA00628CB0 /* AppAccount */; };
|
||||||
|
C9B22677297F6C2E001F9EFE /* ContentSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B22676297F6C2E001F9EFE /* ContentSettingsView.swift */; };
|
||||||
E9B576C329743F4C00BCE646 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = E9B576C529743F4C00BCE646 /* Localizable.strings */; };
|
E9B576C329743F4C00BCE646 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = E9B576C529743F4C00BCE646 /* Localizable.strings */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
@ -170,6 +171,7 @@
|
||||||
9FE151A5293C90F900E9683D /* IconSelectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconSelectorView.swift; sourceTree = "<group>"; };
|
9FE151A5293C90F900E9683D /* IconSelectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconSelectorView.swift; sourceTree = "<group>"; };
|
||||||
9FE3DB55296FEF5800628CB0 /* AppAccount */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = AppAccount; path = Packages/AppAccount; sourceTree = "<group>"; };
|
9FE3DB55296FEF5800628CB0 /* AppAccount */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = AppAccount; path = Packages/AppAccount; sourceTree = "<group>"; };
|
||||||
C465A53D297C5E0C00864FB7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
C465A53D297C5E0C00864FB7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||||
|
C9B22676297F6C2E001F9EFE /* ContentSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentSettingsView.swift; sourceTree = "<group>"; };
|
||||||
DD31E2E5297FB68B00A4BE29 /* IceCubesApp.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = IceCubesApp.xcconfig; sourceTree = "<group>"; };
|
DD31E2E5297FB68B00A4BE29 /* IceCubesApp.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = IceCubesApp.xcconfig; sourceTree = "<group>"; };
|
||||||
E9B576C429743F4C00BCE646 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
E9B576C429743F4C00BCE646 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
E9B576CC2974AAAF00BCE646 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
|
E9B576CC2974AAAF00BCE646 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
|
@ -374,6 +376,7 @@
|
||||||
9F7335F82968576500AFF0BA /* DisplaySettingsView.swift */,
|
9F7335F82968576500AFF0BA /* DisplaySettingsView.swift */,
|
||||||
9F2A540629699698009B2D7C /* SupportAppView.swift */,
|
9F2A540629699698009B2D7C /* SupportAppView.swift */,
|
||||||
9F2A5410296A1429009B2D7C /* PushNotificationsView.swift */,
|
9F2A5410296A1429009B2D7C /* PushNotificationsView.swift */,
|
||||||
|
C9B22676297F6C2E001F9EFE /* ContentSettingsView.swift */,
|
||||||
);
|
);
|
||||||
path = Settings;
|
path = Settings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -586,6 +589,7 @@
|
||||||
files = (
|
files = (
|
||||||
9FE151A6293C90F900E9683D /* IconSelectorView.swift in Sources */,
|
9FE151A6293C90F900E9683D /* IconSelectorView.swift in Sources */,
|
||||||
9F2B92FC295DA94500DE16D0 /* InstanceInfoView.swift in Sources */,
|
9F2B92FC295DA94500DE16D0 /* InstanceInfoView.swift in Sources */,
|
||||||
|
C9B22677297F6C2E001F9EFE /* ContentSettingsView.swift in Sources */,
|
||||||
9F35DB4C2952005C00B3281A /* MessagesTab.swift in Sources */,
|
9F35DB4C2952005C00B3281A /* MessagesTab.swift in Sources */,
|
||||||
9FAD85CF2975B68900496AB1 /* SideBarView.swift in Sources */,
|
9FAD85CF2975B68900496AB1 /* SideBarView.swift in Sources */,
|
||||||
9FAE4ACB293783B000772766 /* SettingsTab.swift in Sources */,
|
9FAE4ACB293783B000772766 /* SettingsTab.swift in Sources */,
|
||||||
|
|
|
@ -180,7 +180,7 @@ struct IceCubesApp: App {
|
||||||
private var appMenu: some Commands {
|
private var appMenu: some Commands {
|
||||||
CommandGroup(replacing: .newItem) {
|
CommandGroup(replacing: .newItem) {
|
||||||
Button("New post") {
|
Button("New post") {
|
||||||
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.serverPreferences?.postVisibility ?? .pub)
|
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CommandGroup(replacing: .textFormatting) {
|
CommandGroup(replacing: .textFormatting) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct SideBarView<Content: View>: View {
|
||||||
|
|
||||||
private var postButton: some View {
|
private var postButton: some View {
|
||||||
Button {
|
Button {
|
||||||
routerPath.presentedSheet = .newStatusEditor(visibility: userPreferences.serverPreferences?.postVisibility ?? .pub)
|
routerPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "square.and.pencil")
|
Image(systemName: "square.and.pencil")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct ExploreTab: View {
|
||||||
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
|
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
statusEditorToolbarItem(routerPath: routerPath,
|
statusEditorToolbarItem(routerPath: routerPath,
|
||||||
visibility: preferences.serverPreferences?.postVisibility ?? .pub)
|
visibility: preferences.postVisibility)
|
||||||
if UIDevice.current.userInterfaceIdiom != .pad {
|
if UIDevice.current.userInterfaceIdiom != .pad {
|
||||||
ToolbarItem(placement: .navigationBarLeading) {
|
ToolbarItem(placement: .navigationBarLeading) {
|
||||||
AppAccountsSelectorView(routerPath: routerPath)
|
AppAccountsSelectorView(routerPath: routerPath)
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct NotificationsTab: View {
|
||||||
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
|
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
statusEditorToolbarItem(routerPath: routerPath,
|
statusEditorToolbarItem(routerPath: routerPath,
|
||||||
visibility: userPreferences.serverPreferences?.postVisibility ?? .pub)
|
visibility: userPreferences.postVisibility)
|
||||||
if UIDevice.current.userInterfaceIdiom != .pad {
|
if UIDevice.current.userInterfaceIdiom != .pad {
|
||||||
ToolbarItem(placement: .navigationBarLeading) {
|
ToolbarItem(placement: .navigationBarLeading) {
|
||||||
AppAccountsSelectorView(routerPath: routerPath)
|
AppAccountsSelectorView(routerPath: routerPath)
|
||||||
|
|
75
IceCubesApp/App/Tabs/Settings/ContentSettingsView.swift
Normal file
75
IceCubesApp/App/Tabs/Settings/ContentSettingsView.swift
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Form {
|
||||||
|
Section {
|
||||||
|
Toggle(isOn: $userPreferences.useInstanceContentSettings) {
|
||||||
|
Text("settings.content.use-instance-settings")
|
||||||
|
}
|
||||||
|
} footer: {
|
||||||
|
Text("settings.content.main-toggle.description")
|
||||||
|
}
|
||||||
|
.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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Section("settings.content.reading") {
|
||||||
|
Toggle(isOn: $userPreferences.appAutoExpandSpoilers) {
|
||||||
|
Text("settings.content.expand-spoilers")
|
||||||
|
}
|
||||||
|
.disabled(userPreferences.useInstanceContentSettings)
|
||||||
|
|
||||||
|
Picker("settings.content.expand-media", selection: $userPreferences.appAutoExpandMedia) {
|
||||||
|
ForEach(ServerPreferences.AutoExpandMedia.allCases, id: \.rawValue) { media in
|
||||||
|
Text(media.description).tag(media)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.disabled(userPreferences.useInstanceContentSettings)
|
||||||
|
}.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
Toggle(isOn: $userPreferences.appDefaultPostsSensitive) {
|
||||||
|
Text("settings.content.default-sensitive")
|
||||||
|
}
|
||||||
|
.disabled(userPreferences.useInstanceContentSettings)
|
||||||
|
|
||||||
|
}
|
||||||
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
|
||||||
|
}
|
||||||
|
.navigationTitle("settings.content.navigation-title")
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.background(theme.secondaryBackgroundColor)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -94,6 +94,9 @@ struct SettingsTabs: View {
|
||||||
NavigationLink(destination: remoteLocalTimelinesView) {
|
NavigationLink(destination: remoteLocalTimelinesView) {
|
||||||
Label("settings.general.remote-timelines", systemImage: "dot.radiowaves.right")
|
Label("settings.general.remote-timelines", systemImage: "dot.radiowaves.right")
|
||||||
}
|
}
|
||||||
|
NavigationLink(destination: ContentSettingsView()) {
|
||||||
|
Label("settings.general.content", systemImage: "rectangle.fill.on.rectangle.fill")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ struct TimelineTab: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statusEditorToolbarItem(routerPath: routerPath,
|
statusEditorToolbarItem(routerPath: routerPath,
|
||||||
visibility: preferences.serverPreferences?.postVisibility ?? .pub)
|
visibility: preferences.postVisibility)
|
||||||
} else {
|
} else {
|
||||||
ToolbarItem(placement: .navigationBarTrailing) {
|
ToolbarItem(placement: .navigationBarTrailing) {
|
||||||
addAccountButton
|
addAccountButton
|
||||||
|
|
|
@ -103,6 +103,16 @@
|
||||||
"settings.section.other" = "Other";
|
"settings.section.other" = "Other";
|
||||||
"settings.other.hide-openai" = "Enable 🤖 helper";
|
"settings.other.hide-openai" = "Enable 🤖 helper";
|
||||||
"settings.other.social-keyboard" = "Enable Social Keyboard";
|
"settings.other.social-keyboard" = "Enable Social Keyboard";
|
||||||
|
"settings.general.content" = "Content Settings";
|
||||||
|
"settings.content.navigation-title" = "Content Settings";
|
||||||
|
"settings.content.use-instance-settings" = "Use server settings";
|
||||||
|
"settings.content.main-toggle.description" = "Use the settings from your home Instance";
|
||||||
|
"settings.content.expand-spoilers" = "Always show sensitive posts";
|
||||||
|
"settings.content.expand-media" = "Media display";
|
||||||
|
"settings.content.default-sensitive" = "Always mark media as sensitive";
|
||||||
|
"settings.content.default-visibility" = "Posting visibilty";
|
||||||
|
"settings.content.reading" = "Reading";
|
||||||
|
"settings.content.posting" = "Posting";
|
||||||
|
|
||||||
// MARK: Tabs
|
// MARK: Tabs
|
||||||
"tab.explore" = "Entdecken";
|
"tab.explore" = "Entdecken";
|
||||||
|
|
|
@ -79,6 +79,19 @@
|
||||||
"settings.push.navigation-title" = "Push Notifications";
|
"settings.push.navigation-title" = "Push Notifications";
|
||||||
"settings.push.new-posts" = "New Posts";
|
"settings.push.new-posts" = "New Posts";
|
||||||
"settings.push.polls" = "Poll Results";
|
"settings.push.polls" = "Poll Results";
|
||||||
|
"settings.general.content" = "Content Settings";
|
||||||
|
"settings.content.navigation-title" = "Content Settings";
|
||||||
|
"settings.content.use-instance-settings" = "Use server settings";
|
||||||
|
"settings.content.main-toggle.description" = "Use the settings from your home Instance";
|
||||||
|
"settings.content.expand-spoilers" = "Always show sensitive posts";
|
||||||
|
"settings.content.expand-media" = "Media display";
|
||||||
|
"settings.content.default-sensitive" = "Always mark media as sensitive";
|
||||||
|
"settings.content.default-visibility" = "Posting visibilty";
|
||||||
|
"settings.content.reading" = "Reading";
|
||||||
|
"settings.content.posting" = "Posting";
|
||||||
|
"enum.expand-media.show" = "Show All";
|
||||||
|
"enum.expand-media.hide" = "Hide All";
|
||||||
|
"enum.expand-media.hide-sensitive" = "Hide Sensitive";
|
||||||
"settings.section.accounts" = "Accounts";
|
"settings.section.accounts" = "Accounts";
|
||||||
"settings.section.app" = "App";
|
"settings.section.app" = "App";
|
||||||
"settings.section.app.footer %@" = "App Version: %@";
|
"settings.section.app.footer %@" = "App Version: %@";
|
||||||
|
|
|
@ -103,6 +103,16 @@
|
||||||
"settings.section.other" = "Other";
|
"settings.section.other" = "Other";
|
||||||
"settings.other.hide-openai" = "Enable 🤖 helper";
|
"settings.other.hide-openai" = "Enable 🤖 helper";
|
||||||
"settings.other.social-keyboard" = "Enable Social Keyboard";
|
"settings.other.social-keyboard" = "Enable Social Keyboard";
|
||||||
|
"settings.general.content" = "Content Settings";
|
||||||
|
"settings.content.navigation-title" = "Content Settings";
|
||||||
|
"settings.content.use-instance-settings" = "Use server settings";
|
||||||
|
"settings.content.main-toggle.description" = "Use the settings from your home Instance";
|
||||||
|
"settings.content.expand-spoilers" = "Always show sensitive posts";
|
||||||
|
"settings.content.expand-media" = "Media display";
|
||||||
|
"settings.content.default-sensitive" = "Always mark media as sensitive";
|
||||||
|
"settings.content.default-visibility" = "Posting visibilty";
|
||||||
|
"settings.content.reading" = "Reading";
|
||||||
|
"settings.content.posting" = "Posting";
|
||||||
|
|
||||||
// MARK: Tabs
|
// MARK: Tabs
|
||||||
"tab.explore" = "Explorar";
|
"tab.explore" = "Explorar";
|
||||||
|
|
|
@ -103,6 +103,16 @@
|
||||||
"settings.section.other" = "Other";
|
"settings.section.other" = "Other";
|
||||||
"settings.other.hide-openai" = "Enable 🤖 helper";
|
"settings.other.hide-openai" = "Enable 🤖 helper";
|
||||||
"settings.other.social-keyboard" = "Enable Social Keyboard";
|
"settings.other.social-keyboard" = "Enable Social Keyboard";
|
||||||
|
"settings.general.content" = "Content Settings";
|
||||||
|
"settings.content.navigation-title" = "Content Settings";
|
||||||
|
"settings.content.use-instance-settings" = "Use server settings";
|
||||||
|
"settings.content.main-toggle.description" = "Use the settings from your home Instance";
|
||||||
|
"settings.content.expand-spoilers" = "Always show sensitive posts";
|
||||||
|
"settings.content.expand-media" = "Media display";
|
||||||
|
"settings.content.default-sensitive" = "Always mark media as sensitive";
|
||||||
|
"settings.content.default-visibility" = "Posting visibilty";
|
||||||
|
"settings.content.reading" = "Reading";
|
||||||
|
"settings.content.posting" = "Posting";
|
||||||
|
|
||||||
// MARK: Tabs
|
// MARK: Tabs
|
||||||
"tab.explore" = "Esplora";
|
"tab.explore" = "Esplora";
|
||||||
|
|
|
@ -320,3 +320,13 @@
|
||||||
"status.visibility.follower" = "フォロワー";
|
"status.visibility.follower" = "フォロワー";
|
||||||
"status.visibility.public" = "全員";
|
"status.visibility.public" = "全員";
|
||||||
"status.visibility.unlisted" = "リスト外";
|
"status.visibility.unlisted" = "リスト外";
|
||||||
|
"settings.general.content" = "Content Settings";
|
||||||
|
"settings.content.navigation-title" = "Content Settings";
|
||||||
|
"settings.content.use-instance-settings" = "Use server settings";
|
||||||
|
"settings.content.main-toggle.description" = "Use the settings from your home Instance";
|
||||||
|
"settings.content.expand-spoilers" = "Always show sensitive posts";
|
||||||
|
"settings.content.expand-media" = "Media display";
|
||||||
|
"settings.content.default-sensitive" = "Always mark media as sensitive";
|
||||||
|
"settings.content.default-visibility" = "Posting visibilty";
|
||||||
|
"settings.content.reading" = "Reading";
|
||||||
|
"settings.content.posting" = "Posting";
|
||||||
|
|
|
@ -103,6 +103,16 @@
|
||||||
"settings.section.other" = "Overig";
|
"settings.section.other" = "Overig";
|
||||||
"settings.other.hide-openai" = "Schakel 🤖 hulp in";
|
"settings.other.hide-openai" = "Schakel 🤖 hulp in";
|
||||||
"settings.other.social-keyboard" = "Enable Social Keyboard";
|
"settings.other.social-keyboard" = "Enable Social Keyboard";
|
||||||
|
"settings.general.content" = "Content Settings";
|
||||||
|
"settings.content.navigation-title" = "Content Settings";
|
||||||
|
"settings.content.use-instance-settings" = "Use server settings";
|
||||||
|
"settings.content.main-toggle.description" = "Use the settings from your home Instance";
|
||||||
|
"settings.content.expand-spoilers" = "Always show sensitive posts";
|
||||||
|
"settings.content.expand-media" = "Media display";
|
||||||
|
"settings.content.default-sensitive" = "Always mark media as sensitive";
|
||||||
|
"settings.content.default-visibility" = "Posting visibilty";
|
||||||
|
"settings.content.reading" = "Reading";
|
||||||
|
"settings.content.posting" = "Posting";
|
||||||
|
|
||||||
// MARK: Tabs
|
// MARK: Tabs
|
||||||
"tab.explore" = "Ontdekken";
|
"tab.explore" = "Ontdekken";
|
||||||
|
|
|
@ -104,6 +104,17 @@
|
||||||
"settings.other.hide-openai" = "启用写作助手 🤖";
|
"settings.other.hide-openai" = "启用写作助手 🤖";
|
||||||
"settings.other.social-keyboard" = "启用社交键盘";
|
"settings.other.social-keyboard" = "启用社交键盘";
|
||||||
|
|
||||||
|
"settings.general.content" = "Content Settings";
|
||||||
|
"settings.content.navigation-title" = "Content Settings";
|
||||||
|
"settings.content.use-instance-settings" = "Use server settings";
|
||||||
|
"settings.content.main-toggle.description" = "Use the settings from your home Instance";
|
||||||
|
"settings.content.expand-spoilers" = "Always show sensitive posts";
|
||||||
|
"settings.content.expand-media" = "Media display";
|
||||||
|
"settings.content.default-sensitive" = "Always mark media as sensitive";
|
||||||
|
"settings.content.default-visibility" = "Posting visibilty";
|
||||||
|
"settings.content.reading" = "Reading";
|
||||||
|
"settings.content.posting" = "Posting";
|
||||||
|
|
||||||
// MARK: Tabs
|
// MARK: Tabs
|
||||||
"tab.explore" = "探索";
|
"tab.explore" = "探索";
|
||||||
"tab.federated" = "跨站";
|
"tab.federated" = "跨站";
|
||||||
|
|
|
@ -359,7 +359,7 @@ public struct AccountDetailView: View {
|
||||||
if !viewModel.isCurrentUser {
|
if !viewModel.isCurrentUser {
|
||||||
Button {
|
Button {
|
||||||
routerPath.presentedSheet = .mentionStatusEditor(account: account,
|
routerPath.presentedSheet = .mentionStatusEditor(account: account,
|
||||||
visibility: preferences.serverPreferences?.postVisibility ?? .pub)
|
visibility: preferences.postVisibility)
|
||||||
} label: {
|
} label: {
|
||||||
Label("account.action.mention", systemImage: "at")
|
Label("account.action.mention", systemImage: "at")
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,62 @@ public class UserPreferences: ObservableObject {
|
||||||
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1
|
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1
|
||||||
@AppStorage("show_translate_button_inline") public var showTranslateButton: Bool = true
|
@AppStorage("show_translate_button_inline") public var showTranslateButton: Bool = true
|
||||||
@AppStorage("is_open_ai_enabled") public var isOpenAIEnabled: Bool = true
|
@AppStorage("is_open_ai_enabled") public var isOpenAIEnabled: Bool = true
|
||||||
|
|
||||||
@AppStorage("recently_used_languages") public var recentlyUsedLanguages: [String] = []
|
@AppStorage("recently_used_languages") public var recentlyUsedLanguages: [String] = []
|
||||||
@AppStorage("social_keyboard_composer") public var isSocialKeyboardEnabled: Bool = true
|
@AppStorage("social_keyboard_composer") public var isSocialKeyboardEnabled: Bool = true
|
||||||
|
|
||||||
|
@AppStorage("use_instance_content_settings") public var useInstanceContentSettings: Bool = true
|
||||||
|
@AppStorage("app_auto_expand_spoilers") public var appAutoExpandSpoilers = false
|
||||||
|
@AppStorage("app_auto_expand_media") public var appAutoExpandMedia:ServerPreferences.AutoExpandMedia = .hideSensitive
|
||||||
|
@AppStorage("app_default_post_visibility") public var appDefaultPostVisibility:Models.Visibility = .pub
|
||||||
|
@AppStorage("app_default_posts_sensitive") public var appDefaultPostsSensitive = false
|
||||||
|
|
||||||
|
|
||||||
|
public var postVisibility:Models.Visibility {
|
||||||
|
get{
|
||||||
|
if useInstanceContentSettings {
|
||||||
|
return serverPreferences?.postVisibility ?? .pub
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return appDefaultPostVisibility
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var postIsSensitive:Bool {
|
||||||
|
get {
|
||||||
|
if useInstanceContentSettings {
|
||||||
|
return serverPreferences?.postIsSensitive ?? false
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return appDefaultPostsSensitive
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public var autoExpandSpoilers: Bool {
|
||||||
|
get {
|
||||||
|
if useInstanceContentSettings {
|
||||||
|
return serverPreferences?.autoExpandSpoilers ?? true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return appAutoExpandSpoilers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var autoExpandMedia: ServerPreferences.AutoExpandMedia {
|
||||||
|
get {
|
||||||
|
if useInstanceContentSettings {
|
||||||
|
return serverPreferences?.autoExpandMedia ?? .hideSensitive
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return appAutoExpandMedia
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public var pushNotificationsCount: Int {
|
public var pushNotificationsCount: Int {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
public struct ServerPreferences: Decodable {
|
public struct ServerPreferences: Decodable {
|
||||||
public let postVisibility: Visibility?
|
public let postVisibility: Visibility?
|
||||||
|
@ -7,10 +8,21 @@ public struct ServerPreferences: Decodable {
|
||||||
public let autoExpandMedia: AutoExpandMedia?
|
public let autoExpandMedia: AutoExpandMedia?
|
||||||
public let autoExpandSpoilers: Bool?
|
public let autoExpandSpoilers: Bool?
|
||||||
|
|
||||||
public enum AutoExpandMedia: String, Decodable {
|
public enum AutoExpandMedia: String, Decodable, CaseIterable {
|
||||||
case showAll = "show_all"
|
case showAll = "show_all"
|
||||||
case hideAll = "hide_all"
|
case hideAll = "hide_all"
|
||||||
case hideSensitive = "default"
|
case hideSensitive = "default"
|
||||||
|
|
||||||
|
public var description: LocalizedStringKey {
|
||||||
|
switch self {
|
||||||
|
case .showAll:
|
||||||
|
return "enum.expand-media.show"
|
||||||
|
case .hideAll:
|
||||||
|
return "enum.expand-media.hide"
|
||||||
|
case .hideSensitive:
|
||||||
|
return "enum.expand-media.hide-sensitive"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
|
|
|
@ -126,9 +126,9 @@ public struct StatusMediaPreviewView: View {
|
||||||
Text(altTextDisplayed ?? "")
|
Text(altTextDisplayed ?? "")
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
if sensitive && preferences.serverPreferences?.autoExpandMedia == .hideSensitive {
|
if sensitive && preferences.autoExpandMedia == .hideSensitive {
|
||||||
isHidingMedia = true
|
isHidingMedia = true
|
||||||
} else if preferences.serverPreferences?.autoExpandMedia == .hideAll {
|
} else if preferences.autoExpandMedia == .hideAll {
|
||||||
isHidingMedia = true
|
isHidingMedia = true
|
||||||
} else {
|
} else {
|
||||||
isHidingMedia = false
|
isHidingMedia = false
|
||||||
|
|
|
@ -70,7 +70,7 @@ public struct StatusRowView: View {
|
||||||
await viewModel.loadEmbeddedStatus()
|
await viewModel.loadEmbeddedStatus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if preferences.serverPreferences?.autoExpandSpoilers == true {
|
if preferences.autoExpandSpoilers == true {
|
||||||
viewModel.displaySpoiler = false
|
viewModel.displaySpoiler = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue