mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-22 08:20:59 +00:00
VisionOS fixes
This commit is contained in:
parent
b8be6b79af
commit
a4927fd30c
6 changed files with 35 additions and 3 deletions
|
@ -18,9 +18,9 @@ struct AppView: View {
|
|||
@Environment(Theme.self) private var theme
|
||||
@Environment(StreamWatcher.self) private var watcher
|
||||
|
||||
@Environment(\.openWindow) var openWindow
|
||||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
||||
|
||||
|
||||
@Binding var selectedTab: Tab
|
||||
@Binding var appRouterPath: RouterPath
|
||||
|
||||
|
@ -57,7 +57,11 @@ struct AppView: View {
|
|||
selectedTab
|
||||
}, set: { newTab in
|
||||
if newTab == .post {
|
||||
#if os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: userPreferences.postVisibility))
|
||||
#else
|
||||
appRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
|
||||
#endif
|
||||
return
|
||||
}
|
||||
if newTab == selectedTab {
|
||||
|
|
|
@ -25,7 +25,7 @@ enum Tab: Int, Identifiable, Hashable, CaseIterable, Codable {
|
|||
}
|
||||
|
||||
static func visionOSTab() -> [Tab] {
|
||||
[.profile, .timeline, .notifications, .mentions, .explore, .messages, .settings]
|
||||
[.profile, .timeline, .notifications, .mentions, .explore, .messages, .post, .settings]
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
|
|
|
@ -15,13 +15,19 @@ public struct TagsListView: View {
|
|||
List {
|
||||
ForEach(tags) { tag in
|
||||
TagRowView(tag: tag)
|
||||
#if !os(visionOS)
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
#endif
|
||||
.padding(.vertical, 4)
|
||||
}
|
||||
}
|
||||
#if !os(visionOS)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(theme.primaryBackgroundColor)
|
||||
.listStyle(.plain)
|
||||
#else
|
||||
.listStyle(.grouped)
|
||||
#endif
|
||||
.navigationTitle("explore.section.trending.tags")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
|
|
|
@ -34,7 +34,11 @@ public struct StatusEmbeddedView: View {
|
|||
Spacer()
|
||||
}
|
||||
.padding(8)
|
||||
#if os(visionOS)
|
||||
.background(Material.thickMaterial)
|
||||
#else
|
||||
.background(theme.secondaryBackgroundColor)
|
||||
#endif
|
||||
.cornerRadius(4)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
|
|
|
@ -145,7 +145,11 @@ struct StatusRowActionsView: View {
|
|||
}
|
||||
.padding(.vertical, 6)
|
||||
.padding(.trailing, 8)
|
||||
#if os(visionOS)
|
||||
.buttonStyle(.borderless)
|
||||
#else
|
||||
.buttonStyle(.statusAction())
|
||||
#endif
|
||||
.accessibilityElement(children: .combine)
|
||||
.accessibilityLabel("status.action.share-link")
|
||||
case .linkAndText:
|
||||
|
@ -158,7 +162,11 @@ struct StatusRowActionsView: View {
|
|||
}
|
||||
.padding(.vertical, 6)
|
||||
.padding(.trailing, 8)
|
||||
#if os(visionOS)
|
||||
.buttonStyle(.borderless)
|
||||
#else
|
||||
.buttonStyle(.statusAction())
|
||||
#endif
|
||||
.accessibilityElement(children: .combine)
|
||||
.accessibilityLabel("status.action.share-link")
|
||||
}
|
||||
|
@ -229,12 +237,16 @@ struct StatusRowActionsView: View {
|
|||
.padding(.trailing, 8)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
#if os(visionOS)
|
||||
.buttonStyle(.borderless)
|
||||
#else
|
||||
.buttonStyle(
|
||||
.statusAction(
|
||||
isOn: action.isOn(dataController: statusDataController),
|
||||
tintColor: action.tintColor(theme: theme)
|
||||
)
|
||||
)
|
||||
#endif
|
||||
.disabled(action == .boost &&
|
||||
(viewModel.status.visibility == .direct || viewModel.status.visibility == .priv && viewModel.status.account.id != currentAccount.account?.id))
|
||||
.accessibilityElement(children: .combine)
|
||||
|
|
|
@ -48,7 +48,9 @@ public struct StatusRowCardView: View {
|
|||
if let title = card.title, let url = URL(string: card.url) {
|
||||
VStack(alignment: .leading) {
|
||||
let sitesWithIcons = ["apps.apple.com", "music.apple.com", "open.spotify.com"]
|
||||
if (UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac),
|
||||
if (UIDevice.current.userInterfaceIdiom == .pad ||
|
||||
UIDevice.current.userInterfaceIdiom == .mac ||
|
||||
UIDevice.current.userInterfaceIdiom == .vision),
|
||||
let host = url.host(), sitesWithIcons.contains(host) {
|
||||
iconLinkPreview(title, url)
|
||||
} else {
|
||||
|
@ -57,7 +59,11 @@ public struct StatusRowCardView: View {
|
|||
}
|
||||
.frame(maxWidth: maxWidth)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
#if os(visionOS)
|
||||
.background(Material.thick)
|
||||
#else
|
||||
.background(theme.secondaryBackgroundColor)
|
||||
#endif
|
||||
.cornerRadius(16)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 16)
|
||||
|
|
Loading…
Reference in a new issue