Skip to content

Commit

Permalink
[various] Adds macOS privacy manifests (flutter#7687)
Browse files Browse the repository at this point in the history
macOS privacy manifest enforcement is rolling out soon, so this brings all macOS plugins into alignment with our iOS policy of always having a manifest, including updating the repo tooling to enforce that.

Very few plugins are affected because most share the implementation package with iOS, and we didn't do any target platform switching when adding the manifests for iOS, automatically covering macOS as well.

Fixes flutter#155564
  • Loading branch information
stuartmorgan authored Sep 24, 2024
1 parent 24594a0 commit 21d99dc
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/file_selector/file_selector_macos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.9.4+1

* Adds privacy manifest.
* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3.

## 0.9.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Displays native macOS open and save panels.
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_macos' }
s.source_files = 'file_selector_macos/Sources/file_selector_macos/**/*.swift'
s.resource_bundles = {'file_selector_macos_privacy' => ['file_selector_macos/Sources/file_selector_macos/Resources/PrivacyInfo.xcprivacy']}
s.dependency 'FlutterMacOS'

s.platform = :osx, '10.14'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ let package = Package(
targets: [
.target(
name: "file_selector_macos",
dependencies: []
dependencies: [],
resources: [
.process("Resources")
]
)
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion packages/file_selector/file_selector_macos/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: file_selector_macos
description: macOS implementation of the file_selector plugin.
repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_macos
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22
version: 0.9.4
version: 0.9.4+1

environment:
sdk: ^3.3.0
Expand Down
3 changes: 2 additions & 1 deletion packages/url_launcher/url_launcher_macos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 3.2.1

* Adds privacy manifest.
* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3.

## 3.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Pod::Spec.new do |s|
s.author = { 'Flutter Team' => 'flutter-dev@googlegroups.com' }
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_macos' }
s.source_files = 'url_launcher_macos/Sources/url_launcher_macos/**/*.swift'
s.resource_bundles = {'url_launcher_macos_privacy' => ['url_launcher_macos/Sources/url_launcher_macos/Resources/PrivacyInfo.xcprivacy']}
s.dependency 'FlutterMacOS'

s.platform = :osx, '10.14'
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion packages/url_launcher/url_launcher_macos/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: url_launcher_macos
description: macOS implementation of the url_launcher plugin.
repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_macos
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
version: 3.2.0
version: 3.2.1

environment:
sdk: ^3.3.0
Expand Down
3 changes: 2 additions & 1 deletion script/tool/lib/src/podspec_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class PodspecCheckCommand extends PackageLoopingCommand {
}
}

if (pluginSupportsPlatform(platformIOS, package) &&
if ((pluginSupportsPlatform(platformIOS, package) ||
pluginSupportsPlatform(platformMacOS, package)) &&
!podspecs.any(_hasPrivacyManifest)) {
printError('No PrivacyInfo.xcprivacy file specified. Please ensure that '
'a privacy manifest is included in the build using '
Expand Down
44 changes: 44 additions & 0 deletions script/tool/test/podspec_check_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -605,5 +605,49 @@ void main() {
<Matcher>[contains('Ran for 1 package(s)')],
));
});

test('fails when a macOS plugin is missing a privacy manifest', () async {
final RepositoryPackage plugin = createFakePlugin(
'plugin1',
packagesDir,
platformSupport: <String, PlatformDetails>{
Platform.macOS: const PlatformDetails(PlatformSupport.inline),
},
);
_writeFakePodspec(plugin, 'macos');

Error? commandError;
final List<String> output = await runCapturingPrint(
runner, <String>['podspec-check'], errorHandler: (Error e) {
commandError = e;
});

expect(commandError, isA<ToolExit>());
expect(
output,
containsAllInOrder(
<Matcher>[contains('No PrivacyInfo.xcprivacy file specified.')],
));
});

test('passes when a macOS plugin has a privacy manifest', () async {
final RepositoryPackage plugin = createFakePlugin(
'plugin1',
packagesDir,
platformSupport: <String, PlatformDetails>{
Platform.macOS: const PlatformDetails(PlatformSupport.inline),
},
);
_writeFakePodspec(plugin, 'macos', includePrivacyManifest: true);

final List<String> output =
await runCapturingPrint(runner, <String>['podspec-check']);

expect(
output,
containsAllInOrder(
<Matcher>[contains('Ran for 1 package(s)')],
));
});
});
}

0 comments on commit 21d99dc

Please sign in to comment.