Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 8189a2c

Browse files
[file_selector] Update macOS README and example (#5034)
1 parent 0d5cf74 commit 8189a2c

7 files changed

Lines changed: 90 additions & 3 deletions

File tree

packages/file_selector/file_selector/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.8.4+1
2+
3+
* Adds README information about macOS entitlements.
4+
* Adds necessary entitlement to macOS example.
5+
16
## 0.8.4
27

38
* Adds an endorsed macOS implementation.

packages/file_selector/file_selector/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@ A Flutter plugin that manages files and interactions with file dialogs.
77
## Usage
88
To use this plugin, add `file_selector` as a [dependency in your pubspec.yaml file](https://flutter.dev/platform-plugins/).
99

10+
### macOS
11+
12+
You will need to [add an entitlement][entitlement] for either read-only access:
13+
```
14+
<key>com.apple.security.files.user-selected.read-only</key>
15+
<true/>
16+
```
17+
or read/write access:
18+
```
19+
<key>com.apple.security.files.user-selected.read-write</key>
20+
<true/>
21+
```
22+
depending on your use case.
23+
1024
### Examples
11-
Here are small examples that show you how to use the API.
25+
Here are small examples that show you how to use the API.
1226
Please also take a look at our [example][example] app.
1327

1428
#### Open a single file
@@ -34,3 +48,4 @@ await file.saveTo(path);
3448
```
3549

3650
[example]:./example
51+
[entitlement]: https://docs.flutter.dev/desktop#entitlements-and-the-app-sandbox

packages/file_selector/file_selector/example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
2727
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
2828
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
29+
6BA632E5BE2B856B0D473EBF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6D20B684858422917AB21A6 /* Pods_Runner.framework */; };
2930
/* End PBXBuildFile section */
3031

3132
/* Begin PBXContainerItemProxy section */
@@ -52,9 +53,10 @@
5253
/* End PBXCopyFilesBuildPhase section */
5354

5455
/* Begin PBXFileReference section */
56+
17DF935FF296A265D8BE378B /* 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 = "<group>"; };
5557
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
5658
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
57-
33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
59+
33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
5860
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5961
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
6062
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
@@ -66,15 +68,19 @@
6668
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
6769
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
6870
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
71+
453A41FF685B9AACDF48F0C6 /* 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 = "<group>"; };
72+
6FA96861AA2D76C12832F6C9 /* 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 = "<group>"; };
6973
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
7074
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
75+
C6D20B684858422917AB21A6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7176
/* End PBXFileReference section */
7277

7378
/* Begin PBXFrameworksBuildPhase section */
7479
33CC10EA2044A3C60003C045 /* Frameworks */ = {
7580
isa = PBXFrameworksBuildPhase;
7681
buildActionMask = 2147483647;
7782
files = (
83+
6BA632E5BE2B856B0D473EBF /* Pods_Runner.framework in Frameworks */,
7884
);
7985
runOnlyForDeploymentPostprocessing = 0;
8086
};
@@ -99,6 +105,7 @@
99105
33CEB47122A05771004F2AC0 /* Flutter */,
100106
33CC10EE2044A3C60003C045 /* Products */,
101107
D73912EC22F37F3D000D13A0 /* Frameworks */,
108+
58708F6C9D1522F09C51DA54 /* Pods */,
102109
);
103110
sourceTree = "<group>";
104111
};
@@ -145,9 +152,21 @@
145152
path = Runner;
146153
sourceTree = "<group>";
147154
};
155+
58708F6C9D1522F09C51DA54 /* Pods */ = {
156+
isa = PBXGroup;
157+
children = (
158+
453A41FF685B9AACDF48F0C6 /* Pods-Runner.debug.xcconfig */,
159+
17DF935FF296A265D8BE378B /* Pods-Runner.release.xcconfig */,
160+
6FA96861AA2D76C12832F6C9 /* Pods-Runner.profile.xcconfig */,
161+
);
162+
name = Pods;
163+
path = Pods;
164+
sourceTree = "<group>";
165+
};
148166
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
149167
isa = PBXGroup;
150168
children = (
169+
C6D20B684858422917AB21A6 /* Pods_Runner.framework */,
151170
);
152171
name = Frameworks;
153172
sourceTree = "<group>";
@@ -159,11 +178,13 @@
159178
isa = PBXNativeTarget;
160179
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
161180
buildPhases = (
181+
A778864BDDD7B12C41D66FBB /* [CP] Check Pods Manifest.lock */,
162182
33CC10E92044A3C60003C045 /* Sources */,
163183
33CC10EA2044A3C60003C045 /* Frameworks */,
164184
33CC10EB2044A3C60003C045 /* Resources */,
165185
33CC110E2044A8840003C045 /* Bundle Framework */,
166186
3399D490228B24CF009A79C7 /* ShellScript */,
187+
028A8DA36859BD4F05694F96 /* [CP] Embed Pods Frameworks */,
167188
);
168189
buildRules = (
169190
);
@@ -233,6 +254,23 @@
233254
/* End PBXResourcesBuildPhase section */
234255

235256
/* Begin PBXShellScriptBuildPhase section */
257+
028A8DA36859BD4F05694F96 /* [CP] Embed Pods Frameworks */ = {
258+
isa = PBXShellScriptBuildPhase;
259+
buildActionMask = 2147483647;
260+
files = (
261+
);
262+
inputFileListPaths = (
263+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
264+
);
265+
name = "[CP] Embed Pods Frameworks";
266+
outputFileListPaths = (
267+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
268+
);
269+
runOnlyForDeploymentPostprocessing = 0;
270+
shellPath = /bin/sh;
271+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
272+
showEnvVarsInLog = 0;
273+
};
236274
3399D490228B24CF009A79C7 /* ShellScript */ = {
237275
isa = PBXShellScriptBuildPhase;
238276
buildActionMask = 2147483647;
@@ -270,6 +308,28 @@
270308
shellPath = /bin/sh;
271309
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
272310
};
311+
A778864BDDD7B12C41D66FBB /* [CP] Check Pods Manifest.lock */ = {
312+
isa = PBXShellScriptBuildPhase;
313+
buildActionMask = 2147483647;
314+
files = (
315+
);
316+
inputFileListPaths = (
317+
);
318+
inputPaths = (
319+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
320+
"${PODS_ROOT}/Manifest.lock",
321+
);
322+
name = "[CP] Check Pods Manifest.lock";
323+
outputFileListPaths = (
324+
);
325+
outputPaths = (
326+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
327+
);
328+
runOnlyForDeploymentPostprocessing = 0;
329+
shellPath = /bin/sh;
330+
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";
331+
showEnvVarsInLog = 0;
332+
};
273333
/* End PBXShellScriptBuildPhase section */
274334

275335
/* Begin PBXSourcesBuildPhase section */

packages/file_selector/file_selector/example/macos/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/file_selector/file_selector/example/macos/Runner/DebugProfile.entitlements

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
<true/>
99
<key>com.apple.security.network.server</key>
1010
<true/>
11+
<key>com.apple.security.files.user-selected.read-write</key>
12+
<true/>
1113
</dict>
1214
</plist>

packages/file_selector/file_selector/example/macos/Runner/Release.entitlements

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
<dict>
55
<key>com.apple.security.app-sandbox</key>
66
<true/>
7+
<key>com.apple.security.files.user-selected.read-write</key>
8+
<true/>
79
</dict>
810
</plist>

packages/file_selector/file_selector/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for opening and saving files, or selecting
33
directories, using native file selection UI.
44
repository: https://github.com/flutter/plugins/tree/main/packages/file_selector/file_selector
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
6-
version: 0.8.4
6+
version: 0.8.4+1
77

88
environment:
99
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)