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
@@ -84,6 +84,23 @@ class DivinationTutorialSettings {
}
}
class PrivacySettings {
const PrivacySettings({
this.canSell = false,
this.profileVisibility = 'public',
});
final bool canSell;
final String profileVisibility;
PrivacySettings copyWith({bool? canSell, String? profileVisibility}) {
return PrivacySettings(
canSell: canSell ?? this.canSell,
profileVisibility: profileVisibility ?? this.profileVisibility,
);
}
}
class ProfileSettingsV1 {
const ProfileSettingsV1({
this.version = 1,
@@ -92,7 +109,7 @@ class ProfileSettingsV1 {
this.avatarPath,
this.avatarUrl,
this.preferences = const PreferenceSettings(),
this.privacy = const <String, Object?>{},
this.privacy = const PrivacySettings(),
this.notification = const NotificationSettings(),
this.divinationTutorial = const DivinationTutorialSettings(),
});
@@ -103,7 +120,7 @@ class ProfileSettingsV1 {
final String? avatarPath;
final String? avatarUrl;
final PreferenceSettings preferences;
final Map<String, Object?> privacy;
final PrivacySettings privacy;
final NotificationSettings notification;
final DivinationTutorialSettings divinationTutorial;
@@ -114,7 +131,7 @@ class ProfileSettingsV1 {
String? avatarPath,
String? avatarUrl,
PreferenceSettings? preferences,
Map<String, Object?>? privacy,
PrivacySettings? privacy,
NotificationSettings? notification,
DivinationTutorialSettings? divinationTutorial,
}) {