This commit is contained in:
Thomas Ricouard 2023-12-19 09:48:12 +01:00
parent 8c64e023b7
commit ee83f524bd
26 changed files with 231 additions and 23 deletions

View file

@ -97,7 +97,7 @@ extension View {
.preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light) .preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light)
case .accountPushNotficationsSettings: case .accountPushNotficationsSettings:
if let subscription = PushNotificationsService.shared.subscriptions.first(where: { $0.account.token == AppAccountsManager.shared.currentAccount.oauthToken }) { if let subscription = PushNotificationsService.shared.subscriptions.first(where: { $0.account.token == AppAccountsManager.shared.currentAccount.oauthToken }) {
PushNotificationsView(subscription: subscription) PushNotificationsViewWrapper(subscription: subscription)
} else { } else {
EmptyView() EmptyView()
} }

View file

@ -57,7 +57,9 @@ struct AboutView: View {
} footer: { } footer: {
Text("\(versionNumber)©2023 Thomas Ricouard") Text("\(versionNumber)©2023 Thomas Ricouard")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
followAccountsSection followAccountsSection
@ -94,7 +96,9 @@ struct AboutView: View {
Text("settings.about.built-with") Text("settings.about.built-with")
.textCase(nil) .textCase(nil)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.task { .task {
await fetchAccounts() await fetchAccounts()
@ -118,12 +122,16 @@ struct AboutView: View {
AccountsListRow(viewModel: iceCubesAccount) AccountsListRow(viewModel: iceCubesAccount)
AccountsListRow(viewModel: dimillianAccount) AccountsListRow(viewModel: dimillianAccount)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} else { } else {
Section { Section {
ProgressView() ProgressView()
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }

View file

@ -53,7 +53,9 @@ struct AddAccountView: View {
NavigationStack { NavigationStack {
Form { Form {
TextField("instance.url", text: $instanceName) TextField("instance.url", text: $instanceName)
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
.keyboardType(.URL) .keyboardType(.URL)
.textContentType(.URL) .textContentType(.URL)
.textInputAutocapitalization(.never) .textInputAutocapitalization(.never)
@ -166,7 +168,9 @@ struct AddAccountView: View {
} }
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
} }
#if !os(visionOS)
.listRowBackground(theme.tintColor) .listRowBackground(theme.tintColor)
#endif
} }
private var instancesListView: some View { private var instancesListView: some View {
@ -212,11 +216,13 @@ struct AddAccountView: View {
.padding(10) .padding(10)
} }
} }
#if !os(visionOS)
.background(theme.primaryBackgroundColor) .background(theme.primaryBackgroundColor)
.listRowBackground(Color.clear) .listRowBackground(Color.clear)
.listRowInsets(EdgeInsets(top: 10, leading: 0, bottom: 10, trailing: 0)) .listRowInsets(EdgeInsets(top: 10, leading: 0, bottom: 10, trailing: 0))
.listRowSeparator(.hidden) .listRowSeparator(.hidden)
.clipShape(RoundedRectangle(cornerRadius: 5)) .clipShape(RoundedRectangle(cornerRadius: 5))
#endif
.overlay { .overlay {
RoundedRectangle(cornerRadius: 5) RoundedRectangle(cornerRadius: 5)
.stroke(lineWidth: 1) .stroke(lineWidth: 1)
@ -251,7 +257,9 @@ struct AddAccountView: View {
.redacted(reason: .placeholder) .redacted(reason: .placeholder)
.allowsHitTesting(false) .allowsHitTesting(false)
.shimmering() .shimmering()
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private func signIn() async { private func signIn() async {

View file

@ -19,7 +19,10 @@ struct ContentSettingsView: View {
Toggle(isOn: $userPreferences.suppressDupeReblogs) { Toggle(isOn: $userPreferences.suppressDupeReblogs) {
Text("settings.content.hide-repeated-boosts") Text("settings.content.hide-repeated-boosts")
} }
}.listRowBackground(theme.primaryBackgroundColor) }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor)
#endif
Section("settings.content.media") { Section("settings.content.media") {
Toggle(isOn: $userPreferences.autoPlayVideo) { Toggle(isOn: $userPreferences.autoPlayVideo) {
@ -28,7 +31,10 @@ struct ContentSettingsView: View {
Toggle(isOn: $userPreferences.showAltTextForMedia) { Toggle(isOn: $userPreferences.showAltTextForMedia) {
Text("settings.content.media.show.alt") Text("settings.content.media.show.alt")
} }
}.listRowBackground(theme.primaryBackgroundColor) }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor)
#endif
Section("settings.content.sharing") { Section("settings.content.sharing") {
Picker("settings.content.sharing.share-button-behavior", selection: $userPreferences.shareButtonBehavior) { Picker("settings.content.sharing.share-button-behavior", selection: $userPreferences.shareButtonBehavior) {
@ -38,14 +44,18 @@ struct ContentSettingsView: View {
} }
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
Section("settings.content.instance-settings") { Section("settings.content.instance-settings") {
Toggle(isOn: $userPreferences.useInstanceContentSettings) { Toggle(isOn: $userPreferences.useInstanceContentSettings) {
Text("settings.content.use-instance-settings") Text("settings.content.use-instance-settings")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
.onChange(of: userPreferences.useInstanceContentSettings) { _, newVal in .onChange(of: userPreferences.useInstanceContentSettings) { _, newVal in
if newVal { if newVal {
userPreferences.appAutoExpandSpoilers = userPreferences.autoExpandSpoilers userPreferences.appAutoExpandSpoilers = userPreferences.autoExpandSpoilers
@ -76,7 +86,9 @@ struct ContentSettingsView: View {
} footer: { } footer: {
Text("settings.content.collapse-long-posts-hint") Text("settings.content.collapse-long-posts-hint")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
Section("settings.content.posting") { Section("settings.content.posting") {
Picker("settings.content.default-visibility", selection: $userPreferences.appDefaultPostVisibility) { Picker("settings.content.default-visibility", selection: $userPreferences.appDefaultPostVisibility) {
@ -104,8 +116,9 @@ struct ContentSettingsView: View {
} }
.disabled(userPreferences.useInstanceContentSettings) .disabled(userPreferences.useInstanceContentSettings)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.navigationTitle("settings.content.navigation-title") .navigationTitle("settings.content.navigation-title")
#if !os(visionOS) #if !os(visionOS)

View file

@ -46,8 +46,10 @@ struct DisplaySettingsView: View {
resetSection resetSection
} }
.navigationTitle("settings.display.navigation-title") .navigationTitle("settings.display.navigation-title")
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.task(id: localValues.tintColor) { .task(id: localValues.tintColor) {
do { try await Task.sleep(for: .microseconds(500)) } catch {} do { try await Task.sleep(for: .microseconds(500)) } catch {}
theme.tintColor = localValues.tintColor theme.tintColor = localValues.tintColor
@ -121,7 +123,9 @@ struct DisplaySettingsView: View {
Text("settings.display.section.theme.footer") Text("settings.display.section.theme.footer")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var fontSection: some View { private var fontSection: some View {
@ -173,7 +177,9 @@ struct DisplaySettingsView: View {
d[.leading] d[.leading]
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
@ViewBuilder @ViewBuilder
@ -222,7 +228,9 @@ struct DisplaySettingsView: View {
} }
Toggle("settings.display.show-account-popover", isOn: $userPreferences.showAccountPopover) Toggle("settings.display.show-account-popover", isOn: $userPreferences.showAccountPopover)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
@ViewBuilder @ViewBuilder
@ -232,14 +240,18 @@ struct DisplaySettingsView: View {
Section("iPhone") { Section("iPhone") {
Toggle("settings.display.show-tab-label", isOn: $userPreferences.showiPhoneTabLabel) Toggle("settings.display.show-tab-label", isOn: $userPreferences.showiPhoneTabLabel)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
if UIDevice.current.userInterfaceIdiom == .pad { if UIDevice.current.userInterfaceIdiom == .pad {
Section("iPad") { Section("iPad") {
Toggle("settings.display.show-ipad-column", isOn: $userPreferences.showiPadSecondaryColumn) Toggle("settings.display.show-ipad-column", isOn: $userPreferences.showiPadSecondaryColumn)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }
@ -261,7 +273,9 @@ struct DisplaySettingsView: View {
Text("settings.display.restore") Text("settings.display.restore")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var themeSelectorButton: some View { private var themeSelectorButton: some View {

View file

@ -17,10 +17,14 @@ struct HapticSettingsView: View {
Toggle("settings.haptic.tab-selection", isOn: $userPreferences.hapticTabSelectionEnabled) Toggle("settings.haptic.tab-selection", isOn: $userPreferences.hapticTabSelectionEnabled)
Toggle("settings.haptic.buttons", isOn: $userPreferences.hapticButtonPressEnabled) Toggle("settings.haptic.buttons", isOn: $userPreferences.hapticButtonPressEnabled)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.navigationTitle("settings.haptic.navigation-title") .navigationTitle("settings.haptic.navigation-title")
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
} }
} }

View file

@ -85,7 +85,9 @@ struct IconSelectorView: View {
.padding(6) .padding(6)
.navigationTitle("settings.app.icon.navigation-title") .navigationTitle("settings.app.icon.navigation-title")
} }
#if !os(visionOS)
.background(theme.primaryBackgroundColor) .background(theme.primaryBackgroundColor)
#endif
} }
private func makeIconGridView(icons: [Icon]) -> some View { private func makeIconGridView(icons: [Icon]) -> some View {
@ -116,6 +118,7 @@ struct IconSelectorView: View {
} }
} }
} }
.buttonStyle(.plain)
} }
} }
} }

View file

@ -13,8 +13,10 @@ struct InstanceInfoView: View {
InstanceInfoSection(instance: instance) InstanceInfoSection(instance: instance)
} }
.navigationTitle("instance.info.navigation-title") .navigationTitle("instance.info.navigation-title")
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
} }
} }
@ -35,7 +37,9 @@ public struct InstanceInfoSection: View {
LabeledContent("instance.info.posts", value: format(instance.stats.statusCount)) LabeledContent("instance.info.posts", value: format(instance.stats.statusCount))
LabeledContent("instance.info.domains", value: format(instance.stats.domainCount)) LabeledContent("instance.info.domains", value: format(instance.stats.domainCount))
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
if let rules = instance.rules { if let rules = instance.rules {
Section("instance.info.section.rules") { Section("instance.info.section.rules") {
@ -43,7 +47,9 @@ public struct InstanceInfoSection: View {
Text(rule.text.trimmingCharacters(in: .whitespacesAndNewlines)) Text(rule.text.trimmingCharacters(in: .whitespacesAndNewlines))
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }

View file

@ -7,6 +7,27 @@ import NukeUI
import SwiftUI import SwiftUI
import UserNotifications import UserNotifications
struct PushNotificationsViewWrapper: View {
@Environment(\.dismiss) private var dismiss
public let subscription: PushNotificationSubscriptionSettings
var body: some View {
NavigationStack {
PushNotificationsView(subscription: subscription)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button {
dismiss()
} label: {
Image(systemName: "xmark.circle")
}
}
}
}
}
}
@MainActor @MainActor
struct PushNotificationsView: View { struct PushNotificationsView: View {
@Environment(Theme.self) private var theme @Environment(Theme.self) private var theme
@ -33,7 +54,9 @@ struct PushNotificationsView: View {
} footer: { } footer: {
Text("settings.push.main-toggle.description") Text("settings.push.main-toggle.description")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
if subscription.isEnabled { if subscription.isEnabled {
Section { Section {
@ -86,7 +109,9 @@ struct PushNotificationsView: View {
Label("settings.push.new-posts", systemImage: "bubble.right") Label("settings.push.new-posts", systemImage: "bubble.right")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
Section { Section {
@ -101,11 +126,15 @@ struct PushNotificationsView: View {
} footer: { } footer: {
Text("settings.push.duplicate.footer") Text("settings.push.duplicate.footer")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.navigationTitle("settings.push.navigation-title") .navigationTitle("settings.push.navigation-title")
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.task { .task {
await subscription.fetchSubscription() await subscription.fetchSubscription()
} }

View file

@ -45,7 +45,9 @@ struct SettingsTabs: View {
cacheSection cacheSection
} }
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
#if !os(visionOS)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.navigationTitle(Text("settings.title")) .navigationTitle(Text("settings.title"))
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
@ -114,7 +116,9 @@ struct SettingsTabs: View {
} }
addAccountButton addAccountButton
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private func logoutAccount(account: AppAccount) async { private func logoutAccount(account: AppAccount) async {
@ -166,7 +170,9 @@ struct SettingsTabs: View {
.tint(theme.labelColor) .tint(theme.labelColor)
#endif #endif
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
@ViewBuilder @ViewBuilder
@ -204,12 +210,14 @@ struct SettingsTabs: View {
Label("settings.other.fast-refresh", systemImage: "arrow.clockwise") Label("settings.other.fast-refresh", systemImage: "arrow.clockwise")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var appSection: some View { private var appSection: some View {
Section { Section {
#if !targetEnvironment(macCatalyst) #if !targetEnvironment(macCatalyst) && !os(visionOS)
NavigationLink(destination: IconSelectorView()) { NavigationLink(destination: IconSelectorView()) {
Label { Label {
Text("settings.app.icon") Text("settings.app.icon")
@ -252,7 +260,9 @@ struct SettingsTabs: View {
Text("settings.section.app.footer \(appVersion)").frame(maxWidth: .infinity, alignment: .center) Text("settings.section.app.footer \(appVersion)").frame(maxWidth: .infinity, alignment: .center)
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var addAccountButton: some View { private var addAccountButton: some View {
@ -293,18 +303,24 @@ struct SettingsTabs: View {
context.delete(tagGroups[index]) context.delete(tagGroups[index])
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
Button { Button {
routerPath.presentedSheet = .addTagGroup routerPath.presentedSheet = .addTagGroup
} label: { } label: {
Label("timeline.filter.add-tag-groups", systemImage: "plus") Label("timeline.filter.add-tag-groups", systemImage: "plus")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.navigationTitle("timeline.filter.tag-groups") .navigationTitle("timeline.filter.tag-groups")
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
#if !os(visionOS)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.toolbar { .toolbar {
EditButton() EditButton()
} }
@ -319,17 +335,23 @@ struct SettingsTabs: View {
context.delete(localTimelines[index]) context.delete(localTimelines[index])
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
Button { Button {
routerPath.presentedSheet = .addRemoteLocalTimeline routerPath.presentedSheet = .addRemoteLocalTimeline
} label: { } label: {
Label("settings.timeline.add", systemImage: "badge.plus.radiowaves.right") Label("settings.timeline.add", systemImage: "badge.plus.radiowaves.right")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.navigationTitle("settings.general.remote-timelines") .navigationTitle("settings.general.remote-timelines")
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
#if !os(visionOS)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.toolbar { .toolbar {
EditButton() EditButton()
} }
@ -349,6 +371,8 @@ struct SettingsTabs: View {
} }
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }

View file

@ -69,8 +69,10 @@ struct SupportAppView: View {
linksSection linksSection
} }
.navigationTitle("settings.support.navigation-title") .navigationTitle("settings.support.navigation-title")
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.alert("settings.support.alert.title", isPresented: $purchaseSuccessDisplayed, actions: { .alert("settings.support.alert.title", isPresented: $purchaseSuccessDisplayed, actions: {
Button { purchaseSuccessDisplayed = false } label: { Text("alert.button.ok") } Button { purchaseSuccessDisplayed = false } label: { Text("alert.button.ok") }
}, message: { }, message: {
@ -151,7 +153,9 @@ struct SupportAppView: View {
Text("settings.support.message-from-dev") Text("settings.support.message-from-dev")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var subscriptionSection: some View { private var subscriptionSection: some View {
@ -188,7 +192,9 @@ struct SupportAppView: View {
Text("settings.support.supporter.subscription-info") Text("settings.support.supporter.subscription-info")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var tipsSection: some View { private var tipsSection: some View {
@ -213,7 +219,9 @@ struct SupportAppView: View {
} }
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var restorePurchase: some View { private var restorePurchase: some View {
@ -232,7 +240,9 @@ struct SupportAppView: View {
} footer: { } footer: {
Text("settings.support.restore-purchase.explanation") Text("settings.support.restore-purchase.explanation")
} }
#if !os(visionOS)
.listRowBackground(theme.secondaryBackgroundColor) .listRowBackground(theme.secondaryBackgroundColor)
#endif
} }
private var linksSection: some View { private var linksSection: some View {
@ -252,7 +262,9 @@ struct SupportAppView: View {
.buttonStyle(.borderless) .buttonStyle(.borderless)
} }
} }
#if !os(visionOS)
.listRowBackground(theme.secondaryBackgroundColor) .listRowBackground(theme.secondaryBackgroundColor)
#endif
} }
private var loadingPlaceholder: some View { private var loadingPlaceholder: some View {

View file

@ -46,8 +46,10 @@ struct SwipeActionsSettingsView: View {
} footer: { } footer: {
Text("settings.swipeactions.status.explanation") Text("settings.swipeactions.status.explanation")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
Section { Section {
Picker(selection: $userPreferences.swipeActionsIconStyle, label: Text("settings.swipeactions.icon-style")) { Picker(selection: $userPreferences.swipeActionsIconStyle, label: Text("settings.swipeactions.icon-style")) {
ForEach(UserPreferences.SwipeActionsIconStyle.allCases, id: \.rawValue) { style in ForEach(UserPreferences.SwipeActionsIconStyle.allCases, id: \.rawValue) { style in
@ -62,11 +64,15 @@ struct SwipeActionsSettingsView: View {
} footer: { } footer: {
Text("settings.swipeactions.use-theme-colors-explanation") Text("settings.swipeactions.use-theme-colors-explanation")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.navigationTitle("settings.swipeactions.navigation-title") .navigationTitle("settings.swipeactions.navigation-title")
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
} }
private func createStatusActionPicker(selection: Binding<StatusAction>, label: LocalizedStringKey) -> some View { private func createStatusActionPicker(selection: Binding<StatusAction>, label: LocalizedStringKey) -> some View {

View file

@ -21,8 +21,10 @@ struct TranslationSettingsView: View {
.onAppear { .onAppear {
readValue() readValue()
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
if apiKey.isEmpty { if apiKey.isEmpty {
Section { Section {
Link(destination: URL(string: "https://www.deepl.com/pro-api")!) { Link(destination: URL(string: "https://www.deepl.com/pro-api")!) {
@ -30,14 +32,18 @@ struct TranslationSettingsView: View {
.foregroundColor(.red) .foregroundColor(.red)
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }
autoDetectSection autoDetectSection
} }
.navigationTitle("settings.translation.navigation-title") .navigationTitle("settings.translation.navigation-title")
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.onChange(of: apiKey) { .onChange(of: apiKey) {
writeNewValue() writeNewValue()
} }
@ -50,7 +56,9 @@ struct TranslationSettingsView: View {
Toggle(isOn: $preferences.alwaysUseDeepl) { Toggle(isOn: $preferences.alwaysUseDeepl) {
Text("settings.translation.always-deepl") Text("settings.translation.always-deepl")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
@ViewBuilder @ViewBuilder

View file

@ -21,9 +21,10 @@ enum Tab: Int, Identifiable, Hashable {
static func loggedInTabs() -> [Tab] { static func loggedInTabs() -> [Tab] {
if UIDevice.current.userInterfaceIdiom == .pad || if UIDevice.current.userInterfaceIdiom == .pad ||
UIDevice.current.userInterfaceIdiom == .mac || UIDevice.current.userInterfaceIdiom == .mac {
UIDevice.current.userInterfaceIdiom == .vision {
[.timeline, .trending, .federated, .local, .notifications, .mentions, .explore, .messages, .settings] [.timeline, .trending, .federated, .local, .notifications, .mentions, .explore, .messages, .settings]
} else if UIDevice.current.userInterfaceIdiom == .vision {
[.profile, .timeline, .trending, .federated, .local, .notifications, .mentions, .explore, .messages, .settings]
} else { } else {
[.timeline, .notifications, .explore, .messages, .profile] [.timeline, .notifications, .explore, .messages, .profile]
} }

View file

@ -74,7 +74,9 @@ struct AccountDetailHeaderView: View {
.frame(height: Constants.headerHeight) .frame(height: Constants.headerHeight)
} }
} }
#if !os(visionOS)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.frame(height: Constants.headerHeight) .frame(height: Constants.headerHeight)
.onTapGesture { .onTapGesture {
guard account.haveHeader else { guard account.haveHeader else {
@ -320,7 +322,9 @@ struct AccountDetailHeaderView: View {
Text(note) Text(note)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.padding(8) .padding(8)
#if !os(visionOS)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.cornerRadius(4) .cornerRadius(4)
.overlay( .overlay(
RoundedRectangle(cornerRadius: 4) RoundedRectangle(cornerRadius: 4)
@ -370,7 +374,11 @@ struct AccountDetailHeaderView: View {
.padding(8) .padding(8)
.accessibilityElement(children: .contain) .accessibilityElement(children: .contain)
.accessibilityLabel("accessibility.tabs.profile.fields.container.label") .accessibilityLabel("accessibility.tabs.profile.fields.container.label")
#if os(visionOS)
.background(Material.thick)
#else
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.cornerRadius(4) .cornerRadius(4)
.overlay( .overlay(
RoundedRectangle(cornerRadius: 4) RoundedRectangle(cornerRadius: 4)

View file

@ -84,8 +84,10 @@ public struct AccountDetailView: View {
} }
.environment(\.defaultMinListRowHeight, 1) .environment(\.defaultMinListRowHeight, 1)
.listStyle(.plain) .listStyle(.plain)
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.primaryBackgroundColor) .background(theme.primaryBackgroundColor)
#endif
.onChange(of: scrollToTopSignal) { .onChange(of: scrollToTopSignal) {
withAnimation { withAnimation {
proxy.scrollTo(ScrollToView.Constants.scrollToTop, anchor: .top) proxy.scrollTo(ScrollToView.Constants.scrollToTop, anchor: .top)
@ -216,7 +218,9 @@ public struct AccountDetailView: View {
.padding(.leading, -4) .padding(.leading, -4)
.accessibilityLabel(account.safeDisplayName) .accessibilityLabel(account.safeDisplayName)
}.accessibilityAddTraits(.isImage) }
.accessibilityAddTraits(.isImage)
.buttonStyle(.plain)
} }
} }
.padding(.leading, .layoutPadding + 4) .padding(.leading, .layoutPadding + 4)
@ -235,7 +239,9 @@ public struct AccountDetailView: View {
Spacer() Spacer()
Image(systemName: "chevron.right") Image(systemName: "chevron.right")
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
}.task { }.task {
await currentAccount.fetchFollowedTags() await currentAccount.fetchFollowedTags()
@ -250,7 +256,9 @@ public struct AccountDetailView: View {
.font(.scaledHeadline) .font(.scaledHeadline)
.foregroundColor(theme.labelColor) .foregroundColor(theme.labelColor)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
.contextMenu { .contextMenu {
Button("account.list.delete", role: .destructive) { Button("account.list.delete", role: .destructive) {
Task { Task {
@ -264,7 +272,9 @@ public struct AccountDetailView: View {
} }
.tint(theme.tintColor) .tint(theme.tintColor)
.buttonStyle(.borderless) .buttonStyle(.borderless)
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.task { .task {
await currentAccount.fetchLists() await currentAccount.fetchLists()
@ -284,7 +294,9 @@ public struct AccountDetailView: View {
bottom: 0, bottom: 0,
trailing: .layoutPadding)) trailing: .layoutPadding))
.listRowSeparator(.hidden) .listRowSeparator(.hidden)
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
ForEach(viewModel.pinned) { status in ForEach(viewModel.pinned) { status in
StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath)) StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath))
} }
@ -403,7 +415,9 @@ extension View {
func applyAccountDetailsRowStyle(theme: Theme) -> some View { func applyAccountDetailsRowStyle(theme: Theme) -> some View {
listRowInsets(.init()) listRowInsets(.init())
.listRowSeparator(.hidden) .listRowSeparator(.hidden)
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }

View file

@ -26,7 +26,9 @@ public struct AccountsListView: View {
.redacted(reason: .placeholder) .redacted(reason: .placeholder)
.allowsHitTesting(false) .allowsHitTesting(false)
.shimmering() .shimmering()
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
case let .display(accounts, relationships, nextPageState): case let .display(accounts, relationships, nextPageState):
if case .followers = viewModel.mode, if case .followers = viewModel.mode,
@ -49,7 +51,9 @@ public struct AccountsListView: View {
} }
} }
) )
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }
} }
@ -58,7 +62,9 @@ public struct AccountsListView: View {
if let relationship = relationships.first(where: { $0.id == account.id }) { if let relationship = relationships.first(where: { $0.id == account.id }) {
AccountsListRow(viewModel: .init(account: account, AccountsListRow(viewModel: .init(account: account,
relationShip: relationship)) relationShip: relationship))
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }
} }
@ -66,7 +72,9 @@ public struct AccountsListView: View {
switch nextPageState { switch nextPageState {
case .hasNextPage: case .hasNextPage:
loadingRow loadingRow
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
.onAppear { .onAppear {
Task { Task {
await viewModel.fetchNextPage() await viewModel.fetchNextPage()
@ -75,18 +83,24 @@ public struct AccountsListView: View {
case .loadingNextPage: case .loadingNextPage:
loadingRow loadingRow
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
case .none: case .none:
EmptyView() EmptyView()
} }
case let .error(error): case let .error(error):
Text(error.localizedDescription) Text(error.localizedDescription)
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.primaryBackgroundColor) .background(theme.primaryBackgroundColor)
#endif
.listStyle(.plain) .listStyle(.plain)
.navigationTitle(viewModel.mode.title) .navigationTitle(viewModel.mode.title)
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)

View file

@ -28,9 +28,9 @@ public struct EditAccountView: View {
} }
} }
.environment(\.editMode, .constant(.active)) .environment(\.editMode, .constant(.active))
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#if !os(visionOS)
.scrollDismissesKeyboard(.immediately) .scrollDismissesKeyboard(.immediately)
#endif #endif
.navigationTitle("account.edit.navigation-title") .navigationTitle("account.edit.navigation-title")
@ -58,7 +58,9 @@ public struct EditAccountView: View {
Spacer() Spacer()
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
@ViewBuilder @ViewBuilder
@ -71,7 +73,9 @@ public struct EditAccountView: View {
TextField("account.edit.about", text: $viewModel.note, axis: .vertical) TextField("account.edit.about", text: $viewModel.note, axis: .vertical)
.frame(maxHeight: 150) .frame(maxHeight: 150)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var postSettingsSection: some View { private var postSettingsSection: some View {
@ -91,7 +95,9 @@ public struct EditAccountView: View {
Label("account.edit.post-settings.sensitive", systemImage: "eye") Label("account.edit.post-settings.sensitive", systemImage: "eye")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var accountSection: some View { private var accountSection: some View {
@ -106,7 +112,9 @@ public struct EditAccountView: View {
Label("account.edit.account-settings.discoverable", systemImage: "magnifyingglass") Label("account.edit.account-settings.discoverable", systemImage: "magnifyingglass")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var fieldsSection: some View { private var fieldsSection: some View {
@ -140,7 +148,9 @@ public struct EditAccountView: View {
} }
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
@ToolbarContentBuilder @ToolbarContentBuilder

View file

@ -18,10 +18,14 @@ public struct EditRelationshipNoteView: View {
TextField("account.relation.note.edit.placeholder", text: $viewModel.note, axis: .vertical) TextField("account.relation.note.edit.placeholder", text: $viewModel.note, axis: .vertical)
.frame(minHeight: 150, maxHeight: 150, alignment: .top) .frame(minHeight: 150, maxHeight: 150, alignment: .top)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.navigationTitle("account.relation.note.edit") .navigationTitle("account.relation.note.edit")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { .toolbar {

View file

@ -70,11 +70,11 @@ struct EditFilterView: View {
} }
.navigationTitle(filter?.title ?? NSLocalizedString("filter.new", comment: "")) .navigationTitle(filter?.title ?? NSLocalizedString("filter.new", comment: ""))
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.scrollContentBackground(.hidden)
#if !os(visionOS) #if !os(visionOS)
.scrollContentBackground(.hidden)
.scrollDismissesKeyboard(.interactively) .scrollDismissesKeyboard(.interactively)
#endif
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.onAppear { .onAppear {
if filter == nil { if filter == nil {
focusedField = .title focusedField = .title
@ -106,7 +106,9 @@ struct EditFilterView: View {
.disabled(expirySelection != .custom) .disabled(expirySelection != .custom)
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
@ViewBuilder @ViewBuilder
@ -120,7 +122,9 @@ struct EditFilterView: View {
} }
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
if filter == nil, !title.isEmpty { if filter == nil, !title.isEmpty {
Section { Section {
@ -140,7 +144,9 @@ struct EditFilterView: View {
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.transition(.opacity) .transition(.opacity)
} }
#if !os(visionOS)
.listRowBackground(theme.secondaryBackgroundColor) .listRowBackground(theme.secondaryBackgroundColor)
#endif
} }
} }
@ -194,7 +200,9 @@ struct EditFilterView: View {
} }
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var contextsSection: some View { private var contextsSection: some View {
@ -216,7 +224,9 @@ struct EditFilterView: View {
} }
.disabled(isSavingFilter) .disabled(isSavingFilter)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
} }
@ -237,7 +247,9 @@ struct EditFilterView: View {
} }
.pickerStyle(.inline) .pickerStyle(.inline)
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
private var saveButton: some View { private var saveButton: some View {

View file

@ -54,7 +54,9 @@ public struct FiltersListView: View {
} }
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
Section { Section {
@ -62,15 +64,19 @@ public struct FiltersListView: View {
Label("filter.new", systemImage: "plus") Label("filter.new", systemImage: "plus")
} }
} }
#if !os(visionOS)
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
#endif
} }
.toolbar { .toolbar {
toolbarContent toolbarContent
} }
.navigationTitle("filter.filters") .navigationTitle("filter.filters")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
#endif
.task { .task {
do { do {
isLoading = true isLoading = true

View file

@ -96,11 +96,8 @@ public struct AppAccountsSelectorView: View {
AppAccountView(viewModel: viewModel) AppAccountView(viewModel: viewModel)
} }
} }
#if os(visionOS) #if !os(visionOS)
.listRowBackground(RoundedRectangle(cornerRadius: 8) .listRowBackground(theme.primaryBackgroundColor)
.foregroundStyle(Material.regular))
#else
.listRowBackground(theme.primaryBackgroundColor)
#endif #endif
if accountCreationEnabled { if accountCreationEnabled {
@ -116,11 +113,8 @@ public struct AppAccountsSelectorView: View {
} }
settingsButton settingsButton
} }
#if os(visionOS) #if !os(visionOS)
.listRowBackground(Rectangle() .listRowBackground(theme.primaryBackgroundColor)
.foregroundStyle(Material.regular))
#else
.listRowBackground(theme.primaryBackgroundColor)
#endif #endif
} }
} }

View file

@ -70,8 +70,10 @@ public struct ConversationDetailView: View {
} }
} }
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.primaryBackgroundColor) .background(theme.primaryBackgroundColor)
#endif
.toolbar { .toolbar {
ToolbarItem(placement: .principal) { ToolbarItem(placement: .principal) {
if viewModel.conversation.accounts.count == 1, if viewModel.conversation.accounts.count == 1,

View file

@ -43,7 +43,11 @@ struct ConversationMessageView: View {
routerPath.handleStatus(status: message, url: url) routerPath.handleStatus(status: message, url: url)
}) })
} }
#if os(visionOS)
.background(isOwnMessage ? Material.ultraThick : Material.regular)
#else
.background(isOwnMessage ? theme.tintColor.opacity(0.2) : theme.secondaryBackgroundColor) .background(isOwnMessage ? theme.tintColor.opacity(0.2) : theme.secondaryBackgroundColor)
#endif
.cornerRadius(8) .cornerRadius(8)
.padding(.leading, isOwnMessage ? 24 : 0) .padding(.leading, isOwnMessage ? 24 : 0)
.padding(.trailing, isOwnMessage ? 0 : 24) .padding(.trailing, isOwnMessage ? 0 : 24)

View file

@ -85,6 +85,8 @@ struct ConversationsListRow: View {
} }
} }
} }
.buttonStyle(.plain)
.hoverEffectDisabled()
} }
private var actionsView: some View { private var actionsView: some View {

View file

@ -81,8 +81,10 @@ public struct ConversationsListView: View {
} }
.padding(.top, .layoutPadding) .padding(.top, .layoutPadding)
} }
#if !os(visionOS)
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.primaryBackgroundColor) .background(theme.primaryBackgroundColor)
#endif
.navigationTitle("conversations.navigation-title") .navigationTitle("conversations.navigation-title")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { .toolbar {