fix: set profile to public by default (#1840)

This commit is contained in:
ggurdin 2025-02-18 15:21:16 -05:00 committed by GitHub
parent b1b5e998ce
commit 6ee37c0216
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 12 deletions

View file

@ -15,7 +15,7 @@ class ModelKey {
static const String userInterests = 'interests';
static const String l2LanguageKey = 'target_language';
static const String l1LanguageKey = 'source_language';
static const String publicProfile = 'public';
static const String publicProfile = 'public_profile';
static const String userId = 'user_id';
static const String toolSettings = 'tool_settings';
static const String userSettings = 'user_settings';

View file

@ -142,7 +142,7 @@ class SettingsLearningController extends State<SettingsLearning> {
? PangeaLanguage.byLangCode(_profile.userSettings.targetLanguage!)
: null;
bool get publicProfile => _profile.userSettings.publicProfile;
bool get publicProfile => _profile.userSettings.publicProfile ?? true;
LanguageLevelTypeEnum get cefrLevel => _profile.userSettings.cefrLevel;

View file

@ -286,7 +286,7 @@ class UserController extends BaseController {
/// Returns a boolean value indicating whether the user's profile is public.
bool get isPublic {
return profile.userSettings.publicProfile;
return profile.userSettings.publicProfile ?? true;
}
/// Retrieves the user's email address.

View file

@ -12,10 +12,10 @@ import '../../learning_settings/models/language_model.dart';
class UserSettings {
DateTime? dateOfBirth;
DateTime? createdAt;
bool autoPlayMessages;
bool? autoPlayMessages;
// bool itAutoPlay;
bool activatedFreeTrial;
bool publicProfile;
bool? publicProfile;
String? targetLanguage;
String? sourceLanguage;
String? country;
@ -25,10 +25,10 @@ class UserSettings {
UserSettings({
this.dateOfBirth,
this.createdAt,
this.autoPlayMessages = false,
this.autoPlayMessages,
// this.itAutoPlay = true,
this.activatedFreeTrial = false,
this.publicProfile = false,
this.publicProfile,
this.targetLanguage,
this.sourceLanguage,
this.country,
@ -43,10 +43,10 @@ class UserSettings {
createdAt: json[ModelKey.userCreatedAt] != null
? DateTime.parse(json[ModelKey.userCreatedAt])
: null,
autoPlayMessages: json[ModelKey.autoPlayMessages] ?? false,
autoPlayMessages: json[ModelKey.autoPlayMessages],
// itAutoPlay: json[ModelKey.itAutoPlay] ?? true,
activatedFreeTrial: json[ModelKey.activatedTrialKey] ?? false,
publicProfile: json[ModelKey.publicProfile] ?? false,
publicProfile: json[ModelKey.publicProfile],
targetLanguage: json[ModelKey.l2LanguageKey],
sourceLanguage: json[ModelKey.l1LanguageKey],
country: json[ModelKey.userCountry],
@ -351,7 +351,7 @@ class PangeaProfile {
String? sourceLanguage;
String? country;
bool publicProfile;
bool? publicProfile;
PangeaProfile({
required this.createdAt,
@ -360,7 +360,7 @@ class PangeaProfile {
this.targetLanguage,
this.sourceLanguage,
this.country,
this.publicProfile = false,
this.publicProfile,
});
factory PangeaProfile.fromJson(Map<String, dynamic> json) {
@ -377,7 +377,7 @@ class PangeaProfile {
dateOfBirth: json[ModelKey.userDateOfBirth],
targetLanguage: l2,
sourceLanguage: l1,
publicProfile: json[ModelKey.publicProfile] ?? false,
publicProfile: json[ModelKey.publicProfile],
country: json[ModelKey.userCountry],
);
}