feat(privacy): add personalized ads toggle in settings

- Add PrivacySettings schema with can_sell field (default: false)
- Move privacy toggle to GeneralSettingsScreen with clear labeling
- Update l10n for zh/en/zh_hant with user-friendly copy
- Clean up redundant PrivacyNotificationSettingsScreen
- Update profile-protocol.md to reflect new privacy schema
- Fix basedpyright warnings in user.py
This commit is contained in:
qzl
2026-04-17 13:11:09 +08:00
parent be30eb6eab
commit 913ed26f8d
17 changed files with 417 additions and 163 deletions
+30 -3
View File
@@ -51,8 +51,19 @@ Response:
"timezone": "Asia/Shanghai",
"country": "CN"
},
"privacy": {},
"notification": {}
"privacy": {
"can_sell": false,
"profile_visibility": "public"
},
"notification": {
"allow_notifications": true,
"allow_vibration": true
},
"divination_tutorial": {
"divination_entry_shown": false,
"auto_divination_shown": false,
"manual_divination_shown": false
}
},
"updated_at": "2026-04-05T12:34:56+00:00"
}
@@ -105,7 +116,10 @@ Request:
"timezone": "Asia/Shanghai",
"country": "CN"
},
"privacy": {},
"privacy": {
"can_sell": false,
"profile_visibility": "public"
},
"notification": {
"allow_notifications": true,
"allow_vibration": true
@@ -125,6 +139,19 @@ Rules:
- Additional fields are forbidden.
- `divination_tutorial` tracks user's tutorial completion state for divination flows.
### Privacy settings
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `can_sell` | `bool` | `false` | Whether user's personal info can be used for personalized ads. `false` = opt-out (privacy protective default). |
| `profile_visibility` | `str` | `"public"` | Profile visibility level. Reserved for future use. |
**Compatibility note:**
- Previous versions used `privacy: {}` (empty object). This has been upgraded to a structured `PrivacySettings` schema.
- Strategy: `backward-compatible` — old `privacy: {}` payloads are accepted and normalized to default `PrivacySettings()`.
- Migration: No client action required; backend normalizes empty/missing privacy to defaults.
Response:
- Returns the same shape as `GET /users/me/profile`.