|
| 1 | +import Foundation |
| 2 | + |
| 3 | +/// AppPrivacyConfiguration is mapping for prvacy manifest named PrivacyInfo.xcprivacy. |
| 4 | +/// |
| 5 | +/// refs: |
| 6 | +/// - https://developer.apple.com/documentation/bundleresources/privacy_manifest_files |
| 7 | +/// - https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/adding_a_privacy_manifest_to_your_app_or_third-party_sdk |
| 8 | +/// - https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests |
| 9 | +/// - https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api |
| 10 | +struct AppPrivacyConfiguration: Codable { |
| 11 | + var isTrackingEnabled: Bool? |
| 12 | + var trackingDomains: [String]? |
| 13 | + var privacyNutritionLabels: [PrivacyNutritionLabel] |
| 14 | + var privacyAccessedAPITypes: [PrivacyAccessedAPIType] |
| 15 | + |
| 16 | + enum CodingKeys: String, CodingKey { |
| 17 | + case isTrackingEnabled = "NSPrivacyTracking" |
| 18 | + case trackingDomains = "NSPrivacyTrackingDomains" |
| 19 | + case privacyNutritionLabels = "NSPrivacyCollectedDataTypes" |
| 20 | + case privacyAccessedAPITypes = "NSPrivacyAccessedAPITypes" |
| 21 | + } |
| 22 | + |
| 23 | + struct PrivacyNutritionLabel: Codable { |
| 24 | + var collectedDataType: CollectedDataType |
| 25 | + var isLinkedToUser: Bool |
| 26 | + var isUsedForTracking: Bool |
| 27 | + var collectionPurposes: [CollectionPurpose] |
| 28 | + |
| 29 | + enum CodingKeys: String, CodingKey { |
| 30 | + case collectedDataType = "NSPrivacyCollectedDataType" |
| 31 | + case isLinkedToUser = "NSPrivacyCollectedDataTypeLinked" |
| 32 | + case isUsedForTracking = "NSPrivacyCollectedDataTypeTracking" |
| 33 | + case collectionPurposes = "NSPrivacyCollectedDataTypePurposes" |
| 34 | + } |
| 35 | + |
| 36 | + enum CollectedDataType: String, Codable { |
| 37 | + case name = "NSPrivacyCollectedDataTypeName" |
| 38 | + case emailAddress = "NSPrivacyCollectedDataTypeEmailAddress" |
| 39 | + case phoneNumber = "NSPrivacyCollectedDataTypePhoneNumber" |
| 40 | + case physicalAddress = "NSPrivacyCollectedDataTypePhysicalAddress" |
| 41 | + case otherUserContactInfo = "NSPrivacyCollectedDataTypeOtherUserContactInfo" |
| 42 | + case health = "NSPrivacyCollectedDataTypeHealth" |
| 43 | + case fitness = "NSPrivacyCollectedDataTypeFitness" |
| 44 | + case paymentInfo = "NSPrivacyCollectedDataTypePaymentInfo" |
| 45 | + case creditInfo = "NSPrivacyCollectedDataTypeCreditInfo" |
| 46 | + case otherFinancialInfo = "NSPrivacyCollectedDataTypeOtherFinancialInfo" |
| 47 | + case preciseLocation = "NSPrivacyCollectedDataTypePreciseLocation" |
| 48 | + case coarseLocation = "NSPrivacyCollectedDataTypeCoarseLocation" |
| 49 | + case sensitiveInfo = "NSPrivacyCollectedDataTypeSensitiveInfo" |
| 50 | + case contacts = "NSPrivacyCollectedDataTypeContacts" |
| 51 | + case emailsOrTextMessages = "NSPrivacyCollectedDataTypeEmailsOrTextMessages" |
| 52 | + case photosOrVideos = "NSPrivacyCollectedDataTypePhotosorVideos" |
| 53 | + case audioData = "NSPrivacyCollectedDataTypeAudioData" |
| 54 | + case gameplayContent = "NSPrivacyCollectedDataTypeGameplayContent" |
| 55 | + case customerSupport = "NSPrivacyCollectedDataTypeCustomerSupport" |
| 56 | + case otherUserContent = "NSPrivacyCollectedDataTypeOtherUserContent" |
| 57 | + case browsingHistory = "NSPrivacyCollectedDataTypeBrowsingHistory" |
| 58 | + case searchHistory = "NSPrivacyCollectedDataTypeSearchHistory" |
| 59 | + case userId = "NSPrivacyCollectedDataTypeUserID" |
| 60 | + case deviceId = "NSPrivacyCollectedDataTypeDeviceID" |
| 61 | + case purchaseHistory = "NSPrivacyCollectedDataTypePurchaseHistory" |
| 62 | + case productInteraction = "NSPrivacyCollectedDataTypeProductInteraction" |
| 63 | + case advertisingData = "NSPrivacyCollectedDataTypeAdvertisingData" |
| 64 | + case otherUsageData = "NSPrivacyCollectedDataTypeOtherUsageData" |
| 65 | + case crashData = "NSPrivacyCollectedDataTypeCrashData" |
| 66 | + case performanceData = "NSPrivacyCollectedDataTypePerformanceData" |
| 67 | + case otherDiagnosticData = "NSPrivacyCollectedDataTypeOtherDiagnosticData" |
| 68 | + case environmentScanning = "NSPrivacyCollectedDataTypeEnvironmentScanning" |
| 69 | + case hands = "NSPrivacyCollectedDataTypeHands" |
| 70 | + case head = "NSPrivacyCollectedDataTypeHead" |
| 71 | + case otherDataTypes = "NSPrivacyCollectedDataTypeOtherDataTypes" |
| 72 | + } |
| 73 | + |
| 74 | + enum CollectionPurpose: String, Codable { |
| 75 | + case thirdPartyAdvertising = "NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising" |
| 76 | + case developerAdvertising = "NSPrivacyCollectedDataTypePurposeDeveloperAdvertising" |
| 77 | + case analytics = "NSPrivacyCollectedDataTypePurposeAnalytics" |
| 78 | + case productPersonalization = "NSPrivacyCollectedDataTypePurposeProductPersonalization" |
| 79 | + case appFunctionality = "NSPrivacyCollectedDataTypePurposeAppFunctionality" |
| 80 | + case purposeOther = "NSPrivacyCollectedDataTypePurposeOther" |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | + struct PrivacyAccessedAPIType: Codable { |
| 85 | + var accessedAPIType: String |
| 86 | + var accessedAPIReasons: [String] |
| 87 | + |
| 88 | + enum CodingKeys: String, CodingKey { |
| 89 | + case accessedAPIType = "NSPrivacyAccessedAPIType" |
| 90 | + case accessedAPIReasons = "NSPrivacyAccessedAPITypeReasons" |
| 91 | + } |
| 92 | + } |
| 93 | +} |
0 commit comments