Skip to content

Commit 7d7ce03

Browse files
[file_selector] Remove uses of macUTIs (flutter#3859)
A change to replace `macUTIs` with `uniformTypeIdentifiers` (with `macUTIs` staying as an alias for compatibility) landed a while ago in the platform interface, but the rest of the packages were never updated to use it. This removes uses from all other packages, in preparation for formally deprecating `macUTIs`. Mostly completes flutter#103743
1 parent 251010e commit 7d7ce03

File tree

18 files changed

+63
-65
lines changed

18 files changed

+63
-65
lines changed

packages/file_selector/file_selector/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 0.9.2+5
22

3+
* Updates references to the deprecated `macUTIs`.
34
* Aligns Dart and Flutter SDK constraints.
45

56
## 0.9.2+4

packages/file_selector/file_selector/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ Different platforms support different type group filter options. To avoid
9999
filters that cover all platforms you are targeting, or that you conditionally
100100
pass different `XTypeGroup`s based on `Platform`.
101101

102-
| | Linux | macOS | Web | Windows |
103-
|----------------|-------|--------|-----|-------------|
104-
| `extensions` | ✔️ | ✔️ | ✔️ | ✔️ |
105-
| `mimeTypes` | ✔️ | ✔️† | ✔️ | |
106-
| `macUTIs` | | ✔️ | | |
107-
| `webWildCards` | | | ✔️ | |
102+
| | iOS | Linux | macOS | Web | Windows |
103+
|--------------------------|-----|-------|--------|-----|-------------|
104+
| `extensions` | | ✔️ | ✔️ | ✔️ | ✔️ |
105+
| `mimeTypes` | | ✔️ | ✔️† | ✔️ | |
106+
| `uniformTypeIdentifiers` | ✔️ | | ✔️ | | |
107+
| `webWildCards` | | | | ✔️ | |
108108

109109
`mimeTypes` are not supported on version of macOS earlier than 11 (Big Sur).
110110

@@ -118,4 +118,4 @@ pass different `XTypeGroup`s based on `Platform`.
118118
| Choose a directory | Pick a folder and get its path || ✔️ | ✔️ | ✔️ ||
119119

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

packages/file_selector/file_selector/pubspec.yaml

Lines changed: 2 additions & 2 deletions
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/packages/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.9.2+4
6+
version: 0.9.2+5
77

88
environment:
99
sdk: ">=2.17.0 <4.0.0"
@@ -27,7 +27,7 @@ dependencies:
2727
file_selector_ios: ^0.5.0
2828
file_selector_linux: ^0.9.0
2929
file_selector_macos: ^0.9.0
30-
file_selector_platform_interface: ^2.2.0
30+
file_selector_platform_interface: ^2.3.0
3131
file_selector_web: ^0.9.0
3232
file_selector_windows: ^0.9.0
3333
flutter:

packages/file_selector/file_selector_ios/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.1+4
2+
3+
* Updates references to the deprecated `macUTIs`.
4+
15
## 0.5.1+3
26

37
* Updates pigeon to fix warnings with clang 15.

packages/file_selector/file_selector_ios/example/lib/open_image_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class OpenImagePage extends StatelessWidget {
1818
const XTypeGroup typeGroup = XTypeGroup(
1919
label: 'images',
2020
extensions: <String>['jpg', 'png'],
21-
macUTIs: <String>['public.image'],
21+
uniformTypeIdentifiers: <String>['public.image'],
2222
);
2323
final XFile? file = await FileSelectorPlatform.instance
2424
.openFile(acceptedTypeGroups: <XTypeGroup>[typeGroup]);

packages/file_selector/file_selector_ios/example/lib/open_multiple_images_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ class OpenMultipleImagesPage extends StatelessWidget {
1818
const XTypeGroup jpgsTypeGroup = XTypeGroup(
1919
label: 'JPEGs',
2020
extensions: <String>['jpg', 'jpeg'],
21-
macUTIs: <String>['public.jpeg'],
21+
uniformTypeIdentifiers: <String>['public.jpeg'],
2222
);
2323
const XTypeGroup pngTypeGroup = XTypeGroup(
2424
label: 'PNGs',
2525
extensions: <String>['png'],
26-
macUTIs: <String>['public.png'],
26+
uniformTypeIdentifiers: <String>['public.png'],
2727
);
2828
final List<XFile> files = await FileSelectorPlatform.instance
2929
.openFiles(acceptedTypeGroups: <XTypeGroup>[

packages/file_selector/file_selector_ios/example/lib/open_text_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class OpenTextPage extends StatelessWidget {
1515
const XTypeGroup typeGroup = XTypeGroup(
1616
label: 'text',
1717
extensions: <String>['txt', 'json'],
18-
macUTIs: <String>['public.text'],
18+
uniformTypeIdentifiers: <String>['public.text'],
1919
);
2020
final XFile? file = await FileSelectorPlatform.instance
2121
.openFile(acceptedTypeGroups: <XTypeGroup>[typeGroup]);

packages/file_selector/file_selector_ios/lib/file_selector_ios.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ class FileSelectorIOS extends FileSelectorPlatform {
5353
if (typeGroup.allowsAny) {
5454
return <String>[];
5555
}
56-
if (typeGroup.macUTIs?.isEmpty ?? true) {
56+
if (typeGroup.uniformTypeIdentifiers?.isEmpty ?? true) {
5757
throw ArgumentError('The provided type group $typeGroup should either '
58-
'allow all files, or have a non-empty "macUTIs"');
58+
'allow all files, or have a non-empty "uniformTypeIdentifiers"');
5959
}
60-
allowedUTIs.addAll(typeGroup.macUTIs!);
60+
allowedUTIs.addAll(typeGroup.uniformTypeIdentifiers!);
6161
}
6262
return allowedUTIs;
6363
}

packages/file_selector/file_selector_ios/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: file_selector_ios
22
description: iOS implementation of the file_selector plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
5-
version: 0.5.1+3
5+
version: 0.5.1+4
66

77
environment:
88
sdk: ">=2.18.0 <4.0.0"
@@ -17,7 +17,7 @@ flutter:
1717
pluginClass: FFSFileSelectorPlugin
1818

1919
dependencies:
20-
file_selector_platform_interface: ^2.2.0
20+
file_selector_platform_interface: ^2.3.0
2121
flutter:
2222
sdk: flutter
2323

packages/file_selector/file_selector_ios/test/file_selector_ios_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ void main() {
4040
label: 'text',
4141
extensions: <String>['txt'],
4242
mimeTypes: <String>['text/plain'],
43-
macUTIs: <String>['public.text'],
43+
uniformTypeIdentifiers: <String>['public.text'],
4444
);
4545

4646
const XTypeGroup groupTwo = XTypeGroup(
4747
label: 'image',
4848
extensions: <String>['jpg'],
4949
mimeTypes: <String>['image/jpg'],
50-
macUTIs: <String>['public.image'],
50+
uniformTypeIdentifiers: <String>['public.image'],
5151
webWildCards: <String>['image/*']);
5252

5353
await plugin.openFile(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -56,7 +56,7 @@ void main() {
5656
final FileSelectorConfig config =
5757
result.captured[0] as FileSelectorConfig;
5858

59-
// iOS only accepts macUTIs.
59+
// iOS only accepts uniformTypeIdentifiers.
6060
expect(listEquals(config.utis, <String>['public.text', 'public.image']),
6161
isTrue);
6262
expect(config.allowMultiSelection, isFalse);
@@ -92,14 +92,14 @@ void main() {
9292
label: 'text',
9393
extensions: <String>['txt'],
9494
mimeTypes: <String>['text/plain'],
95-
macUTIs: <String>['public.text'],
95+
uniformTypeIdentifiers: <String>['public.text'],
9696
);
9797

9898
const XTypeGroup groupTwo = XTypeGroup(
9999
label: 'image',
100100
extensions: <String>['jpg'],
101101
mimeTypes: <String>['image/jpg'],
102-
macUTIs: <String>['public.image'],
102+
uniformTypeIdentifiers: <String>['public.image'],
103103
webWildCards: <String>['image/*']);
104104

105105
await plugin.openFiles(acceptedTypeGroups: <XTypeGroup>[group, groupTwo]);
@@ -108,7 +108,7 @@ void main() {
108108
final FileSelectorConfig config =
109109
result.captured[0] as FileSelectorConfig;
110110

111-
// iOS only accepts macUTIs.
111+
// iOS only accepts uniformTypeIdentifiers.
112112
expect(listEquals(config.utis, <String>['public.text', 'public.image']),
113113
isTrue);
114114
expect(config.allowMultiSelection, isTrue);

0 commit comments

Comments
 (0)