@@ -99,7 +99,23 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
9999 );
100100 } on NotFoundException {
101101 // Settings not found for the user, create and persist defaults
102- final defaultSettings = UserAppSettings (id: event.userId);
102+ final defaultSettings = UserAppSettings (
103+ id: event.userId,
104+ displaySettings: const DisplaySettings (
105+ baseTheme: AppBaseTheme .system,
106+ accentTheme: AppAccentTheme .defaultBlue,
107+ fontFamily: 'SystemDefault' ,
108+ textScaleFactor: AppTextScaleFactor .medium,
109+ fontWeight: AppFontWeight .regular,
110+ ),
111+ language: 'en' ,
112+ feedPreferences: const FeedDisplayPreferences (
113+ headlineDensity: HeadlineDensity .standard,
114+ headlineImageStyle: HeadlineImageStyle .largeThumbnail,
115+ showSourceInHeadlineFeed: true ,
116+ showPublishDateInHeadlineFeed: true ,
117+ ),
118+ );
103119 emit (
104120 state.copyWith (
105121 status: SettingsStatus .success,
@@ -165,18 +181,12 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
165181 Emitter <SettingsState > emit,
166182 ) async {
167183 if (state.userAppSettings == null ) return ;
168- print (
169- '[SettingsBloc] _onAppFontTypeChanged: Received event.fontType: ${event .fontType }' ,
170- );
171184
172185 final updatedSettings = state.userAppSettings! .copyWith (
173186 displaySettings: state.userAppSettings! .displaySettings.copyWith (
174187 fontFamily: event.fontType,
175188 ),
176189 );
177- print (
178- '[SettingsBloc] _onAppFontTypeChanged: Updated settings.fontFamily: ${updatedSettings .displaySettings .fontFamily }' ,
179- );
180190 emit (state.copyWith (userAppSettings: updatedSettings, clearError: true ));
181191 await _persistSettings (updatedSettings, emit);
182192 }
@@ -186,18 +196,12 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
186196 Emitter <SettingsState > emit,
187197 ) async {
188198 if (state.userAppSettings == null ) return ;
189- print (
190- '[SettingsBloc] _onAppFontWeightChanged: Received event.fontWeight: ${event .fontWeight }' ,
191- );
192199
193200 final updatedSettings = state.userAppSettings! .copyWith (
194201 displaySettings: state.userAppSettings! .displaySettings.copyWith (
195202 fontWeight: event.fontWeight,
196203 ),
197204 );
198- print (
199- '[SettingsBloc] _onAppFontWeightChanged: Updated settings.fontWeight: ${updatedSettings .displaySettings .fontWeight }' ,
200- );
201205 emit (state.copyWith (userAppSettings: updatedSettings, clearError: true ));
202206 await _persistSettings (updatedSettings, emit);
203207 }
0 commit comments