iOS: Open downloads folder after download

This commit is contained in:
Leon Böttger committed 2025-08-17 14:18:26 +02:00
1 parent 288625cbd3
commit 13ce7522a7
3 files changed
+1761 -1528

No files matched your search

+6
View File
@@ -24,8 +24,14 @@ final class LogManager {
/// Private initializer
private init() {
#if os(macOS)
// Use the App Group container
let directory = getAppGroupDirectory()
#else
// On iOS, use the library directory, to not let the logs appear in the files app
let directory = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask).first
#endif
// Create file name from date
let formatter = DateFormatter()
+14 -1
View File
@@ -10,6 +10,7 @@ import ImageIO
#if os(macOS)
import AppKit
#else
import LUI
import UIKit
#endif
@@ -47,7 +48,6 @@ public class SaveFilesManager {
private var filesFinishedDownloading = [URL]()
private var filesFinishedDownloadingSinceLastRun = [URL]()
public func registerFileFinishedDownloading(_ fileURL: URL) {
filesFinishedDownloading.append(fileURL)
filesFinishedDownloadingSinceLastRun.append(fileURL)
@@ -123,6 +123,19 @@ public class SaveFilesManager {
log("Opening \(filesFinishedDownloadingSinceLastRun.count) file(s) in Finder.")
NSWorkspace.shared.activateFileViewerSelecting(filesFinishedDownloadingSinceLastRun)
}
#else
let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
if let documentsUrl = documentsUrl, let sharedUrl = URL(string: "shareddocuments://\(documentsUrl.path)") {
if UIApplication.shared.canOpenURL(sharedUrl) {
UIApplication.shared.open(sharedUrl, options: [:])
}
}
else {
showAlert(title: "CouldNotOpenDocumentsFolder", message: "CouldNotOpenDocumentsFolderDescription")
}
#endif
// Clear the list of finished files
File diff suppressed because it is too large. Load diff