fix share to app + allow import on all screens

This commit is contained in:
leminlimez committed 2025-06-03 10:47:49 -04:00
1 parent 5e0133ff8c
commit 68f31ce1ae
4 files changed
+106 -86

No files matched your search

@@ -19,7 +19,7 @@ class DownloadManager {
let (data, response) = try await URLSession.shared.data(for: request) as! (Data, HTTPURLResponse)
guard response.statusCode == 200 else { throw URLError(.cannotConnectToHost) }
let newURL = SymHandler.getDocumentsDirectory().appendingPathComponent(getWallpaperNameFromURL(string: url.absoluteString))
let newURL = PosterBoardManager.getTendiesStoreURL().appendingPathComponent(getWallpaperNameFromURL(string: url.absoluteString))
try data.write(to: newURL)
return newURL
}
@@ -28,4 +28,17 @@ class DownloadManager {
guard let url = URL(string: path) else { throw URLError(.unknown) }
return try await downloadFromURL(url)
}
static func copyTendies(from url: URL) throws -> URL {
// scope the resource
let accessing = url.startAccessingSecurityScopedResource()
defer {
if accessing {
url.stopAccessingSecurityScopedResource()
}
}
let newURL = PosterBoardManager.getTendiesStoreURL().appendingPathComponent(url.lastPathComponent)
try FileManager.default.copyItem(at: url, to: newURL)
return newURL
}
}