app privacy: one Apple purpose per Play purpose (advertising is Third-Party Advertising only; Developer's Advertising only from the owner), appPrivacy.types (owner answers per Apple type id: certain in console fill, proposed by scan without linked / tracking, compared by check with Info.plist and PrivacyInfo.xcprivacy)

This commit is contained in:
CRTkafa 2026-10-11 20:07:15 +00:00
parent 962cd3cb9d
commit 08e75dc673
17 changed files with 509 additions and 52 deletions

View file

@ -66,14 +66,21 @@ export const APPLE_PRIVACY: Record<string, [string, string]> = {
PSL_DEVICE_ID: ['Identifiers', 'Device ID'],
};
/** Play purpose -> App Privacy purpose. Advertising depends on who shows the ads (shared = third-party advertising). */
export function applePurpose(p: PlayPurpose, shared: boolean): string {
/**
* Play purpose -> the ONE App Privacy purpose it means (definitions: developer.apple.com/app-store/app-privacy-details/,
* quoted in cli/lib/app-privacy.ts). Play "advertising" is ads in the app, which in a mobile app or game come from an
* ad SDK: Third-Party Advertising, never also Developer's Advertising or Marketing (first-party ads, marketing to your
* own users): that one is only the owner's answer (appPrivacy.types.<ID>.purposes: DEVELOPERS_ADVERTISING). Play
* "communications" (news and notifications about the app) is App Functionality; marketing messages are the owner's
* call (console fill asks). Analytics is Analytics only, not Product Personalization; fraud prevention, account
* management and functionality are App Functionality.
*/
export function applePurpose(p: PlayPurpose): string {
switch (p) {
case 'analytics': return 'Analytics';
case 'advertising': return shared ? 'Third-Party Advertising' : 'Developer\'s Advertising or Marketing';
case 'communications': return 'Developer\'s Advertising or Marketing';
case 'advertising': return 'Third-Party Advertising';
case 'personalization': return 'Product Personalization';
default: return 'App Functionality';
default: return 'App Functionality'; // functionality, fraud, account, communications
}
}
@ -134,8 +141,7 @@ export function declarations(config: ShipConfig, inp: DeclarationInputs): Declar
const [category, name] = APPLE_PRIVACY[id] ?? ['Other Data', 'Other Data Types'];
const e = byType.get(name) ?? { apple: name, category, from: [], purposes: new Set<string>(), thirdParty: false };
e.from.push(id);
for (const p of u.collect) e.purposes.add(applePurpose(p, false));
for (const p of u.shared ? u.share ?? [] : []) e.purposes.add(applePurpose(p, true));
for (const p of [...u.collect, ...(u.shared ? u.share ?? [] : [])]) e.purposes.add(applePurpose(p));
e.thirdParty ||= !!u.shared;
byType.set(name, e);
}