mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
fix ios & macos
This commit is contained in:
@@ -21,6 +21,6 @@
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
<string>14.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@@ -3,7 +3,7 @@ import UIKit
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
@objc class AppDelegate: FlutterAppDelegate, UIDocumentPickerDelegate {
|
||||
var flutterResult: FlutterResult?
|
||||
var directoryPath: URL!
|
||||
|
||||
|
@@ -34,25 +34,25 @@ class AppDelegate: FlutterAppDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func getDirectoryPath() {
|
||||
func getDirectoryPath() {
|
||||
let openPanel = NSOpenPanel()
|
||||
openPanel.canChooseDirectories = true
|
||||
openPanel.canChooseFiles = false
|
||||
openPanel.allowsMultipleSelection = false
|
||||
|
||||
openPanel.begin { (result) in
|
||||
if result == .OK {
|
||||
self.directoryPath = openPanel.urls.first
|
||||
if !self.directoryPath?.startAccessingSecurityScopedResource() ?? false {
|
||||
self.flutterResult?(nil)
|
||||
return
|
||||
if result == .OK {
|
||||
self.directoryPath = openPanel.urls.first
|
||||
if let directoryPath = self.directoryPath, !directoryPath.startAccessingSecurityScopedResource() {
|
||||
self.flutterResult?(nil)
|
||||
return
|
||||
}
|
||||
self.flutterResult?(self.directoryPath?.path)
|
||||
} else {
|
||||
self.flutterResult?(nil)
|
||||
}
|
||||
self.flutterResult?(self.directoryPath?.path)
|
||||
} else {
|
||||
self.flutterResult?(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
|
||||
return true
|
||||
|
Reference in New Issue
Block a user