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
@@ -104,6 +104,21 @@ class _GeneralSettingsScreenState extends State<GeneralSettingsScreen> {
],
),
const SizedBox(height: AppSpacing.lg),
SectionLabel(text: l10n.settingsSectionPrivacy),
SettingsGroupCard(
children: [
SettingsSwitchTile(
icon: Icons.security_rounded,
title: l10n.settingsDoNotSellTitle,
value: _settings.privacy.canSell,
tint: colors.primary,
background: colors.surfaceContainerHighest,
showDivider: false,
onChanged: (value) => _updatePrivacy(canSell: value),
),
],
),
const SizedBox(height: AppSpacing.lg),
SectionLabel(text: l10n.settingsSectionNotification),
SettingsGroupCard(
children: [
@@ -151,6 +166,15 @@ class _GeneralSettingsScreenState extends State<GeneralSettingsScreen> {
await widget.onSettingsChanged(_settings);
}
void _updatePrivacy({bool? canSell}) {
final newPrivacy = _settings.privacy.copyWith(canSell: canSell);
final newSettings = _settings.copyWith(privacy: newPrivacy);
setState(() {
_settings = newSettings;
});
widget.onSettingsChanged(newSettings);
}
void _updateNotification({bool? allowNotifications, bool? allowVibration}) {
final newNotification = _settings.notification.copyWith(
allowNotifications: allowNotifications,