From 78056fc1fff43b45b1863c7338afd6b1c45486be Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 25 Jun 2025 06:53:00 -0700 Subject: feat: Development commit --- Localizable.xcstrings | 3 +++ Sora/Views/Post/Details/PostDetailsImageView.swift | 20 ++++++++++++++++++++ Sora/Views/Post/Grid/PostGridView.swift | 20 ++++++++++++++------ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 36cfac8..76b7822 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -90,6 +90,9 @@ } } } + }, + "Copy" : { + }, "Create" : { diff --git a/Sora/Views/Post/Details/PostDetailsImageView.swift b/Sora/Views/Post/Details/PostDetailsImageView.swift index 0ab28c4..7d52a51 100644 --- a/Sora/Views/Post/Details/PostDetailsImageView.swift +++ b/Sora/Views/Post/Details/PostDetailsImageView.swift @@ -50,6 +50,26 @@ struct PostDetailsImageView: View { } #endif + Button { + #if os(iOS) + let url = url + + Task(priority: .userInitiated) { + // swiftlint:disable:next legacy_objc_type + if let data = NSData(contentsOf: url ?? URL(string: "")!) { + UIPasteboard.general.image = UIImage(data: data as Data) + } + } + #else + if let url { + NSPasteboard.general.clearContents() + NSPasteboard.general.writeObjects([NSImage(byReferencing: url)]) + } + #endif + } label: { + Label("Copy", systemImage: "doc.on.doc") + } + #if os(macOS) Button { saveImageToPicturesFolder() diff --git a/Sora/Views/Post/Grid/PostGridView.swift b/Sora/Views/Post/Grid/PostGridView.swift index 9eef5f7..4b32c88 100644 --- a/Sora/Views/Post/Grid/PostGridView.swift +++ b/Sora/Views/Post/Grid/PostGridView.swift @@ -107,12 +107,20 @@ struct PostGridView: View { // swiftlint:disable:this type_body_length } } .animation(.easeInOut, value: manager.historyIndex) - .searchable( - text: $manager.searchText, - isPresented: $isSearchablePresented, - placement: .navigationBarDrawer(displayMode: .automatic), - prompt: "Tags" - ) + #if os(iOS) + .searchable( + text: $manager.searchText, + isPresented: $isSearchablePresented, + placement: .navigationBarDrawer(displayMode: .automatic), + prompt: "Tags" + ) + #else + .searchable( + text: $manager.searchText, + isPresented: $isSearchablePresented, + prompt: "Tags" + ) + #endif .searchSuggestions { if settings.searchSuggestionsMode != .disabled { SearchSuggestionsView( -- cgit v1.2.3