diff --git a/packages/flutter_tools/templates/plugin/ios-objc.tmpl/projectName.podspec.tmpl b/packages/flutter_tools/templates/plugin/ios-objc.tmpl/projectName.podspec.tmpl index 65f69259b9a..73b68347ce3 100644 --- a/packages/flutter_tools/templates/plugin/ios-objc.tmpl/projectName.podspec.tmpl +++ b/packages/flutter_tools/templates/plugin/ios-objc.tmpl/projectName.podspec.tmpl @@ -26,4 +26,15 @@ Pod::Spec.new do |s| # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } + + # If your plugin requires a privacy manifest, for example if it uses any + # required reason APIs, update the PrivacyInfo.xcprivacy file to describe your + # plugin's privacy impact, and then uncomment this line. For more information, + # see https://developer.apple.com/documentation/bundleresources/privacy_manifest_files + {{#withSwiftPackageManager}} + # s.resource_bundles = {'{{projectName}}_privacy' => ['{{projectName}}/Sources/{{projectName}}/PrivacyInfo.xcprivacy']} + {{/withSwiftPackageManager}} + {{^withSwiftPackageManager}} + # s.resource_bundles = {'{{projectName}}_privacy' => ['Resources/PrivacyInfo.xcprivacy']} + {{/withSwiftPackageManager}} end diff --git a/packages/flutter_tools/templates/plugin/ios-swift.tmpl/projectName.podspec.tmpl b/packages/flutter_tools/templates/plugin/ios-swift.tmpl/projectName.podspec.tmpl index c1cde67129a..ff452b197bd 100644 --- a/packages/flutter_tools/templates/plugin/ios-swift.tmpl/projectName.podspec.tmpl +++ b/packages/flutter_tools/templates/plugin/ios-swift.tmpl/projectName.podspec.tmpl @@ -25,4 +25,15 @@ Pod::Spec.new do |s| # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.swift_version = '5.0' + + # If your plugin requires a privacy manifest, for example if it uses any + # required reason APIs, update the PrivacyInfo.xcprivacy file to describe your + # plugin's privacy impact, and then uncomment this line. For more information, + # see https://developer.apple.com/documentation/bundleresources/privacy_manifest_files + {{#withSwiftPackageManager}} + # s.resource_bundles = {'{{projectName}}_privacy' => ['{{projectName}}/Sources/{{projectName}}/PrivacyInfo.xcprivacy']} + {{/withSwiftPackageManager}} + {{^withSwiftPackageManager}} + # s.resource_bundles = {'{{projectName}}_privacy' => ['Resources/PrivacyInfo.xcprivacy']} + {{/withSwiftPackageManager}} end diff --git a/packages/flutter_tools/templates/plugin_cocoapods/ios.tmpl/Resources/PrivacyInfo.xcprivacy b/packages/flutter_tools/templates/plugin_cocoapods/ios.tmpl/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..a34b7e2e60c --- /dev/null +++ b/packages/flutter_tools/templates/plugin_cocoapods/ios.tmpl/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ + + + + + NSPrivacyTrackingDomains + + NSPrivacyAccessedAPITypes + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/packages/flutter_tools/templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Package.swift.tmpl b/packages/flutter_tools/templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Package.swift.tmpl index 31b08529fc2..27ec553167b 100644 --- a/packages/flutter_tools/templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Package.swift.tmpl +++ b/packages/flutter_tools/templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Package.swift.tmpl @@ -17,7 +17,15 @@ let package = Package( name: "{{projectName}}", dependencies: [], resources: [ - .process("Resources"), + // If your plugin requires a privacy manifest, for example if it uses any required + // reason APIs, update the PrivacyInfo.xcprivacy file to describe your plugin's + // privacy impact, and then uncomment these lines. For more information, see + // https://developer.apple.com/documentation/bundleresources/privacy_manifest_files + // .process("PrivacyInfo.xcprivacy"), + + // If you have other resources that need to be bundled with your plugin, refer to + // the following instructions to add them: + // https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package ], cSettings: [ .headerSearchPath("include/{{projectName}}"), diff --git a/packages/flutter_tools/templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Package.swift.tmpl b/packages/flutter_tools/templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Package.swift.tmpl index b387147eb20..a8d4f05feca 100644 --- a/packages/flutter_tools/templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Package.swift.tmpl +++ b/packages/flutter_tools/templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Package.swift.tmpl @@ -17,7 +17,15 @@ let package = Package( name: "{{projectName}}", dependencies: [], resources: [ - .process("Resources"), + // If your plugin requires a privacy manifest, for example if it uses any required + // reason APIs, update the PrivacyInfo.xcprivacy file to describe your plugin's + // privacy impact, and then uncomment these lines. For more information, see + // https://developer.apple.com/documentation/bundleresources/privacy_manifest_files + // .process("PrivacyInfo.xcprivacy"), + + // If you have other resources that need to be bundled with your plugin, refer to + // the following instructions to add them: + // https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package ] ) ] diff --git a/packages/flutter_tools/templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy b/packages/flutter_tools/templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy new file mode 100644 index 00000000000..a34b7e2e60c --- /dev/null +++ b/packages/flutter_tools/templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy @@ -0,0 +1,14 @@ + + + + + NSPrivacyTrackingDomains + + NSPrivacyAccessedAPITypes + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/packages/flutter_tools/templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep b/packages/flutter_tools/templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/packages/flutter_tools/templates/template_manifest.json b/packages/flutter_tools/templates/template_manifest.json index fe5c970e5d9..fbcaab30829 100644 --- a/packages/flutter_tools/templates/template_manifest.json +++ b/packages/flutter_tools/templates/template_manifest.json @@ -337,6 +337,7 @@ "templates/plugin_cocoapods/ios-objc.tmpl/Classes/pluginClass.m.tmpl", "templates/plugin_cocoapods/ios-swift.tmpl/Classes/pluginClass.swift.tmpl", "templates/plugin_cocoapods/ios.tmpl/Assets/.gitkeep", + "templates/plugin_cocoapods/ios.tmpl/Resources/PrivacyInfo.xcprivacy", "templates/plugin_cocoapods/macos.tmpl/Classes/pluginClass.swift.tmpl", "templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Sources/projectName.tmpl/include/projectName.tmpl/pluginClass.h.tmpl", @@ -344,7 +345,7 @@ "templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Package.swift.tmpl", "templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.swift.tmpl", "templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Package.swift.tmpl", - "templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep", + "templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy", "templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep", "templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.swift.tmpl", "templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl", diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index a8975081ae1..9407a991279 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -705,6 +705,7 @@ void main() { 'example/ios/Runner/Runner-Bridging-Header.h', 'example/lib/main.dart', 'ios/Classes/FlutterProjectPlugin.swift', + 'ios/Resources/PrivacyInfo.xcprivacy', 'lib/flutter_project.dart', ], unexpectedPaths: [ @@ -726,7 +727,7 @@ void main() { [ 'ios/flutter_project/Package.swift', 'ios/flutter_project/Sources/flutter_project/FlutterProjectPlugin.swift', - 'ios/flutter_project/Sources/flutter_project/Resources/.gitkeep', + 'ios/flutter_project/Sources/flutter_project/PrivacyInfo.xcprivacy', 'macos/flutter_project/Package.swift', 'macos/flutter_project/Sources/flutter_project/FlutterProjectPlugin.swift', 'macos/flutter_project/Sources/flutter_project/Resources/.gitkeep', @@ -755,7 +756,7 @@ void main() { 'ios/flutter_project/Package.swift', 'ios/flutter_project/Sources/flutter_project/include/flutter_project/FlutterProjectPlugin.h', 'ios/flutter_project/Sources/flutter_project/FlutterProjectPlugin.m', - 'ios/flutter_project/Sources/flutter_project/Resources/.gitkeep', + 'ios/flutter_project/Sources/flutter_project/PrivacyInfo.xcprivacy', ], unexpectedPaths: [ 'ios/Classes/FlutterProjectPlugin.swift',