From 127e0124417abec65763e2c4b76df47d424bcfa1 Mon Sep 17 00:00:00 2001 From: fulleni Date: Sat, 19 Jul 2025 06:56:24 +0100 Subject: [PATCH 1/2] refactor(app): improve remote config handling and logging - Replace hardcoded 'app_config' with constant kRemoteConfigId - Rename variable 'appConfig' to 'remoteConfig' for clarity - Update log message to use 'Remote Config' instead of 'AppConfig' - Improve code readability by formatting the emit statement --- lib/app/bloc/app_bloc.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/app/bloc/app_bloc.dart b/lib/app/bloc/app_bloc.dart index 7511698..a26ae9c 100644 --- a/lib/app/bloc/app_bloc.dart +++ b/lib/app/bloc/app_bloc.dart @@ -432,9 +432,9 @@ class AppBloc extends Bloc { ); try { - final appConfig = await _appConfigRepository.read(id: 'app_config'); + final remoteConfig = await _appConfigRepository.read(id: kRemoteConfigId); print( - '[AppBloc] AppConfig fetched successfully. ID: ${appConfig.id} for user: ${state.user!.id}', + '[AppBloc] Remote Config fetched successfully. ID: ${remoteConfig.id} for user: ${state.user!.id}', ); // Determine the correct status based on the existing user's role. @@ -444,7 +444,10 @@ class AppBloc extends Bloc { ? AppStatus.authenticated : AppStatus.anonymous; emit( - state.copyWith(remoteConfig: appConfig, status: newStatusBasedOnUser), + state.copyWith( + remoteConfig: remoteConfig, + status: newStatusBasedOnUser, + ), ); } on HtHttpException catch (e) { print( From d8fe0f6ead7163b4b0b8d64510d3a683ee294746 Mon Sep 17 00:00:00 2001 From: fulleni Date: Mon, 21 Jul 2025 17:12:18 +0100 Subject: [PATCH 2/2] refactor(http): remove unnecessary isWeb flag --- lib/bootstrap.dart | 1 - pubspec.lock | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/bootstrap.dart b/lib/bootstrap.dart index cbc7f2b..c44323d 100644 --- a/lib/bootstrap.dart +++ b/lib/bootstrap.dart @@ -44,7 +44,6 @@ Future bootstrap( httpClient = HtHttpClient( baseUrl: appConfig.baseUrl, tokenProvider: () => authenticationRepository.getAuthToken(), - isWeb: kIsWeb, logger: logger, ); authClient = HtAuthApi(httpClient: httpClient); diff --git a/pubspec.lock b/pubspec.lock index 88ec534..a0790ec 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -434,7 +434,7 @@ packages: description: path: "." ref: HEAD - resolved-ref: "6484a5641c3d633d286ea5848c5b7cf1e723ebc1" + resolved-ref: "3c50cd082406d4cacafe60ad097ba6fa6ba891eb" url: "https://github.com/headlines-toolkit/ht-http-client.git" source: git version: "0.0.0"