AI prompts
base on a cocoapods plugin to auto manager Xcode PrivacyInfo.xcprivacy file(create && search) # cocoapods-privacy
Apple 2024 will review the App's privacy manifests in the spring, and any apps that don't submit a privacy list may be called back. For now, the privacy list is broken down by component, to facilitate the maintenance of component privacy, cocoapods-privacy is developed for management.
[Click to view details on Apple](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files)
# Introduction
As name as,cocoapods-privacy is a plugin for privacy manifests, and focus on cocoapods!
## Installation
```
$ gem install cocoapods-privacy
```
## Usage
### init
First of all, you must set a json config to cocoapods-privacy, this is a defalut config.json
```
$ pod privacy config https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/config.json
```
There has 3 keys in defalut config, defalut rule is :To exclude retrieval a component that git source contains certain ‘github.com’ keywords
```
"source.white.list": [],
"source.black.list": ["github.com"],
"api.template.url": "https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/NSPrivacyAccessedAPITypes.plist"
```
* source.white.list : a white list of source, it effective in command 'pod privacy install' or 'pod install --privacy', will search white list for NSPrivacyAccessedAPITypes.
* when the whitelist is an empty array, it means all components are whitelist(default config).
* when the whitelist is not empty, it means only the components in the whitelist array are retrieved.
* source.black.list : a black list of source, defalut is ‘github.com’, based on the whitelist, the components need to be excluded。 it effective in command 'pod privacy install' or 'pod install --privacy'.
* api.template.url : its required, a template for search NSPrivacyAccessedAPITypes, you can use the provided by default。
If your needs are not met, you can custom! For example, there has some components,and it‘s your local config
```
"source.white.list": ["https://github.com/ReactiveCocoa/ReactiveObjC.git","git.yourserver.com","git.otherserver.com"],
"source.black.list": ["github.com","https://github.com/AFNetworking/AFNetworking.git"],
"api.template.url": "https://raw.githubusercontent.com/ymoyao/cocoapods-privacy/main/resources/NSPrivacyAccessedAPITypes.plist"
```
```
https://github.com/AFNetworking/AFNetworking.git ❌ (it's in 'github.com' black list)
https://github.com/ReactiveCocoa/ReactiveObjC.git ❌ (it's in 'github.com' black list, although also on the white list,but the blacklist priority is high when conflict)
https://git.yourserver.com/xxx/xxxx.git ✅
https://git.yourserver.com/mmm/mmm.git ✅
https://git.otherserver.com/ssss/ssss.git ✅
https://git.yourserver.com/AFNetworking/AFNetworking.git ✅
```
After custom,you just update config by local like this
```
$ pod privacy config /yourfilepath/config.json
```
In a word, if you define both white and black lists ,final search range: white list minus black list, and empty white list means all!
### To Component
```
$ pod privacy spec [podspec_file_path]
```
This command will auto create privacy file, and search the path of podspec' source_files' define relate to NSPrivacyAccessedAPITypes, finaly, write to PrivacyInfo.xcprivacy file.
if your component has much subspec, all subspec that define ‘source_files’ will create PrivacyInfo.xcprivacy, and auto modify .podspec link .xcprivacy to 'resource_bundle' key.
For example
* origin podspec
```
Pod::Spec.new do |s|
s.name = 'Demo'
...
s.source_files = 'xxxx'
s.subspec 'idfa' do |sp|
sp.source_files = 'xxxxx'
end
s.subspec 'noidfa' do |sp|
end
end
```
* podspec after commad 👇👇👇👇👇👇
```
Pod::Spec.new do |s|
s.name = 'Demo'
...
s.source_files = 'xxxx'
s.resource_bundle = {"Demo.privacy"=>"Pod/Privacy/Demo/PrivacyInfo.xcprivacy"}
s.subspec 'idfa' do |sp|
sp.source_files = 'xxxxx'
sp.resource_bundle = {"Demo.idfa.privacy"=>"Pod/Privacy/Demo.idfa/PrivacyInfo.xcprivacy"}
end
s.subspec 'noidfa' do |sp|
end
end
```
<img width="961" alt="截屏2024-02-02 11 23 21" src="https://github.com/ymoyao/cocoapods-privacy/assets/13619221/a6678c8e-c4aa-4f7d-8881-657c6d703657">
### To Project
```
$ pod install --privacy
or
$ pod privacy install
```
<img width="298" alt="截屏2024-02-02 10 59 59" src="https://github.com/ymoyao/cocoapods-privacy/assets/13619221/c6f10e36-0f62-497a-93d4-f8b336dc8df4">
After command, a PrivacyInfo.xcprivacy will create to you project Resources if empty.
Components that meet all of the following items will be processed.
* do not have their own privacy manifest file components
* in white list and not in black list components
* source code components(binary components please deal with command `pod privacy spec` )
## Notice
The plugin is focus on NSPrivacyAccessedAPITypes and automatically search and create workflow.
you should manager NSPrivacyCollectedDataTypes by yourself!
##
Could you please consider giving our repository a star🌟🌟🌟? It would mean a lot to us and help our project gain more visibility. Thank you!
", Assign "at most 3 tags" to the expected json: {"id":"8864","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"