mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-25 15:28:06 +00:00
Enhance visionOS support
This commit is contained in:
parent
f14ca6e529
commit
b9b3d0e727
6 changed files with 62 additions and 3 deletions
|
@ -25,7 +25,7 @@ enum Tab: Int, Identifiable, Hashable, CaseIterable, Codable {
|
||||||
}
|
}
|
||||||
|
|
||||||
static func visionOSTab() -> [Tab] {
|
static func visionOSTab() -> [Tab] {
|
||||||
[.profile, .timeline, .notifications, .mentions, .explore, .messages, .post, .settings]
|
[.profile, .timeline, .notifications, .mentions, .explore, .post, .settings]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
|
|
|
@ -38,7 +38,9 @@ struct EditTagGroupView: View {
|
||||||
focusedField: $focusedField
|
focusedField: $focusedField
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#endif
|
||||||
|
|
||||||
Section("add-tag-groups.edit.tags") {
|
Section("add-tag-groups.edit.tags") {
|
||||||
TagsInputView(
|
TagsInputView(
|
||||||
|
@ -47,7 +49,9 @@ struct EditTagGroupView: View {
|
||||||
focusedField: $focusedField
|
focusedField: $focusedField
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
.formStyle(.grouped)
|
.formStyle(.grouped)
|
||||||
.navigationTitle(
|
.navigationTitle(
|
||||||
|
|
|
@ -169,6 +169,10 @@ public struct ExploreView: View {
|
||||||
AccountsListRow(viewModel: .init(account: account, relationShip: relationship))
|
AccountsListRow(viewModel: .init(account: account, relationShip: relationship))
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,6 +184,10 @@ public struct ExploreView: View {
|
||||||
TagRowView(tag: tag)
|
TagRowView(tag: tag)
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
.padding(.vertical, 4)
|
.padding(.vertical, 4)
|
||||||
}
|
}
|
||||||
|
@ -191,6 +199,10 @@ public struct ExploreView: View {
|
||||||
StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath))
|
StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath))
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
.padding(.vertical, 8)
|
.padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
|
@ -207,6 +219,10 @@ public struct ExploreView: View {
|
||||||
AccountsListRow(viewModel: .init(account: account, relationShip: relationship))
|
AccountsListRow(viewModel: .init(account: account, relationShip: relationship))
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,6 +232,10 @@ public struct ExploreView: View {
|
||||||
}
|
}
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,6 +248,10 @@ public struct ExploreView: View {
|
||||||
TagRowView(tag: tag)
|
TagRowView(tag: tag)
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
.padding(.vertical, 4)
|
.padding(.vertical, 4)
|
||||||
}
|
}
|
||||||
|
@ -237,6 +261,10 @@ public struct ExploreView: View {
|
||||||
}
|
}
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,6 +277,10 @@ public struct ExploreView: View {
|
||||||
StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath))
|
StatusRowView(viewModel: .init(status: status, client: client, routerPath: routerPath))
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
.padding(.vertical, 8)
|
.padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
|
@ -259,6 +291,10 @@ public struct ExploreView: View {
|
||||||
}
|
}
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,6 +307,10 @@ public struct ExploreView: View {
|
||||||
StatusRowCardView(card: card)
|
StatusRowCardView(card: card)
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
.padding(.vertical, 8)
|
.padding(.vertical, 8)
|
||||||
}
|
}
|
||||||
|
@ -281,6 +321,10 @@ public struct ExploreView: View {
|
||||||
}
|
}
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#else
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,9 @@ public struct ListEditView: View {
|
||||||
}
|
}
|
||||||
Toggle("list.edit.isExclusive", isOn: $viewModel.isExclusive)
|
Toggle("list.edit.isExclusive", isOn: $viewModel.isExclusive)
|
||||||
}
|
}
|
||||||
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#endif
|
||||||
.disabled(viewModel.isUpdating)
|
.disabled(viewModel.isUpdating)
|
||||||
.onChange(of: viewModel.repliesPolicy) { _, _ in
|
.onChange(of: viewModel.repliesPolicy) { _, _ in
|
||||||
Task { await viewModel.update() }
|
Task { await viewModel.update() }
|
||||||
|
@ -62,14 +64,16 @@ public struct ListEditView: View {
|
||||||
listAccountsView
|
listAccountsView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if !os(visionOS)
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
|
#endif
|
||||||
.disabled(viewModel.isUpdating)
|
.disabled(viewModel.isUpdating)
|
||||||
}
|
}
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
.scrollDismissesKeyboard(.immediately)
|
.scrollDismissesKeyboard(.immediately)
|
||||||
#endif
|
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
.background(theme.secondaryBackgroundColor)
|
.background(theme.secondaryBackgroundColor)
|
||||||
|
#endif
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem {
|
ToolbarItem {
|
||||||
Button {
|
Button {
|
||||||
|
|
|
@ -172,7 +172,8 @@ public struct NotificationsListView: View {
|
||||||
trailing: .layoutPadding))
|
trailing: .layoutPadding))
|
||||||
#if os(visionOS)
|
#if os(visionOS)
|
||||||
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
.foregroundStyle(notification.type == .mention && lockedType != .mention ? Material.thick : Material.regular))
|
.foregroundStyle(notification.type == .mention && lockedType != .mention ? Material.thick : Material.regular).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
#else
|
#else
|
||||||
.listRowBackground(notification.type == .mention && lockedType != .mention ?
|
.listRowBackground(notification.type == .mention && lockedType != .mention ?
|
||||||
theme.secondaryBackgroundColor : theme.primaryBackgroundColor)
|
theme.secondaryBackgroundColor : theme.primaryBackgroundColor)
|
||||||
|
|
|
@ -12,7 +12,13 @@ struct TimelineHeaderView<Content: View>: View {
|
||||||
content()
|
content()
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
#if os(visionOS)
|
||||||
|
.listRowBackground(RoundedRectangle(cornerRadius: 8)
|
||||||
|
.foregroundStyle(.background).hoverEffect())
|
||||||
|
.listRowHoverEffectDisabled()
|
||||||
|
#else
|
||||||
.listRowBackground(theme.secondaryBackgroundColor)
|
.listRowBackground(theme.secondaryBackgroundColor)
|
||||||
|
#endif
|
||||||
.listRowSeparator(.hidden)
|
.listRowSeparator(.hidden)
|
||||||
.listRowInsets(.init(top: 8,
|
.listRowInsets(.init(top: 8,
|
||||||
leading: .layoutPadding,
|
leading: .layoutPadding,
|
||||||
|
|
Loading…
Reference in a new issue