mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
iOS: Open downloads folder after download
This commit is contained in:
1 parent
288625cbd3
commit
13ce7522a7
3 files changed
+1761
-1528
No files matched your search
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
+1741
-1527
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user