Support server side default post visibility

This commit is contained in:
Thomas Ricouard 2023-01-09 20:46:01 +01:00
parent dc223171b3
commit 2961793e87
4 changed files with 10 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import Env
import Network
struct ExploreTab: View {
@EnvironmentObject private var preferences: UserPreferences
@EnvironmentObject private var currentAccount: CurrentAccount
@EnvironmentObject private var client: Client
@StateObject private var routeurPath = RouterPath()
@ -18,7 +19,8 @@ struct ExploreTab: View {
.withAppRouteur()
.withSheetDestinations(sheetDestinations: $routeurPath.presentedSheet)
.toolbar {
statusEditorToolbarItem(routeurPath: routeurPath, visibility: .pub)
statusEditorToolbarItem(routeurPath: routeurPath,
visibility: preferences.serverPreferences?.postVisibility ?? .pub)
ToolbarItem(placement: .navigationBarLeading) {
AppAccountsSelectorView(routeurPath: routeurPath)
}

View File

@ -18,7 +18,8 @@ struct NotificationsTab: View {
.withAppRouteur()
.withSheetDestinations(sheetDestinations: $routeurPath.presentedSheet)
.toolbar {
statusEditorToolbarItem(routeurPath: routeurPath, visibility: .pub)
statusEditorToolbarItem(routeurPath: routeurPath,
visibility: userPreferences.serverPreferences?.postVisibility ?? .pub)
ToolbarItem(placement: .navigationBarLeading) {
AppAccountsSelectorView(routeurPath: routeurPath)
}

View File

@ -127,7 +127,8 @@ struct TimelineTab: View {
ToolbarItem(placement: .navigationBarLeading) {
AppAccountsSelectorView(routeurPath: routeurPath)
}
statusEditorToolbarItem(routeurPath: routeurPath, visibility: .pub)
statusEditorToolbarItem(routeurPath: routeurPath,
visibility: preferences.serverPreferences?.postVisibility ?? .pub)
} else {
ToolbarItem(placement: .navigationBarTrailing) {
addAccountButton

View File

@ -10,6 +10,7 @@ public struct AccountDetailView: View {
@Environment(\.redactionReasons) private var reasons
@EnvironmentObject private var watcher: StreamWatcher
@EnvironmentObject private var currentAccount: CurrentAccount
@EnvironmentObject private var preferences: UserPreferences
@EnvironmentObject private var theme: Theme
@EnvironmentObject private var client: Client
@EnvironmentObject private var routeurPath: RouterPath
@ -334,7 +335,8 @@ public struct AccountDetailView: View {
Section(account.acct) {
if !viewModel.isCurrentUser {
Button {
routeurPath.presentedSheet = .mentionStatusEditor(account: account, visibility: .pub)
routeurPath.presentedSheet = .mentionStatusEditor(account: account,
visibility: preferences.serverPreferences?.postVisibility ?? .pub)
} label: {
Label("Mention", systemImage: "at")
}