Skip to content

An open-source cross-platform alternative to AirDrop

fix: add delegate method for URL opening (#2711)

Shlomob00e187b5bc3
diff --git a/app/macos/Runner/AppDelegate.swift b/app/macos/Runner/AppDelegate.swift
index f63d0b7d..4bb41315 100644
--- a/app/macos/Runner/AppDelegate.swift
+++ b/app/macos/Runner/AppDelegate.swift
@@ -264,6 +264,18 @@ class AppDelegate: FlutterAppDelegate {
}
}
}
+
+ override func application(_ application: NSApplication, open urls: [URL]) {
+ for url in urls {
+ if url.isFileURL {
+ if let fileBookmark = createBookmarkForFile(at: url) {
+ Defaults[.pendingFiles].append(fileBookmark)
+ }
+ } else {
+ Defaults[.pendingStrings].append(url.absoluteString)
+ }
+ }
+ }
// END: handle opened files
/// Handle **text** dropped onto the Dock icon