mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 10:11:00 +00:00
move environment runtime check to compile time (#1709)
This commit is contained in:
parent
df1a44cc21
commit
2e350f5fce
17 changed files with 136 additions and 123 deletions
|
@ -10,11 +10,11 @@ extension IceCubesApp {
|
||||||
}
|
}
|
||||||
.keyboardShortcut("n", modifiers: .shift)
|
.keyboardShortcut("n", modifiers: .shift)
|
||||||
Button("menu.new-post") {
|
Button("menu.new-post") {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: userPreferences.postVisibility))
|
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: userPreferences.postVisibility))
|
||||||
} else {
|
#else
|
||||||
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
|
sidebarRouterPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
.keyboardShortcut("n", modifiers: .command)
|
.keyboardShortcut("n", modifiers: .command)
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,9 @@ private struct SafariRouter: ViewModifier {
|
||||||
return .handled
|
return .handled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
guard preferences.preferredBrowser == .inAppSafari, !ProcessInfo.processInfo.isMacCatalystApp else { return .systemAction }
|
#if !targetEnvironment(macCatalyst)
|
||||||
|
guard preferences.preferredBrowser == .inAppSafari else { return .systemAction }
|
||||||
|
#endif
|
||||||
// SFSafariViewController only supports initial URLs with http:// or https:// schemes.
|
// SFSafariViewController only supports initial URLs with http:// or https:// schemes.
|
||||||
guard let scheme = url.scheme, ["https", "http"].contains(scheme.lowercased()) else {
|
guard let scheme = url.scheme, ["https", "http"].contains(scheme.lowercased()) else {
|
||||||
return .systemAction
|
return .systemAction
|
||||||
|
|
|
@ -57,11 +57,11 @@ struct SideBarView<Content: View>: View {
|
||||||
|
|
||||||
private var postButton: some View {
|
private var postButton: some View {
|
||||||
Button {
|
Button {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: userPreferences.postVisibility))
|
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: userPreferences.postVisibility))
|
||||||
} else {
|
#else
|
||||||
routerPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
|
routerPath.presentedSheet = .newStatusEditor(visibility: userPreferences.postVisibility)
|
||||||
}
|
#endif
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "square.and.pencil")
|
Image(systemName: "square.and.pencil")
|
||||||
.resizable()
|
.resizable()
|
||||||
|
|
|
@ -233,11 +233,11 @@ struct AddAccountView: View {
|
||||||
do {
|
do {
|
||||||
signInClient = .init(server: sanitizedName)
|
signInClient = .init(server: sanitizedName)
|
||||||
if let oauthURL = try await signInClient?.oauthURL() {
|
if let oauthURL = try await signInClient?.oauthURL() {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openURL(oauthURL)
|
openURL(oauthURL)
|
||||||
} else {
|
#else
|
||||||
self.oauthURL = oauthURL
|
self.oauthURL = oauthURL
|
||||||
}
|
#endif
|
||||||
} else {
|
} else {
|
||||||
isSigninIn = false
|
isSigninIn = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ struct SettingsTabs: View {
|
||||||
private var otherSections: some View {
|
private var otherSections: some View {
|
||||||
@Bindable var preferences = preferences
|
@Bindable var preferences = preferences
|
||||||
Section("settings.section.other") {
|
Section("settings.section.other") {
|
||||||
if !ProcessInfo.processInfo.isMacCatalystApp {
|
#if !targetEnvironment(macCatalyst)
|
||||||
Picker(selection: $preferences.preferredBrowser) {
|
Picker(selection: $preferences.preferredBrowser) {
|
||||||
ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in
|
ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in
|
||||||
switch browser {
|
switch browser {
|
||||||
|
@ -190,7 +190,7 @@ struct SettingsTabs: View {
|
||||||
Label("settings.general.browser.in-app.readerview", systemImage: "doc.plaintext")
|
Label("settings.general.browser.in-app.readerview", systemImage: "doc.plaintext")
|
||||||
}
|
}
|
||||||
.disabled(preferences.preferredBrowser != PreferredBrowser.inAppSafari)
|
.disabled(preferences.preferredBrowser != PreferredBrowser.inAppSafari)
|
||||||
}
|
#endif
|
||||||
Toggle(isOn: $preferences.isOpenAIEnabled) {
|
Toggle(isOn: $preferences.isOpenAIEnabled) {
|
||||||
Label("settings.other.hide-openai", systemImage: "faxmachine")
|
Label("settings.other.hide-openai", systemImage: "faxmachine")
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ struct SettingsTabs: View {
|
||||||
|
|
||||||
private var appSection: some View {
|
private var appSection: some View {
|
||||||
Section {
|
Section {
|
||||||
if !ProcessInfo.processInfo.isMacCatalystApp {
|
#if !targetEnvironment(macCatalyst)
|
||||||
NavigationLink(destination: IconSelectorView()) {
|
NavigationLink(destination: IconSelectorView()) {
|
||||||
Label {
|
Label {
|
||||||
Text("settings.app.icon")
|
Text("settings.app.icon")
|
||||||
|
@ -221,7 +221,7 @@ struct SettingsTabs: View {
|
||||||
.cornerRadius(4)
|
.cornerRadius(4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
Link(destination: URL(string: "https://github.com/Dimillian/IceCubesApp")!) {
|
Link(destination: URL(string: "https://github.com/Dimillian/IceCubesApp")!) {
|
||||||
Label("settings.app.source", systemImage: "link")
|
Label("settings.app.source", systemImage: "link")
|
||||||
|
|
|
@ -81,13 +81,13 @@ struct AccountDetailHeaderView: View {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let attachement = MediaAttachment.imageWith(url: account.header)
|
let attachement = MediaAttachment.imageWith(url: account.header)
|
||||||
|
#if targetEnvironment(macCatalyst)
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
openWindow(value: WindowDestinationMedia.mediaViewer(
|
||||||
openWindow(value: WindowDestinationMedia.mediaViewer(attachments: [attachement],
|
attachments: [attachement],
|
||||||
selectedAttachment: attachement))
|
selectedAttachment: attachement))
|
||||||
} else {
|
#else
|
||||||
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
|
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
.accessibilityElement(children: .combine)
|
.accessibilityElement(children: .combine)
|
||||||
.accessibilityAddTraits([.isImage, .isButton])
|
.accessibilityAddTraits([.isImage, .isButton])
|
||||||
|
@ -117,12 +117,12 @@ struct AccountDetailHeaderView: View {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let attachement = MediaAttachment.imageWith(url: account.avatar)
|
let attachement = MediaAttachment.imageWith(url: account.avatar)
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationMedia.mediaViewer(attachments: [attachement],
|
openWindow(value: WindowDestinationMedia.mediaViewer(attachments: [attachement],
|
||||||
selectedAttachment: attachement))
|
selectedAttachment: attachement))
|
||||||
} else {
|
#else
|
||||||
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
|
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
.accessibilityElement(children: .combine)
|
.accessibilityElement(children: .combine)
|
||||||
.accessibilityAddTraits([.isImage, .isButton])
|
.accessibilityAddTraits([.isImage, .isButton])
|
||||||
|
|
|
@ -201,12 +201,12 @@ struct ConversationMessageView: View {
|
||||||
.frame(height: 200)
|
.frame(height: 200)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationMedia.mediaViewer(attachments: [attachement],
|
openWindow(value: WindowDestinationMedia.mediaViewer(attachments: [attachement],
|
||||||
selectedAttachment: attachement))
|
selectedAttachment: attachement))
|
||||||
} else {
|
#else
|
||||||
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
|
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,21 @@ public extension Font {
|
||||||
// See https://gist.github.com/zacwest/916d31da5d03405809c4 for iOS values
|
// See https://gist.github.com/zacwest/916d31da5d03405809c4 for iOS values
|
||||||
// Custom values for Mac
|
// Custom values for Mac
|
||||||
private static let title = 28.0
|
private static let title = 28.0
|
||||||
private static let headline = onMac ? 20.0 : 17.0
|
#if targetEnvironment(macCatalyst)
|
||||||
private static let body = onMac ? 19.0 : 17.0
|
private static let headline = 20.0
|
||||||
private static let callout = onMac ? 17.0 : 16.0
|
private static let body = 19.0
|
||||||
private static let subheadline = onMac ? 16.0 : 15.0
|
private static let callout = 17.0
|
||||||
private static let footnote = onMac ? 15.0 : 13.0
|
private static let subheadline = 16.0
|
||||||
private static let caption = onMac ? 14.0 : 12.0
|
private static let footnote = 15.0
|
||||||
private static let onMac = ProcessInfo.processInfo.isMacCatalystApp
|
private static let caption = 14.0
|
||||||
|
#else
|
||||||
|
private static let headline = 17.0
|
||||||
|
private static let body = 17.0
|
||||||
|
private static let callout = 16.0
|
||||||
|
private static let subheadline = 15.0
|
||||||
|
private static let footnote = 13.0
|
||||||
|
private static let caption = 12.0
|
||||||
|
#endif
|
||||||
|
|
||||||
private static func customFont(size: CGFloat, relativeTo textStyle: TextStyle) -> Font {
|
private static func customFont(size: CGFloat, relativeTo textStyle: TextStyle) -> Font {
|
||||||
if let chosenFont = Theme.shared.chosenFont {
|
if let chosenFont = Theme.shared.chosenFont {
|
||||||
|
|
|
@ -47,12 +47,11 @@ public struct AvatarView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static let account = FrameConfig(width: 80, height: 80)
|
public static let account = FrameConfig(width: 80, height: 80)
|
||||||
public static let status = {
|
#if targetEnvironment(macCatalyst)
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
public static let status = FrameConfig(width: 48, height: 48)
|
||||||
return FrameConfig(width: 48, height: 48)
|
#else
|
||||||
}
|
public static let status = FrameConfig(width: 40, height: 40)
|
||||||
return FrameConfig(width: 40, height: 40)
|
#endif
|
||||||
}()
|
|
||||||
public static let embed = FrameConfig(width: 34, height: 34)
|
public static let embed = FrameConfig(width: 34, height: 34)
|
||||||
public static let badge = FrameConfig(width: 28, height: 28, cornerRadius: 14)
|
public static let badge = FrameConfig(width: 28, height: 28, cornerRadius: 14)
|
||||||
public static let list = FrameConfig(width: 20, height: 20, cornerRadius: 10)
|
public static let list = FrameConfig(width: 20, height: 20, cornerRadius: 10)
|
||||||
|
|
|
@ -26,12 +26,12 @@ public struct StatusEditorToolbarItem: ToolbarContent {
|
||||||
ToolbarItem(placement: .navigationBarTrailing) {
|
ToolbarItem(placement: .navigationBarTrailing) {
|
||||||
Button {
|
Button {
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: visibility))
|
openWindow(value: WindowDestinationEditor.newStatusEditor(visibility: visibility))
|
||||||
} else {
|
#else
|
||||||
routerPath.presentedSheet = .newStatusEditor(visibility: visibility)
|
routerPath.presentedSheet = .newStatusEditor(visibility: visibility)
|
||||||
HapticManager.shared.fireHaptic(.buttonPress)
|
HapticManager.shared.fireHaptic(.buttonPress)
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "square.and.pencil")
|
Image(systemName: "square.and.pencil")
|
||||||
|
|
|
@ -37,13 +37,13 @@ struct StatusEditorAccessoryView: View {
|
||||||
} label: {
|
} label: {
|
||||||
Label("status.editor.photo-library", systemImage: "photo")
|
Label("status.editor.photo-library", systemImage: "photo")
|
||||||
}
|
}
|
||||||
if !ProcessInfo.processInfo.isMacCatalystApp {
|
#if !targetEnvironment(macCatalyst)
|
||||||
Button {
|
Button {
|
||||||
isCameraPickerPresented = true
|
isCameraPickerPresented = true
|
||||||
} label: {
|
} label: {
|
||||||
Label("status.editor.camera-picker", systemImage: "camera")
|
Label("status.editor.camera-picker", systemImage: "camera")
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
Button {
|
Button {
|
||||||
isFileImporterPresented = true
|
isFileImporterPresented = true
|
||||||
} label: {
|
} label: {
|
||||||
|
|
|
@ -216,12 +216,14 @@ public struct StatusEditorView: View {
|
||||||
SoundEffectManager.shared.playSound(.tootSent)
|
SoundEffectManager.shared.playSound(.tootSent)
|
||||||
NotificationCenter.default.post(name: .shareSheetClose,
|
NotificationCenter.default.post(name: .shareSheetClose,
|
||||||
object: nil)
|
object: nil)
|
||||||
if !viewModel.mode.isInShareExtension, !preferences.requestedReview, !ProcessInfo.processInfo.isMacCatalystApp {
|
#if !targetEnvironment(macCatalyst)
|
||||||
|
if !viewModel.mode.isInShareExtension, !preferences.requestedReview {
|
||||||
if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {
|
if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {
|
||||||
SKStoreReviewController.requestReview(in: scene)
|
SKStoreReviewController.requestReview(in: scene)
|
||||||
}
|
}
|
||||||
preferences.requestedReview = true
|
preferences.requestedReview = true
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,10 +294,10 @@ public struct StatusEditorView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func close() {
|
private func close() {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
dismissWindow()
|
dismissWindow()
|
||||||
} else {
|
#else
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,10 @@ extension TextView.Representable {
|
||||||
textView.allowsEditingTextAttributes = false
|
textView.allowsEditingTextAttributes = false
|
||||||
textView.returnKeyType = .default
|
textView.returnKeyType = .default
|
||||||
textView.allowsEditingTextAttributes = true
|
textView.allowsEditingTextAttributes = true
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
textView.inlinePredictionType = .no
|
textView.inlinePredictionType = .no
|
||||||
}
|
#endif
|
||||||
|
|
||||||
|
|
||||||
self.getTextView?(textView)
|
self.getTextView?(textView)
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,12 +220,13 @@ public struct StatusRowView: View {
|
||||||
Button("accessibility.status.media-viewer-action.label") {
|
Button("accessibility.status.media-viewer-action.label") {
|
||||||
HapticManager.shared.fireHaptic(.notification(.success))
|
HapticManager.shared.fireHaptic(.notification(.success))
|
||||||
let attachments = viewModel.finalStatus.mediaAttachments
|
let attachments = viewModel.finalStatus.mediaAttachments
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationMedia.mediaViewer(attachments: attachments,
|
openWindow(value: WindowDestinationMedia.mediaViewer(
|
||||||
|
attachments: attachments,
|
||||||
selectedAttachment: attachments[0]))
|
selectedAttachment: attachments[0]))
|
||||||
} else {
|
#else
|
||||||
quickLook.prepareFor(selectedMediaAttachment: attachments[0], mediaAttachments: attachments)
|
quickLook.prepareFor(selectedMediaAttachment: attachments[0], mediaAttachments: attachments)
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,11 +205,11 @@ struct StatusRowActionsView: View {
|
||||||
switch action {
|
switch action {
|
||||||
case .respond:
|
case .respond:
|
||||||
SoundEffectManager.shared.playSound(.share)
|
SoundEffectManager.shared.playSound(.share)
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: viewModel.localStatus ?? viewModel.status))
|
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: viewModel.localStatus ?? viewModel.status))
|
||||||
} else {
|
#else
|
||||||
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.localStatus ?? viewModel.status)
|
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.localStatus ?? viewModel.status)
|
||||||
}
|
#endif
|
||||||
case .favorite:
|
case .favorite:
|
||||||
SoundEffectManager.shared.playSound(.favorite)
|
SoundEffectManager.shared.playSound(.favorite)
|
||||||
await statusDataController.toggleFavorite(remoteStatus: viewModel.localStatusId)
|
await statusDataController.toggleFavorite(remoteStatus: viewModel.localStatusId)
|
||||||
|
|
|
@ -53,20 +53,20 @@ struct StatusRowContextMenu: View {
|
||||||
systemImage: "bookmark")
|
systemImage: "bookmark")
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: viewModel.status))
|
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: viewModel.status))
|
||||||
} else {
|
#else
|
||||||
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.status)
|
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.status)
|
||||||
}
|
#endif
|
||||||
} label: {
|
} label: {
|
||||||
Label("status.action.reply", systemImage: "arrowshape.turn.up.left")
|
Label("status.action.reply", systemImage: "arrowshape.turn.up.left")
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationEditor.quoteStatusEditor(status: viewModel.status))
|
openWindow(value: WindowDestinationEditor.quoteStatusEditor(status: viewModel.status))
|
||||||
} else {
|
#else
|
||||||
viewModel.routerPath.presentedSheet = .quoteStatusEditor(status: viewModel.status)
|
viewModel.routerPath.presentedSheet = .quoteStatusEditor(status: viewModel.status)
|
||||||
}
|
#endif
|
||||||
} label: {
|
} label: {
|
||||||
Label("status.action.quote", systemImage: "quote.bubble")
|
Label("status.action.quote", systemImage: "quote.bubble")
|
||||||
}
|
}
|
||||||
|
@ -163,11 +163,11 @@ struct StatusRowContextMenu: View {
|
||||||
}
|
}
|
||||||
if currentInstance.isEditSupported {
|
if currentInstance.isEditSupported {
|
||||||
Button {
|
Button {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(value: WindowDestinationEditor.editStatusEditor(status: viewModel.status.reblogAsAsStatus ?? viewModel.status))
|
openWindow(value: WindowDestinationEditor.editStatusEditor(status: viewModel.status.reblogAsAsStatus ?? viewModel.status))
|
||||||
} else {
|
#else
|
||||||
viewModel.routerPath.presentedSheet = .editStatusEditor(status: viewModel.status.reblogAsAsStatus ?? viewModel.status)
|
viewModel.routerPath.presentedSheet = .editStatusEditor(status: viewModel.status.reblogAsAsStatus ?? viewModel.status)
|
||||||
}
|
#endif
|
||||||
} label: {
|
} label: {
|
||||||
Label("status.action.edit", systemImage: "pencil")
|
Label("status.action.edit", systemImage: "pencil")
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,19 +115,19 @@ public struct StatusRowMediaPreviewView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func tabAction(for index: Int) {
|
private func tabAction(for index: Int) {
|
||||||
if ProcessInfo.processInfo.isMacCatalystApp {
|
#if targetEnvironment(macCatalyst)
|
||||||
openWindow(
|
openWindow(
|
||||||
value: WindowDestinationMedia.mediaViewer(
|
value: WindowDestinationMedia.mediaViewer(
|
||||||
attachments: attachments,
|
attachments: attachments,
|
||||||
selectedAttachment: attachments[index]
|
selectedAttachment: attachments[index]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
} else {
|
#else
|
||||||
quickLook.prepareFor(
|
quickLook.prepareFor(
|
||||||
selectedMediaAttachment: attachments[index],
|
selectedMediaAttachment: attachments[index],
|
||||||
mediaAttachments: attachments
|
mediaAttachments: attachments
|
||||||
)
|
)
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func accessibilityLabel(for attachment: MediaAttachment) -> Text {
|
private static func accessibilityLabel(for attachment: MediaAttachment) -> Text {
|
||||||
|
|
Loading…
Reference in a new issue