Skip to content

Commit 9d42f82

Browse files
authored
Add PrivacyInfo.xcprivacy to macOS plugin template (flutter#155570)
macOS version of flutter#148485 without NSPrivacyAccessedAPITypes. Fixes flutter#155563
1 parent 52d8d07 commit 9d42f82

File tree

7 files changed

+52
-4
lines changed

7 files changed

+52
-4
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSPrivacyTrackingDomains</key>
6+
<array/>
7+
<key>NSPrivacyCollectedDataTypes</key>
8+
<array/>
9+
<key>NSPrivacyTracking</key>
10+
<false/>
11+
</dict>
12+
</plist>

packages/flutter_tools/templates/plugin_shared/macos.tmpl/projectName.podspec.tmpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ Pod::Spec.new do |s|
2626
{{^withSwiftPackageManager}}
2727
s.source_files = 'Classes/**/*'
2828
{{/withSwiftPackageManager}}
29+
30+
# If your plugin requires a privacy manifest, for example if it collects user
31+
# data, update the PrivacyInfo.xcprivacy file to describe your plugin's
32+
# privacy impact, and then uncomment this line. For more information,
33+
# see https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
34+
{{#withSwiftPackageManager}}
35+
# s.resource_bundles = {'{{projectName}}_privacy' => ['{{projectName}}/Sources/{{projectName}}/PrivacyInfo.xcprivacy']}
36+
{{/withSwiftPackageManager}}
37+
{{^withSwiftPackageManager}}
38+
# s.resource_bundles = {'{{projectName}}_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
39+
{{/withSwiftPackageManager}}
40+
2941
s.dependency 'FlutterMacOS'
3042

3143
s.platform = :osx, '10.11'

packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ let package = Package(
1717
name: "{{projectName}}",
1818
dependencies: [],
1919
resources: [
20-
.process("Resources"),
20+
// If your plugin requires a privacy manifest, for example if it collects user
21+
// data, update the PrivacyInfo.xcprivacy file to describe your plugin's
22+
// privacy impact, and then uncomment these lines. For more information, see
23+
// https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
24+
// .process("PrivacyInfo.xcprivacy"),
25+
26+
// If you have other resources that need to be bundled with your plugin, refer to
27+
// the following instructions to add them:
28+
// https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package
2129
]
2230
)
2331
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSPrivacyTrackingDomains</key>
6+
<array/>
7+
<key>NSPrivacyCollectedDataTypes</key>
8+
<array/>
9+
<key>NSPrivacyTracking</key>
10+
<false/>
11+
</dict>
12+
</plist>

packages/flutter_tools/templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep

Whitespace-only changes.

packages/flutter_tools/templates/template_manifest.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@
339339
"templates/plugin_cocoapods/ios.tmpl/Assets/.gitkeep",
340340
"templates/plugin_cocoapods/ios.tmpl/Resources/PrivacyInfo.xcprivacy",
341341
"templates/plugin_cocoapods/macos.tmpl/Classes/pluginClass.swift.tmpl",
342+
"templates/plugin_cocoapods/macos.tmpl/Resources/PrivacyInfo.xcprivacy",
342343

343344
"templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Sources/projectName.tmpl/include/projectName.tmpl/pluginClass.h.tmpl",
344345
"templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.m.tmpl",
@@ -349,6 +350,7 @@
349350
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep",
350351
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.swift.tmpl",
351352
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl",
353+
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy",
352354

353355
"templates/skeleton/assets/images/2.0x/flutter_logo.png.img.tmpl",
354356
"templates/skeleton/assets/images/3.0x/flutter_logo.png.img.tmpl",

packages/flutter_tools/test/commands.shard/permeable/create_test.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ void main() {
712712
testUsingContext('kotlin/swift plugin project without Swift Package Manager', () async {
713713
return _createProject(
714714
projectDir,
715-
<String>['--no-pub', '--template=plugin', '-a', 'kotlin', '--ios-language', 'swift', '--platforms', 'ios,android'],
715+
<String>['--no-pub', '--template=plugin', '-a', 'kotlin', '--ios-language', 'swift', '--platforms', 'android,ios,macos'],
716716
<String>[
717717
'analysis_options.yaml',
718718
'android/src/main/kotlin/com/example/flutter_project/FlutterProjectPlugin.kt',
@@ -722,6 +722,8 @@ void main() {
722722
'example/lib/main.dart',
723723
'ios/Classes/FlutterProjectPlugin.swift',
724724
'ios/Resources/PrivacyInfo.xcprivacy',
725+
'macos/Classes/FlutterProjectPlugin.swift',
726+
'macos/Resources/PrivacyInfo.xcprivacy',
725727
'lib/flutter_project.dart',
726728
],
727729
unexpectedPaths: <String>[
@@ -736,7 +738,7 @@ void main() {
736738
);
737739
}, overrides: <Type, Generator>{
738740
// Test flags disable Swift Package Manager.
739-
FeatureFlags: () => TestFeatureFlags(),
741+
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
740742
});
741743

742744
testUsingContext('swift plugin project with Swift Package Manager', () async {
@@ -749,7 +751,7 @@ void main() {
749751
'ios/flutter_project/Sources/flutter_project/PrivacyInfo.xcprivacy',
750752
'macos/flutter_project/Package.swift',
751753
'macos/flutter_project/Sources/flutter_project/FlutterProjectPlugin.swift',
752-
'macos/flutter_project/Sources/flutter_project/Resources/.gitkeep',
754+
'macos/flutter_project/Sources/flutter_project/PrivacyInfo.xcprivacy',
753755
],
754756
unexpectedPaths: <String>[
755757
'ios/Classes/FlutterProjectPlugin.swift',

0 commit comments

Comments
 (0)