From 0dea6240609f2c145b00d2f476f5367833b185a7 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 16 Jan 2024 18:43:09 +0100 Subject: [PATCH] VisionOS fixes --- .../xcshareddata/swiftpm/Package.resolved | 4 +- IceCubesApp/App/SideBarView.swift | 17 ++++++--- .../Editor/Components/AccessoryView.swift | 38 +++++++++---------- .../Sources/StatusKit/Editor/MainView.swift | 12 ++++-- 4 files changed, 40 insertions(+), 31 deletions(-) diff --git a/IceCubesApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/IceCubesApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 10b96ea5..234d1dfd 100644 --- a/IceCubesApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/IceCubesApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kean/Nuke", "state" : { - "revision" : "1694798e876113d44f6ec6ead965d7286695981d", - "version" : "12.2.0" + "revision" : "15fde63470d782c897816a74bdd516a907e33147", + "version" : "12.3.0" } }, { diff --git a/IceCubesApp/App/SideBarView.swift b/IceCubesApp/App/SideBarView.swift index cc5a7f41..44574b73 100644 --- a/IceCubesApp/App/SideBarView.swift +++ b/IceCubesApp/App/SideBarView.swift @@ -43,8 +43,9 @@ struct SideBarView: View { makeBadgeView(count: badge) } } - .contentShape(Rectangle()) - .frame(width: .sidebarWidth, height: 50) + .frame(width: .sidebarWidth - 24, height: 50) + .background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear, + in: RoundedRectangle(cornerRadius: 8)) } private func makeBadgeView(count: Int) -> some View { @@ -131,7 +132,6 @@ struct SideBarView: View { } label: { makeIconForTab(tab: tab) } - .background(tab == selectedTab ? theme.secondaryBackgroundColor : .clear) } } } @@ -153,14 +153,19 @@ struct SideBarView: View { } } } - postButton - .padding(.top, 12) - Spacer() } } .frame(width: .sidebarWidth) .scrollContentBackground(.hidden) .background(.thinMaterial) + .safeAreaInset(edge: .bottom, content: { + HStack { + postButton + .padding(.vertical, 24) + } + .frame(width: .sidebarWidth) + .background(.thinMaterial) + }) Divider().edgesIgnoringSafeArea(.all) } content() diff --git a/Packages/StatusKit/Sources/StatusKit/Editor/Components/AccessoryView.swift b/Packages/StatusKit/Sources/StatusKit/Editor/Components/AccessoryView.swift index 917de578..be976756 100644 --- a/Packages/StatusKit/Sources/StatusKit/Editor/Components/AccessoryView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Editor/Components/AccessoryView.swift @@ -29,31 +29,31 @@ extension StatusEditor { var body: some View { @Bindable var viewModel = focusedSEVM - VStack(spacing: 0) { - #if os(visionOS) - HStack { - contentView - } - .frame(height: 24) - .padding(16) - .background(.thickMaterial) - .cornerRadius(8) - #else - Divider() - HStack { - contentView - } - .frame(height: 20) - .padding(.vertical, 12) - .background(.thinMaterial) - #endif + #if os(visionOS) + HStack { + contentView + .buttonStyle(.borderless) } + .frame(width: 32) + .padding(16) + .glassBackgroundEffect() + .cornerRadius(8) + .padding(.trailing, 78) + #else + Divider() + HStack { + contentView + } + .frame(height: 20) + .padding(.vertical, 12) + .background(.thinMaterial) + #endif } @ViewBuilder private var contentView: some View { #if os(visionOS) - HStack(spacing: 8) { + VStack(spacing: 8) { actionsView } #else diff --git a/Packages/StatusKit/Sources/StatusKit/Editor/MainView.swift b/Packages/StatusKit/Sources/StatusKit/Editor/MainView.swift index 052a73c6..5f9b0534 100644 --- a/Packages/StatusKit/Sources/StatusKit/Editor/MainView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Editor/MainView.swift @@ -85,13 +85,17 @@ extension StatusEditor { AutoCompleteView(viewModel: focusedSEVM) } #if os(visionOS) - .ornament(attachmentAnchor: .scene(.bottom)) { - AccessoryView(isSpoilerTextFocused: $isSpoilerTextFocused, focusedSEVM: focusedSEVM, followUpSEVMs: $followUpSEVMs) - } + .ornament(attachmentAnchor: .scene(.leading)) { + AccessoryView(isSpoilerTextFocused: $isSpoilerTextFocused, + focusedSEVM: focusedSEVM, + followUpSEVMs: $followUpSEVMs) + } #else .safeAreaInset(edge: .bottom) { if presentationDetent == .large || presentationDetent == .medium { - AccessoryView(isSpoilerTextFocused: $isSpoilerTextFocused, focusedSEVM: focusedSEVM, followUpSEVMs: $followUpSEVMs) + AccessoryView(isSpoilerTextFocused: $isSpoilerTextFocused, + focusedSEVM: focusedSEVM, + followUpSEVMs: $followUpSEVMs) } } #endif