mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-22 08:20:59 +00:00
Multi window visionOS support
This commit is contained in:
parent
e7864f7089
commit
b7e8f63e86
12 changed files with 15 additions and 16 deletions
|
@ -59,7 +59,7 @@ struct SideBarView<Content: View>: View {
|
|||
|
||||
private var postButton: some View {
|
||||
Button {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: userPreferences.postVisibility))
|
||||
#else
|
||||
routerPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
|
||||
|
|
|
@ -83,7 +83,7 @@ struct AccountDetailHeaderView: View {
|
|||
return
|
||||
}
|
||||
let attachement = MediaAttachment.imageWith(url: account.header)
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationMedia.mediaViewer(
|
||||
attachments: [attachement],
|
||||
selectedAttachment: attachement
|
||||
|
@ -120,7 +120,7 @@ struct AccountDetailHeaderView: View {
|
|||
return
|
||||
}
|
||||
let attachement = MediaAttachment.imageWith(url: account.avatar)
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationMedia.mediaViewer(attachments: [attachement],
|
||||
selectedAttachment: attachement))
|
||||
#else
|
||||
|
|
|
@ -279,7 +279,7 @@ public struct AccountDetailView: View {
|
|||
if !viewModel.isCurrentUser {
|
||||
Button {
|
||||
if let account = viewModel.account {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.mentionStatusEditor(account: account, visibility: preferences.postVisibility))
|
||||
#else
|
||||
routerPath.presentedSheet = .mentionStatusEditor(account: account,
|
||||
|
|
|
@ -205,7 +205,7 @@ struct ConversationMessageView: View {
|
|||
.frame(height: 200)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationMedia.mediaViewer(attachments: [attachement],
|
||||
selectedAttachment: attachement))
|
||||
#else
|
||||
|
|
|
@ -83,7 +83,7 @@ struct ConversationsListRow: View {
|
|||
.accessibilityAction(.magicTap) {
|
||||
if let lastStatus = conversation.lastStatus {
|
||||
HapticManager.shared.fireHaptic(.notification(.success))
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: lastStatus))
|
||||
#else
|
||||
routerPath.presentedSheet = .replyToStatusEditor(status: lastStatus)
|
||||
|
@ -100,7 +100,7 @@ struct ConversationsListRow: View {
|
|||
Button {
|
||||
if let lastStatus = conversation.lastStatus {
|
||||
HapticManager.shared.fireHaptic(.notification(.success))
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: lastStatus))
|
||||
#else
|
||||
routerPath.presentedSheet = .replyToStatusEditor(status: lastStatus)
|
||||
|
|
|
@ -35,7 +35,7 @@ public struct StatusEditorToolbarItem: ToolbarContent {
|
|||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button {
|
||||
Task { @MainActor in
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: visibility))
|
||||
#else
|
||||
routerPath.presentedSheet = .newStatusEditor(visibility: visibility)
|
||||
|
|
|
@ -110,7 +110,6 @@ public struct ExploreView: View {
|
|||
}
|
||||
.task(id: viewModel.searchQuery) {
|
||||
do {
|
||||
try await Task.sleep(for: .milliseconds(150))
|
||||
await viewModel.search()
|
||||
} catch {}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ import SwiftUI
|
|||
}
|
||||
|
||||
func search() async {
|
||||
guard let client else { return }
|
||||
guard let client, !searchQuery.isEmpty else { return }
|
||||
do {
|
||||
try await Task.sleep(for: .milliseconds(250))
|
||||
var results: SearchResults = try await client.get(endpoint: Search.search(query: searchQuery,
|
||||
|
|
|
@ -217,7 +217,7 @@ public struct StatusRowView: View {
|
|||
Button("accessibility.status.media-viewer-action.label") {
|
||||
HapticManager.shared.fireHaptic(.notification(.success))
|
||||
let attachments = viewModel.finalStatus.mediaAttachments
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationMedia.mediaViewer(
|
||||
attachments: attachments,
|
||||
selectedAttachment: attachments[0]
|
||||
|
|
|
@ -252,7 +252,7 @@ struct StatusRowActionsView: View {
|
|||
switch action {
|
||||
case .respond:
|
||||
SoundEffectManager.shared.playSound(.share)
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: viewModel.localStatus ?? viewModel.status))
|
||||
#else
|
||||
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.localStatus ?? viewModel.status)
|
||||
|
|
|
@ -55,7 +55,7 @@ struct StatusRowContextMenu: View {
|
|||
systemImage: "bookmark")
|
||||
}
|
||||
Button {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: viewModel.status))
|
||||
#else
|
||||
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.status)
|
||||
|
@ -64,7 +64,7 @@ struct StatusRowContextMenu: View {
|
|||
Label("status.action.reply", systemImage: "arrowshape.turn.up.left")
|
||||
}
|
||||
Button {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.quoteStatusEditor(status: viewModel.status))
|
||||
#else
|
||||
viewModel.routerPath.presentedSheet = .quoteStatusEditor(status: viewModel.status)
|
||||
|
@ -172,7 +172,7 @@ struct StatusRowContextMenu: View {
|
|||
}
|
||||
if currentInstance.isEditSupported {
|
||||
Button {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(value: WindowDestinationEditor.editStatusEditor(status: viewModel.status.reblogAsAsStatus ?? viewModel.status))
|
||||
#else
|
||||
viewModel.routerPath.presentedSheet = .editStatusEditor(status: viewModel.status.reblogAsAsStatus ?? viewModel.status)
|
||||
|
|
|
@ -107,7 +107,7 @@ public struct StatusRowMediaPreviewView: View {
|
|||
}
|
||||
|
||||
private func tabAction(for index: Int) {
|
||||
#if targetEnvironment(macCatalyst)
|
||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||
openWindow(
|
||||
value: WindowDestinationMedia.mediaViewer(
|
||||
attachments: attachments,
|
||||
|
|
Loading…
Reference in a new issue