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:
@@ -46,7 +46,10 @@ class ProfileApi {
|
||||
'timezone': settings.preferences.timezone,
|
||||
'country': settings.preferences.country,
|
||||
},
|
||||
'privacy': settings.privacy,
|
||||
'privacy': {
|
||||
'can_sell': settings.privacy.canSell,
|
||||
'profile_visibility': settings.privacy.profileVisibility,
|
||||
},
|
||||
'notification': {
|
||||
'allow_notifications': settings.notification.allowNotifications,
|
||||
'allow_vibration': settings.notification.allowVibration,
|
||||
@@ -115,6 +118,17 @@ class ProfileApi {
|
||||
)
|
||||
: const PreferenceSettings();
|
||||
|
||||
final privacyRaw = settingsRaw is Map<String, dynamic>
|
||||
? settingsRaw['privacy']
|
||||
: null;
|
||||
final privacy = privacyRaw is Map<String, dynamic>
|
||||
? PrivacySettings(
|
||||
canSell: (privacyRaw['can_sell'] as bool?) ?? false,
|
||||
profileVisibility:
|
||||
(privacyRaw['profile_visibility'] as String?) ?? 'public',
|
||||
)
|
||||
: const PrivacySettings();
|
||||
|
||||
final notificationRaw = settingsRaw is Map<String, dynamic>
|
||||
? settingsRaw['notification']
|
||||
: null;
|
||||
@@ -150,10 +164,7 @@ class ProfileApi {
|
||||
avatarPath: json['avatar_path'] as String?,
|
||||
avatarUrl: json['avatar_url'] as String?,
|
||||
preferences: preferences,
|
||||
privacy: settingsRaw is Map<String, dynamic>
|
||||
? (settingsRaw['privacy'] as Map<String, dynamic>? ??
|
||||
const <String, dynamic>{})
|
||||
: const <String, dynamic>{},
|
||||
privacy: privacy,
|
||||
notification: notification,
|
||||
divinationTutorial: divinationTutorial,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user