diff --git a/.gitignore b/.gitignore index db81ab80..1354c8e4 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,3 @@ example/ios/Flutter/flutter_export_environment.sh example/.flutter-plugins-dependencies file_picker/example/.flutter-plugins-dependencies file_picker/example/ios/Flutter/flutter_export_environment.sh -example/macos diff --git a/CHANGELOG.md b/CHANGELOG.md index f3212d2b..57fe3aa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,18 @@ +## 8.2.0 +### Desktop (macOS) +- Reimplement macOS file picker using method channels (fixes [#1492](https://github.com/miguelpruivo/flutter_file_picker/issues/1492), [#1445](https://github.com/miguelpruivo/flutter_file_picker/issues/1445), [#1674](https://github.com/miguelpruivo/flutter_file_picker/issues/1674), [#1685](https://github.com/miguelpruivo/flutter_file_picker/issues/1685)) + ## 8.1.7 ### iOS -Fix Image Picker to Handle Partial Failures Gracefully [#1554](https://github.com/miguelpruivo/flutter_file_picker/issues/1554) +- Fix Image Picker to Handle Partial Failures Gracefully [#1554](https://github.com/miguelpruivo/flutter_file_picker/issues/1554) ## 8.1.6 ### Android -Fix [#1643](https://github.com/miguelpruivo/flutter_file_picker/issues/1643) +- Fix Android compile error [#1643](https://github.com/miguelpruivo/flutter_file_picker/issues/1643) ## 8.1.5 ### Android -Fix [#872](https://github.com/miguelpruivo/flutter_file_picker/issues/872) +- Fix [#872](https://github.com/miguelpruivo/flutter_file_picker/issues/872) by removing unnecessary external storage permission ## 8.1.4 ### iOS diff --git a/example/.gitignore b/example/.gitignore index 24476c5d..6c319542 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -5,9 +5,11 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ migrate_working_dir/ # IntelliJ related diff --git a/example/macos/.gitignore b/example/macos/.gitignore new file mode 100644 index 00000000..f7f775c4 --- /dev/null +++ b/example/macos/.gitignore @@ -0,0 +1,8 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ +Flutter/GeneratedPluginRegistrant.* diff --git a/example/macos/Flutter/Flutter-Debug.xcconfig b/example/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 00000000..4b81f9b2 --- /dev/null +++ b/example/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Flutter/Flutter-Release.xcconfig b/example/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 00000000..5caa9d15 --- /dev/null +++ b/example/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Podfile b/example/macos/Podfile new file mode 100644 index 00000000..c795730d --- /dev/null +++ b/example/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..66dade26 --- /dev/null +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,803 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + A22ABF1545C676F16995EC7E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 411DF655999EC8932DA963E8 /* Pods_Runner.framework */; }; + C51B5854AE141E70802B0281 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932EC8AB5D293E73C56B1959 /* Pods_RunnerTests.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 04B03B77F4E2F15928C67E43 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 16D629275E6BBB16BDEB3BA6 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* file_picker_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = file_picker_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 411DF655999EC8932DA963E8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6ABF3BC6E2FB0435839D28B3 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 932EC8AB5D293E73C56B1959 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + A54E29CEDF0D070022BD651D /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + AAD8B1FF325ECF68FAA1DC89 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + B56D2E20021F050A3964B9C5 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C51B5854AE141E70802B0281 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A22ABF1545C676F16995EC7E /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + 802D160251B7282FA0690D21 /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* file_picker_example.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + 802D160251B7282FA0690D21 /* Pods */ = { + isa = PBXGroup; + children = ( + B56D2E20021F050A3964B9C5 /* Pods-Runner.debug.xcconfig */, + 04B03B77F4E2F15928C67E43 /* Pods-Runner.release.xcconfig */, + AAD8B1FF325ECF68FAA1DC89 /* Pods-Runner.profile.xcconfig */, + A54E29CEDF0D070022BD651D /* Pods-RunnerTests.debug.xcconfig */, + 16D629275E6BBB16BDEB3BA6 /* Pods-RunnerTests.release.xcconfig */, + 6ABF3BC6E2FB0435839D28B3 /* Pods-RunnerTests.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 411DF655999EC8932DA963E8 /* Pods_Runner.framework */, + 932EC8AB5D293E73C56B1959 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 9F9FE7962BF6EA6A99ED4A9E /* [CP] Check Pods Manifest.lock */, + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 94C0333E33863CD99A2E9185 /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + 1B9B2678FCF62B44B2FE18B6 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* file_picker_example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 1B9B2678FCF62B44B2FE18B6 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + 94C0333E33863CD99A2E9185 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 9F9FE7962BF6EA6A99ED4A9E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = A54E29CEDF0D070022BD651D /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.mr.flutter.plugin.filePickerExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/file_picker_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/file_picker_example"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 16D629275E6BBB16BDEB3BA6 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.mr.flutter.plugin.filePickerExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/file_picker_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/file_picker_example"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6ABF3BC6E2FB0435839D28B3 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.mr.flutter.plugin.filePickerExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/file_picker_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/file_picker_example"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.13; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.13; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.13; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..a378a57a --- /dev/null +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..21a3cc14 --- /dev/null +++ b/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/macos/Runner/AppDelegate.swift b/example/macos/Runner/AppDelegate.swift new file mode 100644 index 00000000..b3c17614 --- /dev/null +++ b/example/macos/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } +} diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..a2ec33f1 --- /dev/null +++ b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 00000000..82b6f9d9 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 00000000..13b35eba Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 00000000..0a3f5fa4 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 00000000..bdb57226 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 00000000..f083318e Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 00000000..326c0e72 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 00000000..2f1632cf Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/example/macos/Runner/Base.lproj/MainMenu.xib b/example/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 00000000..80e867a4 --- /dev/null +++ b/example/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/macos/Runner/Configs/AppInfo.xcconfig b/example/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 00000000..31325293 --- /dev/null +++ b/example/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = file_picker_example + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.mr.flutter.plugin.filePickerExample + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2025 com.mr.flutter.plugin. All rights reserved. diff --git a/example/macos/Runner/Configs/Debug.xcconfig b/example/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 00000000..36b0fd94 --- /dev/null +++ b/example/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/example/macos/Runner/Configs/Release.xcconfig b/example/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 00000000..dff4f495 --- /dev/null +++ b/example/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/example/macos/Runner/Configs/Warnings.xcconfig b/example/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 00000000..42bcbf47 --- /dev/null +++ b/example/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/example/macos/Runner/DebugProfile.entitlements b/example/macos/Runner/DebugProfile.entitlements new file mode 100644 index 00000000..466aa1a7 --- /dev/null +++ b/example/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,14 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.server + + + diff --git a/example/macos/Runner/Info.plist b/example/macos/Runner/Info.plist new file mode 100644 index 00000000..4789daa6 --- /dev/null +++ b/example/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/example/macos/Runner/MainFlutterWindow.swift b/example/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 00000000..3cc05eb2 --- /dev/null +++ b/example/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/example/macos/Runner/Release.entitlements b/example/macos/Runner/Release.entitlements new file mode 100644 index 00000000..19afff14 --- /dev/null +++ b/example/macos/Runner/Release.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-write + + + diff --git a/example/macos/RunnerTests/RunnerTests.swift b/example/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 00000000..c2087f21 --- /dev/null +++ b/example/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Cocoa +import FlutterMacOS +import XCTest + +@testable import file_picker + +// This demonstrates a simple unit test of the Swift portion of this plugin's implementation. +// +// See https://developer.apple.com/documentation/xctest for more information about using XCTest. + +class RunnerTests: XCTestCase { +} diff --git a/example/screenshots/example_macos.png b/example/screenshots/example_macos.png index 20ebe769..d222870c 100644 Binary files a/example/screenshots/example_macos.png and b/example/screenshots/example_macos.png differ diff --git a/lib/src/file_picker.dart b/lib/src/file_picker.dart index dc03e7ab..dba929e2 100644 --- a/lib/src/file_picker.dart +++ b/lib/src/file_picker.dart @@ -50,13 +50,16 @@ abstract class FilePicker extends PlatformInterface { /// which can be useful if you are picking it for server upload or similar. However, have in mind that /// enabling this on IO (iOS & Android) may result in out of memory issues if you allow multiple picks or /// pick huge files. Use [withReadStream] instead. Defaults to `true` on web, `false` otherwise. + /// Not supported on macOS. /// /// If [withReadStream] is set, picked files will have its byte data available as a [Stream>] /// which can be useful for uploading and processing large files. Defaults to `false`. + /// Not supported on macOS. /// /// If you want to track picking status, for example, because some files may take some time to be /// cached (particularly those picked from cloud providers), you may want to set [onFileLoading] handler /// that will give you the current status of picking. + /// Not supported on macOS. /// /// If [allowCompression] is set, it will allow media to apply the default OS compression. /// Defaults to `true`. @@ -64,20 +67,27 @@ abstract class FilePicker extends PlatformInterface { /// If [lockParentWindow] is set, the child window (file picker window) will /// stay in front of the Flutter window until it is closed (like a modal /// window). This parameter works only on Windows desktop. + /// On macOS the parent window will be locked and this parameter is ignored. /// - /// [dialogTitle] can be optionally set on desktop platforms to set the modal window title. It will be ignored on - /// other platforms. + /// [dialogTitle] can be optionally set on desktop platforms to set the modal window title. + /// Not supported on macOS. It will be ignored on other platforms. /// /// [initialDirectory] can be optionally set to an absolute path to specify /// where the dialog should open. Only supported on Linux, macOS, and Windows. + /// On macOS the home directory shortcut (~/) is not necessary and passing it will be ignored. + /// On macOS if the [initialDirectory] is invalid the user directory or previously valid directory + /// will be used. /// /// [readSequential] can be optionally set on web to keep the import file order during import. + /// Not supported on macOS. /// /// The result is wrapped in a [FilePickerResult] which contains helper getters /// with useful information regarding the picked [List]. /// /// For more information, check the [API documentation](https://github.com/miguelpruivo/flutter_file_picker/wiki/api). /// + /// Note: This requires the User Selected File Read entitlement on macOS. + /// /// Returns `null` if aborted. Future pickFiles({ String? dialogTitle, @@ -112,14 +122,19 @@ abstract class FilePicker extends PlatformInterface { /// On Android, this requires to be running on SDK 21 or above, else won't work. /// Note: Some Android paths are protected, hence can't be accessed and will return `/` instead. /// - /// [dialogTitle] can be set to display a custom title on desktop platforms. It will be ignored on Web & IO. + /// [dialogTitle] can be set to display a custom title on desktop platforms. + /// Not supported on macOS. It will be ignored on other platforms. /// /// If [lockParentWindow] is set, the child window (file picker window) will /// stay in front of the Flutter window until it is closed (like a modal /// window). This parameter works only on Windows desktop. + /// On macOS the parent window will be locked and this parameter is ignored. /// /// [initialDirectory] can be optionally set to an absolute path to specify /// where the dialog should open. Only supported on Linux, macOS, and Windows. + /// On macOS the home directory shortcut (~/) is not necessary and passing it will be ignored. + /// On macOS if the [initialDirectory] is invalid the user directory or previously valid directory + /// will be used. /// /// Returns a [Future] which resolves to the absolute path of the selected directory, /// if the user selected a directory. Returns `null` if the user aborted the dialog or if the @@ -128,6 +143,7 @@ abstract class FilePicker extends PlatformInterface { /// Note: on Windows, throws a `WindowsException` with a detailed error message, if the dialog /// could not be instantiated or the dialog result could not be interpreted. /// Note: Some Android paths are protected, hence can't be accessed and will return `/` instead. + /// Note: The User Selected File Read entitlement is required on macOS. Future getDirectoryPath({ String? dialogTitle, bool lockParentWindow = false, @@ -139,11 +155,14 @@ abstract class FilePicker extends PlatformInterface { /// name to save a file. /// /// For mobile platforms, this function will save file with [bytes] to return a path. + /// Throws UnsupportedError on macOS if bytes are provided. /// - /// For desktop platforms (Linux, macOS & Windows),This function does not actually + /// For desktop platforms (Linux, macOS & Windows) this function does not actually /// save a file. It only opens the dialog to let the user choose a location and /// file name. This function only returns the **path** to this (non-existing) file. /// + /// The User Selected File Read/Write entitlement is required on macOS. + /// /// [dialogTitle] can be set to display a custom title on desktop platforms. /// /// [fileName] can be set to a non-empty string to provide a default file @@ -152,6 +171,9 @@ abstract class FilePicker extends PlatformInterface { /// /// [initialDirectory] can be optionally set to an absolute path to specify /// where the dialog should open. Only supported on Linux, macOS, and Windows. + /// On macOS the home directory shortcut (~/) is not necessary and passing it will be ignored. + /// On macOS if the [initialDirectory] is invalid the user directory or previously valid directory + /// will be used. /// /// The file type filter [type] defaults to [FileType.any]. Optionally, /// [allowedExtensions] might be provided (e.g. `[pdf, svg, jpg]`.). Both diff --git a/lib/src/file_picker_macos.dart b/lib/src/file_picker_macos.dart index 0ac3c7f1..cb2ddffc 100644 --- a/lib/src/file_picker_macos.dart +++ b/lib/src/file_picker_macos.dart @@ -1,13 +1,17 @@ -import 'dart:typed_data'; - import 'package:file_picker/file_picker.dart'; import 'package:file_picker/src/utils.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; class FilePickerMacOS extends FilePicker { static void registerWith() { FilePicker.platform = FilePickerMacOS(); } + @visibleForTesting + final methodChannel = + const MethodChannel('miguelruivo.flutter.plugins.filepicker'); + @override Future pickFiles({ String? dialogTitle, @@ -23,30 +27,23 @@ class FilePickerMacOS extends FilePicker { bool lockParentWindow = false, bool readSequential = false, }) async { - final String executable = await isExecutableOnPath('osascript'); - final String fileFilter = fileTypeToFileFilter( + final fileFilter = fileTypeToFileFilter( type, allowedExtensions, ); - final List arguments = generateCommandLineArguments( - escapeDialogTitle(dialogTitle ?? defaultDialogTitle), - fileFilter: fileFilter, - initialDirectory: initialDirectory ?? '', - multipleFiles: allowMultiple, - pickDirectory: false, - ); - final String? fileSelectionResult = await runExecutableWithArguments( - executable, - arguments, + final filePaths = await methodChannel.invokeListMethod( + 'pickFiles', + { + 'allowedExtensions': fileFilter, + 'initialDirectory': escapeInitialDirectory(initialDirectory), + 'allowMultiple': allowMultiple, + }, ); - if (fileSelectionResult == null) { + if (filePaths == null) { return null; } - final List filePaths = resultStringToFilePaths( - fileSelectionResult, - ); final List platformFiles = await filePathsToPlatformFiles( filePaths, withReadStream, @@ -62,22 +59,14 @@ class FilePickerMacOS extends FilePicker { bool lockParentWindow = false, String? initialDirectory, }) async { - final String executable = await isExecutableOnPath('osascript'); - final List arguments = generateCommandLineArguments( - escapeDialogTitle(dialogTitle ?? defaultDialogTitle), - initialDirectory: initialDirectory ?? '', - pickDirectory: true, + final String? directoryPath = await methodChannel.invokeMethod( + 'getDirectoryPath', + { + 'initialDirectory': escapeInitialDirectory(initialDirectory), + }, ); - final String? directorySelectionResult = await runExecutableWithArguments( - executable, - arguments, - ); - if (directorySelectionResult == null) { - return null; - } - - return resultStringToFilePaths(directorySelectionResult).first; + return directoryPath; } @override @@ -90,31 +79,29 @@ class FilePickerMacOS extends FilePicker { Uint8List? bytes, bool lockParentWindow = false, }) async { - final String executable = await isExecutableOnPath('osascript'); - final String fileFilter = fileTypeToFileFilter( + if (bytes != null) { + throw UnsupportedError('Bytes are not supported on macOS'); + } + final fileFilter = fileTypeToFileFilter( type, allowedExtensions, ); - final List arguments = generateCommandLineArguments( - escapeDialogTitle(dialogTitle ?? defaultDialogTitle), - fileFilter: fileFilter, - fileName: fileName ?? '', - initialDirectory: initialDirectory ?? '', - saveFile: true, - ); - final String? saveFileResult = await runExecutableWithArguments( - executable, - arguments, + final String? savedFilePath = await methodChannel.invokeMethod( + 'saveFile', + { + 'dialogTitle': escapeDialogTitle(dialogTitle ?? defaultDialogTitle), + 'fileName': fileName, + 'initialDirectory': escapeInitialDirectory(initialDirectory), + 'allowedExtensions': fileFilter, + }, ); - if (saveFileResult == null) { - return null; - } - return resultStringToFilePaths(saveFileResult).first; + return savedFilePath; } - String fileTypeToFileFilter(FileType type, List? allowedExtensions) { + List fileTypeToFileFilter( + FileType type, List? allowedExtensions) { if (type != FileType.custom && (allowedExtensions?.isNotEmpty ?? false)) { throw ArgumentError.value( allowedExtensions, @@ -125,97 +112,61 @@ class FilePickerMacOS extends FilePicker { } switch (type) { case FileType.any: - return ''; + return []; case FileType.audio: - return '"aac", "midi", "mp3", "ogg", "wav"'; + return ["aac", "midi", "mp3", "ogg", "wav"]; case FileType.custom: - return '"", "${allowedExtensions!.join('", "')}"'; + return [...?allowedExtensions]; case FileType.image: - return '"bmp", "gif", "jpeg", "jpg", "png"'; + return ["bmp", "gif", "jpeg", "jpg", "png"]; case FileType.media: - return '"avi", "flv", "m4v", "mkv", "mov", "mp4", "mpeg", "webm", "wmv", "bmp", "gif", "jpeg", "jpg", "png"'; + return [ + "avi", + "flv", + "m4v", + "mkv", + "mov", + "mp4", + "mpeg", + "webm", + "wmv", + "bmp", + "gif", + "jpeg", + "jpg", + "png" + ]; case FileType.video: - return '"avi", "flv", "mkv", "mov", "mp4", "m4v", "mpeg", "webm", "wmv"'; + return [ + "avi", + "flv", + "mkv", + "mov", + "mp4", + "m4v", + "mpeg", + "webm", + "wmv" + ]; } } - List generateCommandLineArguments( - String dialogTitle, { - String fileFilter = '', - String fileName = '', - String initialDirectory = '', - bool multipleFiles = false, - bool pickDirectory = false, - bool saveFile = false, - }) { - final arguments = ['-e']; - - String argument = 'choose '; - if (pickDirectory) { - argument += 'folder '; - } else { - argument += 'file '; - - if (saveFile) { - argument += 'name '; - - if (fileName.isNotEmpty) { - argument += 'default name "$fileName" '; - } - } else { - if (fileFilter.isNotEmpty) { - argument += 'of type {$fileFilter} '; - } - - if (multipleFiles) { - argument += 'with multiple selections allowed '; - } - } + String? escapeInitialDirectory(String? initialDirectory) { + if (initialDirectory == null) { + return null; } - - if (initialDirectory.isNotEmpty) { - argument += 'default location "$initialDirectory" '; + // if starts with ~/ or ~ then remove it + if (initialDirectory.startsWith('~/')) { + return initialDirectory.substring(2); } - - argument += 'with prompt "$dialogTitle"'; - arguments.add(argument); - - return arguments; + if (initialDirectory.startsWith('~')) { + return initialDirectory.substring(1); + } + return initialDirectory; } String escapeDialogTitle(String dialogTitle) => dialogTitle .replaceAll('\\', '\\\\') .replaceAll('"', '\\"') .replaceAll('\n', '\\\n'); - - /// Transforms the result string (stdout) of `osascript` into a [List] of - /// POSIX file paths. - List resultStringToFilePaths(String fileSelectionResult) { - if (fileSelectionResult.trim().isEmpty) { - return []; - } - - final paths = fileSelectionResult - .trim() - .split(', alias ') - .map((String path) => path.trim()) - .where((String path) => path.isNotEmpty) - .toList(); - - if (paths.length == 1 && paths.first.startsWith('file ')) { - // The first token of the first path is "file" in case of the save file - // dialog - paths[0] = paths[0].substring(5); - } else if (paths.isNotEmpty && paths.first.startsWith('alias ')) { - // The first token of the first path is "alias" in case of the - // file/directory picker dialog - paths[0] = paths[0].substring(6); - } - - return paths.map((String path) { - final pathElements = path.split(':').where((e) => e.isNotEmpty).toList(); - final volumeName = pathElements[0]; - return ['/Volumes', volumeName, ...pathElements.sublist(1)].join('/'); - }).toList(); - } } diff --git a/macos/Classes/FilePickerPlugin.swift b/macos/Classes/FilePickerPlugin.swift new file mode 100644 index 00000000..3fcbac85 --- /dev/null +++ b/macos/Classes/FilePickerPlugin.swift @@ -0,0 +1,141 @@ +import Cocoa +import FlutterMacOS +import UniformTypeIdentifiers + +public class FilePickerPlugin: NSObject, FlutterPlugin { + public static func register(with registrar: FlutterPluginRegistrar) { + let channel = FlutterMethodChannel( + name: "miguelruivo.flutter.plugins.filepicker", + binaryMessenger: registrar.messenger) + let instance = FilePickerPlugin() + registrar.addMethodCallDelegate(instance, channel: channel) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) + { + switch call.method { + case "pickFiles": + handleFileSelection(call, result: result) + + case "getDirectoryPath": + handleDirectorySelection(call, result: result) + + case "saveFile": + handleSaveFile(call, result: result) + + default: + result(FlutterMethodNotImplemented) + } + } + + private func handleFileSelection( + _ call: FlutterMethodCall, result: @escaping FlutterResult + ) { + let dialog = NSOpenPanel() + let args = call.arguments as! [String: Any] + + dialog.directoryURL = URL( + fileURLWithPath: args["initialDirectory"] as? String ?? "" + ) + dialog.showsHiddenFiles = false + let allowMultiple = args["allowMultiple"] as? Bool ?? false + dialog.allowsMultipleSelection = allowMultiple + dialog.canChooseDirectories = false + dialog.canChooseFiles = true + let extensions = args["allowedExtensions"] as? [String] ?? [] + applyExtensions(dialog, extensions) + + if dialog.runModal() == NSApplication.ModalResponse.OK { + if allowMultiple { + let pathResult = dialog.urls + if pathResult.isEmpty { + result(nil) + } else { + let paths = pathResult.map { $0.path } + result(paths) + } + } else { + let pathResult = dialog.url + if pathResult == nil { + result(nil) + } else { + result([pathResult!.path]) + } + } + return + } else { + // User dismissed the dialog + result(nil) + return + } + } + + private func handleDirectorySelection( + _ call: FlutterMethodCall, result: @escaping FlutterResult + ) { + let dialog = NSOpenPanel() + let args = call.arguments as! [String: Any] + + dialog.directoryURL = URL( + fileURLWithPath: args["initialDirectory"] as? String ?? "" + ) + dialog.showsHiddenFiles = false + dialog.allowsMultipleSelection = false + dialog.canChooseDirectories = true + dialog.canChooseFiles = false + + if dialog.runModal() == NSApplication.ModalResponse.OK { + if let url = dialog.url { + result(url.path) + return + } + } + // User dismissed the dialog + result(nil) + } + + private func handleSaveFile( + _ call: FlutterMethodCall, result: @escaping FlutterResult + ) { + let dialog = NSSavePanel() + let args = call.arguments as! [String: Any] + + dialog.title = args["dialogTitle"] as? String ?? "" + dialog.showsTagField = false + dialog.showsHiddenFiles = false + dialog.canCreateDirectories = true + dialog.nameFieldStringValue = args["fileName"] as? String ?? "" + + if let initialDirectory = args["initialDirectory"] as? String, + !initialDirectory.isEmpty + { + dialog.directoryURL = URL(fileURLWithPath: initialDirectory) + } + + let extensions = args["allowedExtensions"] as? [String] ?? [] + applyExtensions(dialog, extensions) + + if dialog.runModal() == NSApplication.ModalResponse.OK { + if let url = dialog.url { + result(url.path) + return + } + } + // User dismissed the dialog + result(nil) + } + + /// Applies extensions to dialog using appropriate API + private func applyExtensions(_ dialog: NSSavePanel, _ extensions: [String]) { + if !extensions.isEmpty { + if #available(macOS 11.0, *) { + let contentTypes = extensions.compactMap { ext in + UTType(filenameExtension: ext) + } + dialog.allowedContentTypes = contentTypes + } else { + dialog.allowedFileTypes = extensions + } + } + } +} diff --git a/macos/Resources/PrivacyInfo.xcprivacy b/macos/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 00000000..918d80be --- /dev/null +++ b/macos/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,12 @@ + + + + + NSPrivacyTrackingDomains + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/macos/file_picker.podspec b/macos/file_picker.podspec new file mode 100644 index 00000000..98c29490 --- /dev/null +++ b/macos/file_picker.podspec @@ -0,0 +1,25 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint file_picker.podspec` to validate before publishing. +# +Pod::Spec.new do |s| + s.name = 'file_picker' + s.version = '0.0.1' + s.summary = 'A flutter plugin to show native file picker dialogs' + s.description = <<-DESC +A flutter plugin to show native file picker dialogs + DESC + s.homepage = 'https://github.com/miguelpruivo/plugins_flutter_file_picker' + s.license = { :file => '../LICENSE' } + s.author = 'Miguel Ruivo, Dominik Roszkowski' + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + + s.resource_bundles = {'file_picker_privacy' => ['Resources/PrivacyInfo.xcprivacy']} + + s.dependency 'FlutterMacOS' + + s.platform = :osx, '10.13' + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.swift_version = '5.0' +end diff --git a/pubspec.yaml b/pubspec.yaml index 3e0427d5..9f9ff0a0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A package that allows you to use a native file explorer to pick sin homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker repository: https://github.com/miguelpruivo/flutter_file_picker issue_tracker: https://github.com/miguelpruivo/flutter_file_picker/issues -version: 8.1.7 +version: 8.2.0 dependencies: flutter: @@ -42,6 +42,7 @@ flutter: pluginClass: FilePickerWeb fileName: _internal/file_picker_web.dart macos: + pluginClass: FilePickerPlugin dartPluginClass: FilePickerMacOS windows: dartPluginClass: FilePickerWindows diff --git a/test/file_picker_macos_test.dart b/test/file_picker_macos_test.dart index b52db869..f103e398 100644 --- a/test/file_picker_macos_test.dart +++ b/test/file_picker_macos_test.dart @@ -12,30 +12,45 @@ void main() { expect( picker.fileTypeToFileFilter(FileType.any, null), - equals(''), + equals([]), ); expect( picker.fileTypeToFileFilter(FileType.audio, null), - equals('"aac", "midi", "mp3", "ogg", "wav"'), + equals(["aac", "midi", "mp3", "ogg", "wav"]), ); expect( picker.fileTypeToFileFilter(FileType.image, null), - equals('"bmp", "gif", "jpeg", "jpg", "png"'), + equals(["bmp", "gif", "jpeg", "jpg", "png"]), ); expect( picker.fileTypeToFileFilter(FileType.media, null), equals( - '"avi", "flv", "m4v", "mkv", "mov", "mp4", "mpeg", "webm", "wmv", "bmp", "gif", "jpeg", "jpg", "png"', + [ + "avi", + "flv", + "m4v", + "mkv", + "mov", + "mp4", + "mpeg", + "webm", + "wmv", + "bmp", + "gif", + "jpeg", + "jpg", + "png" + ], ), ); expect( picker.fileTypeToFileFilter(FileType.video, null), equals( - '"avi", "flv", "mkv", "mov", "mp4", "m4v", "mpeg", "webm", "wmv"', + ["avi", "flv", "mkv", "mov", "mp4", "m4v", "mpeg", "webm", "wmv"], ), ); }); @@ -45,20 +60,14 @@ void main() { () { final picker = FilePickerMacOS(); - // TODO: the first empty file type ("", ) is required in some cases, e.g. - // when filtering for *.dart and other special file types. Unfortunately, - // the empty file type enables the selection of files without extension. - // In other cases, e.g. when filtering for *.png files, it isn't required - // to provide the empty file type. We need to find a solution to make the - // filter work without having to provide an empty file type first. expect( picker.fileTypeToFileFilter(FileType.custom, ['dart']), - equals('"", "dart"'), + equals(["dart"]), ); expect( picker.fileTypeToFileFilter(FileType.custom, ['dart', 'html']), - equals('"", "dart", "html"'), + equals(["dart", "html"]), ); }); }); @@ -105,291 +114,42 @@ void main() { }); }); - group('resultStringToFilePaths()', () { - test('should interpret the result of picking no files', () { - final picker = FilePickerMacOS(); + group('escapeInitialDirectory()', () { + late FilePickerMacOS picker; - final filePaths = picker.resultStringToFilePaths(' '); - expect(filePaths.length, equals(0)); - expect(filePaths.length, equals(0)); + setUp(() { + picker = FilePickerMacOS(); }); - test('should interpret the result of picking a single file', () { - final picker = FilePickerMacOS(); - - final filePaths = picker.resultStringToFilePaths( - 'alias macOS:Users:john:Downloads:config.yml', - ); - - expect(filePaths.length, equals(1)); - expect(filePaths[0], - equals('/Volumes/macOS/Users/john/Downloads/config.yml')); + test('should return null when input is null', () { + expect(picker.escapeInitialDirectory(null), isNull); }); - test('should interpret the result of picking two files', () { - final picker = FilePickerMacOS(); - - final filePaths = picker.resultStringToFilePaths( - 'alias macOS:System:usr:lib:lib.dylib, alias macOS:System:usr:lib:libA.dylib', - ); - - expect(filePaths.length, equals(2)); - expect(filePaths[0], equals('/Volumes/macOS/System/usr/lib/lib.dylib')); - expect(filePaths[1], equals('/Volumes/macOS/System/usr/lib/libA.dylib')); - }); - - test('should interpret the result of picking a directory', () { - final picker = FilePickerMacOS(); - - final filePaths = picker.resultStringToFilePaths( - 'alias macOS:System:iOSSupport:usr:lib:swift:', - ); - - expect(filePaths.length, equals(1)); - expect(filePaths[0], - equals('/Volumes/macOS/System/iOSSupport/usr/lib/swift')); - }); - - test( - 'should interpret the result of picking a file from an external hard drive', - () { - final picker = FilePickerMacOS(); - - final filePaths = picker.resultStringToFilePaths( - 'alias Western Digital Backup:backups:2021:photos:july:image1.jpg', - ); - - expect(filePaths.length, equals(1)); + test('should remove ~/ from the beginning of the path', () { expect( - filePaths[0], - equals( - '/Volumes/Western Digital Backup/backups/2021/photos/july/image1.jpg', - ), + picker.escapeInitialDirectory('~/Documents'), + equals('Documents'), ); }); - test( - 'should interpret the result of picking multiple files from an external hard drive', - () { - final picker = FilePickerMacOS(); - - final filePaths = picker.resultStringToFilePaths( - 'alias WD Backup:photos:my screenshot.jpg, alias WD Backup:photos:christmas.png, alias WD Backup:photos:image33.png', - ); - expect(filePaths.length, equals(3)); + test('should remove single ~ from the beginning of the path', () { expect( - filePaths[0], equals('/Volumes/WD Backup/photos/my screenshot.jpg')); - expect(filePaths[1], equals('/Volumes/WD Backup/photos/christmas.png')); - expect(filePaths[2], equals('/Volumes/WD Backup/photos/image33.png')); - }); - - test( - 'should interpret the result of picking a directory from an external hard drive', - () { - final picker = FilePickerMacOS(); - - final filePaths = picker.resultStringToFilePaths( - 'alias TAILS 4.20 - 202:EFI:debian:grub:x86_64-efi:', - ); - - expect(filePaths.length, equals(1)); - expect( - filePaths[0], - equals('/Volumes/TAILS 4.20 - 202/EFI/debian/grub/x86_64-efi'), - ); - }); - - test( - 'should interpret the result of picking filenames that contain blanks and commas', - () { - final picker = FilePickerMacOS(); - - final filePaths = picker.resultStringToFilePaths( - 'alias Macintosh:Users:JohnDoe:test, test.csv, alias macOS Base System:bin:unicorn , generator.sh', - ); - - expect(filePaths.length, equals(2)); - expect( - filePaths[0], - equals('/Volumes/Macintosh/Users/JohnDoe/test, test.csv'), - ); - expect( - filePaths[1], - equals('/Volumes/macOS Base System/bin/unicorn , generator.sh'), - ); - }); - - test('should interpret the result of the save file dialog', () { - final picker = FilePickerMacOS(); - - final filePaths = picker.resultStringToFilePaths( - 'file macOS:Users:JohnDoe:Desktop:bill.pdf', - ); - - expect(filePaths.length, equals(1)); - expect( - filePaths[0], - equals('/Volumes/macOS/Users/JohnDoe/Desktop/bill.pdf'), + picker.escapeInitialDirectory('~Documents'), + equals('Documents'), ); }); - }); - - group('generateCommandLineArguments()', () { - test('should generate the arguments for picking a single file', () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Select a file:', - multipleFiles: false, - pickDirectory: false, - ); + test('should not modify path without tilde', () { expect( - cliArguments.join(' '), - equals('-e choose file with prompt "Select a file:"'), + picker.escapeInitialDirectory('/Users/Documents'), + equals('/Users/Documents'), ); }); - test('should generate the arguments for the save-file dialog', () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Select output file:', - multipleFiles: false, - pickDirectory: false, - saveFile: true, - fileName: 'test.out', - ); - + test('should handle empty string', () { expect( - cliArguments.join(' '), - equals( - '-e choose file name default name "test.out" with prompt "Select output file:"'), - ); - }); - - test('should generate the arguments for picking multiple files', () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Select files:', - multipleFiles: true, - pickDirectory: false, - ); - - expect( - cliArguments.join(' '), - equals( - '-e choose file with multiple selections allowed with prompt "Select files:"', - ), - ); - }); - - test( - 'should generate the arguments for picking a single file with a custom file filter', - () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Select a file:', - fileFilter: '"dart", "yml"', - multipleFiles: false, - pickDirectory: false, - ); - - expect( - cliArguments.join(' '), - equals( - '-e choose file of type {"dart", "yml"} with prompt "Select a file:"'), - ); - }); - - test( - 'should generate the arguments for picking multiple files with a custom file filter', - () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Select HTML files:', - fileFilter: '"html"', - multipleFiles: true, - pickDirectory: false, - ); - - expect( - cliArguments.join(' '), - equals( - '-e choose file of type {"html"} with multiple selections allowed with prompt "Select HTML files:"', - ), - ); - }); - - test('should generate the arguments for picking a directory', () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Select a directory:', - pickDirectory: true, - ); - - expect( - cliArguments.join(' '), - equals('-e choose folder with prompt "Select a directory:"'), - ); - }); - - test( - 'should generate the arguments for picking a file when an initial directory is given', - () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Pick a file:', - initialDirectory: '/Users/john/Desktop', - ); - - expect( - cliArguments.join(' '), - equals( - '-e choose file default location "/Users/john/Desktop" with prompt "Pick a file:"'), - ); - }); - - test( - 'should generate the arguments for picking a directory when an initial directory is given', - () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Pick directory:', - fileName: 'output.pdf', - initialDirectory: '/Users/john/workspace', - pickDirectory: true, - ); - - expect( - cliArguments.join(' '), - equals( - '-e choose folder default location "/Users/john/workspace" with prompt "Pick directory:"'), - ); - }); - - test( - 'should generate the arguments for saving a file when an initial directory is given', - () { - final picker = FilePickerMacOS(); - - final cliArguments = picker.generateCommandLineArguments( - 'Save as:', - fileName: 'output.pdf', - initialDirectory: '/Users/john/Downloads', - saveFile: true, - ); - - expect( - cliArguments.join(' '), - equals( - '-e choose file name default name "output.pdf" default location "/Users/john/Downloads" with prompt "Save as:"'), + picker.escapeInitialDirectory(''), + equals(''), ); }); });