feat: make public profile toggle change public profile boolean instead of DOB (#1585)

This commit is contained in:
ggurdin 2025-01-24 17:10:40 -05:00 committed by GitHub
parent 88e7c240d7
commit a377200f5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,15 +37,7 @@ class SettingsLearningController extends State<SettingsLearning> {
pangeaController.userController.updateProfile(
(profile) {
// set user DOB to younger that 18 if private and older than 18 if public
if (isPublic) {
profile.userSettings.dateOfBirth = DateTime.now().subtract(
const Duration(days: 18 * 365),
);
} else {
profile.userSettings.dateOfBirth = DateTime.now().subtract(
const Duration(days: 17 * 365),
);
}
profile.userSettings.publicProfile = isPublic;
return profile;
},
);
@ -102,11 +94,7 @@ class SettingsLearningController extends State<SettingsLearning> {
}
bool get publicProfile =>
pangeaController.userController.profile.userSettings.dateOfBirth
?.isBefore(
DateTime.now().subtract(const Duration(days: 18 * 365)),
) ??
false;
pangeaController.userController.profile.userSettings.publicProfile;
@override
Widget build(BuildContext context) {