From 08b4b42670160ee291f99db432318a0f06d33166 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 19:54:55 +0100 Subject: [PATCH 01/13] build(deps): update dependencies to latest versions - Update auth-related packages from v1.0.0 to v1.0.1 - Update core package from v1.2.0 to v1.3.1 - Update data-related packages from v1.0.0 to v1.0.1 - Update bloc from v9.0.0 to v9.1.0 - Update go_router from v16.2.2 to v16.3.0 - Update google_fonts from v6.3.1 to v6.3.2 - Update path_provider related packages to latest versions - Update shared_preferences related packages to latest versions --- pubspec.lock | 108 +++++++++++++++++++++++++-------------------------- pubspec.yaml | 24 ++++++------ 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 878a02f7..26b8991c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,46 +13,46 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: "7360a5a1af202bdc291138c81ddc817979454b78" + ref: "v1.0.1" + resolved-ref: f1d7000e990438efeadf3289f5145e15d547d6a2 url: "https://github.com/flutter-news-app-full-source-code/auth-api.git" source: git - version: "0.0.0" + version: "1.0.1" auth_client: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: a90e24285874e4c39cb331bbbeae2423901f3289 + ref: "v1.0.1" + resolved-ref: "605212aa4bf2a106691f447b824c66bb5218205c" url: "https://github.com/flutter-news-app-full-source-code/auth-client.git" source: git - version: "0.0.0" + version: "1.0.1" auth_inmemory: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: "5316331378ee90e13dbbb0966a964a4b02e4dfcf" + ref: "v1.0.1" + resolved-ref: b999691989447aff05a936414e6f6fdfbbb73a07 url: "https://github.com/flutter-news-app-full-source-code/auth-inmemory" source: git - version: "0.0.0" + version: "1.0.1" auth_repository: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: "0d751f835d563c970945a7dab828e1bcb4181049" + ref: "v1.0.1" + resolved-ref: e7db1f123d25448c1438843a7958e9aefaee22ab url: "https://github.com/flutter-news-app-full-source-code/auth-repository.git" source: git - version: "0.0.0" + version: "1.0.1" bloc: dependency: "direct main" description: name: bloc - sha256: "52c10575f4445c61dd9e0cafcc6356fdd827c4c64dd7945ef3c4105f6b6ac189" + sha256: a2cebb899f91d36eeeaa55c7b20b5915db5a9df1b8fd4a3c9c825e22e474537d url: "https://pub.dev" source: hosted - version: "9.0.0" + version: "9.1.0" bloc_concurrency: dependency: "direct main" description: @@ -89,11 +89,11 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.2.0" - resolved-ref: d052799c1ebb7bcdd1a725a2a7919948c14fa001 + ref: "v1.3.1" + resolved-ref: a03efff11b7577974cb444a1a6a46fee8b05ea42 url: "https://github.com/flutter-news-app-full-source-code/core.git" source: git - version: "1.2.0" + version: "1.3.1" crypto: dependency: transitive description: @@ -106,38 +106,38 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: b838da6b8c29ba3a54a68fe11402e7fe3886d135 + ref: "v1.0.1" + resolved-ref: bb361024cc2db5bd7252a2bef7ea4657cd3fe8a3 url: "https://github.com/flutter-news-app-full-source-code/data-api.git" source: git - version: "0.0.0" + version: "1.0.1" data_client: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: b9a8a8c2c660928c22f2d38d657000bcae4c74d6 + ref: "v1.0.1" + resolved-ref: "61e693e22e05c279a41304c98d68d96424b96df6" url: "https://github.com/flutter-news-app-full-source-code/data-client.git" source: git - version: "0.0.0" + version: "1.0.1" data_inmemory: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: cd7a39e12f321c4c0c6bb5041c5d91cb32bc1586 + ref: "v1.0.1" + resolved-ref: a54db1b8f49246b549e6211a4306aa57641172a9 url: "https://github.com/flutter-news-app-full-source-code/data-inmemory.git" source: git - version: "0.0.0" + version: "1.0.1" data_repository: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: "7f9242d810d60fefd2f883b19e1650e8e4eb41a3" + ref: "v1.0.1" + resolved-ref: "3e9115fc5229a6e84b81f44b74bc7df47824a00e" url: "https://github.com/flutter-news-app-full-source-code/data-repository.git" source: git - version: "0.0.0" + version: "1.0.1" data_table_2: dependency: "direct main" description: @@ -214,10 +214,10 @@ packages: dependency: "direct main" description: name: flex_color_scheme - sha256: "034d5720747e6af39b2ad090d82dd92d33fde68e7964f1814b714c9d49ddbd64" + sha256: "6e713c27a2ebe63393a44d4bf9cdd2ac81e112724a4c69905fc41cbf231af11d" url: "https://pub.dev" source: hosted - version: "8.3.0" + version: "8.3.1" flex_seed_scheme: dependency: transitive description: @@ -269,18 +269,18 @@ packages: dependency: "direct main" description: name: go_router - sha256: b1488741c9ce37b72e026377c69a59c47378493156fc38efb5a54f6def3f92a3 + sha256: d8f590a69729f719177ea68eb1e598295e8dbc41bbc247fed78b2c8a25660d7c url: "https://pub.dev" source: hosted - version: "16.2.2" + version: "16.3.0" google_fonts: dependency: "direct main" description: name: google_fonts - sha256: ebc94ed30fd13cefd397cb1658b593f21571f014b7d1197eeb41fb95f05d899a + sha256: "517b20870220c48752eafa0ba1a797a092fb22df0d89535fd9991e86ee2cdd9c" url: "https://pub.dev" source: hosted - version: "6.3.1" + version: "6.3.2" http: dependency: transitive description: @@ -294,10 +294,10 @@ packages: description: path: "." ref: "v1.0.1" - resolved-ref: ce550196f78ee2e95aa9e985759179265983689d + resolved-ref: "22a1531a279769ec472f698e9c727cd2c29a81b9" url: "https://github.com/flutter-news-app-full-source-code/http-client.git" source: git - version: "0.0.0" + version: "1.0.1" http_parser: dependency: transitive description: @@ -326,20 +326,20 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: "3bcba6b11fe0480e06e1bedf6eab4159a7c59c53" + ref: "v1.0.1" + resolved-ref: "35f1c6369273e693895c7f07ff18d4111c4dfe45" url: "https://github.com/flutter-news-app-full-source-code/kv-storage-service.git" source: git - version: "0.0.0" + version: "1.0.1" kv_storage_shared_preferences: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: ed94c16ae5ced56216f1adcc14b995e418d5c464 + ref: "v1.0.1" + resolved-ref: "7476f7cb344927a555c78853d9bf7bec3a1b6dfd" url: "https://github.com/flutter-news-app-full-source-code/kv-storage-shared-preferences.git" source: git - version: "0.0.0" + version: "1.0.1" logging: dependency: "direct main" description: @@ -400,18 +400,18 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "993381400e94d18469750e5b9dcb8206f15bc09f9da86b9e44a9b0092a0066db" + sha256: e122c5ea805bb6773bb12ce667611265980940145be920cd09a4b0ec0285cb16 url: "https://pub.dev" source: hosted - version: "2.2.18" + version: "2.2.20" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd" + sha256: efaec349ddfc181528345c56f8eda9d6cccd71c177511b132c6a0ddaefaa2738 url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.4.3" path_provider_linux: dependency: transitive description: @@ -488,18 +488,18 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: bd14436108211b0d4ee5038689a56d4ae3620fd72fd6036e113bf1345bc74d9e + sha256: "34266009473bf71d748912da4bf62d439185226c03e01e2d9687bc65bbfcb713" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.4.15" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + sha256: "1c33a907142607c40a7542768ec9badfd16293bac51da3a4482623d15845f88b" url: "https://pub.dev" source: hosted - version: "2.5.4" + version: "2.5.5" shared_preferences_linux: dependency: transitive description: @@ -597,11 +597,11 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.0.0" - resolved-ref: "5e84f206a0e047f6afd608d510aec998c6a37dd3" + ref: "v1.0.1" + resolved-ref: "5b970bebf2c2d87c5764f9d0e09cacdec8cd71f6" url: "https://github.com/flutter-news-app-full-source-code/ui-kit.git" source: git - version: "0.0.0" + version: "1.0.1" universal_platform: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 688abd7d..4679c126 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,42 +11,42 @@ dependencies: auth_api: git: url: https://github.com/flutter-news-app-full-source-code/auth-api.git - ref: v1.0.0 + ref: v1.0.1 auth_client: git: url: https://github.com/flutter-news-app-full-source-code/auth-client.git - ref: v1.0.0 + ref: v1.0.1 auth_inmemory: git: url: https://github.com/flutter-news-app-full-source-code/auth-inmemory - ref: v1.0.0 + ref: v1.0.1 auth_repository: git: url: https://github.com/flutter-news-app-full-source-code/auth-repository.git - ref: v1.0.0 + ref: v1.0.1 bloc: ^9.0.0 bloc_concurrency: ^0.3.0 collection: ^1.19.1 core: git: url: https://github.com/flutter-news-app-full-source-code/core.git - ref: v1.2.0 + ref: v1.3.1 data_api: git: url: https://github.com/flutter-news-app-full-source-code/data-api.git - ref: v1.0.0 + ref: v1.0.1 data_client: git: url: https://github.com/flutter-news-app-full-source-code/data-client.git - ref: v1.0.0 + ref: v1.0.1 data_inmemory: git: url: https://github.com/flutter-news-app-full-source-code/data-inmemory.git - ref: v1.0.0 + ref: v1.0.1 data_repository: git: url: https://github.com/flutter-news-app-full-source-code/data-repository.git - ref: v1.0.0 + ref: v1.0.1 data_table_2: ^2.6.0 device_preview: ^1.2.0 equatable: ^2.0.7 @@ -67,11 +67,11 @@ dependencies: kv_storage_service: git: url: https://github.com/flutter-news-app-full-source-code/kv-storage-service.git - ref: v1.0.0 + ref: v1.0.1 kv_storage_shared_preferences: git: url: https://github.com/flutter-news-app-full-source-code/kv-storage-shared-preferences.git - ref: v1.0.0 + ref: v1.0.1 logging: ^1.3.0 pinput: ^5.0.1 rxdart: ^0.28.0 @@ -80,7 +80,7 @@ dependencies: ui_kit: git: url: https://github.com/flutter-news-app-full-source-code/ui-kit.git - ref: v1.0.0 + ref: v1.0.1 uuid: ^4.5.1 dev_dependencies: From 7f14793bc46cdaf525fa99634dac731680c748c2 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:18:22 +0100 Subject: [PATCH 02/13] feat(source): integrate logoUrl into create source state Adds the `logoUrl` field to the `CreateSourceState`. This change updates the state class to manage the new logo URL, including modifications to the constructor, `copyWith` method, `props` for equatability, and the `isFormValid` getter to enforce the new required field. --- .../bloc/create_source/create_source_state.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/content_management/bloc/create_source/create_source_state.dart b/lib/content_management/bloc/create_source/create_source_state.dart index 361be4e2..b67500bf 100644 --- a/lib/content_management/bloc/create_source/create_source_state.dart +++ b/lib/content_management/bloc/create_source/create_source_state.dart @@ -26,6 +26,7 @@ final class CreateSourceState extends Equatable { this.name = '', this.description = '', this.url = '', + this.logoUrl = '', this.sourceType, this.language, this.headquarters, @@ -37,6 +38,7 @@ final class CreateSourceState extends Equatable { final String name; final String description; final String url; + final String logoUrl; final SourceType? sourceType; final Language? language; final Country? headquarters; @@ -48,6 +50,7 @@ final class CreateSourceState extends Equatable { name.isNotEmpty && description.isNotEmpty && url.isNotEmpty && + logoUrl.isNotEmpty && sourceType != null && language != null && headquarters != null; @@ -57,6 +60,7 @@ final class CreateSourceState extends Equatable { String? name, String? description, String? url, + String? logoUrl, ValueGetter? sourceType, ValueGetter? language, ValueGetter? headquarters, @@ -68,6 +72,7 @@ final class CreateSourceState extends Equatable { name: name ?? this.name, description: description ?? this.description, url: url ?? this.url, + logoUrl: logoUrl ?? this.logoUrl, sourceType: sourceType != null ? sourceType() : this.sourceType, language: language != null ? language() : this.language, headquarters: headquarters != null ? headquarters() : this.headquarters, @@ -82,6 +87,7 @@ final class CreateSourceState extends Equatable { name, description, url, + logoUrl, sourceType, language, headquarters, From a6fee37557d0e0baf7fd7a78130397c3739099aa Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:18:32 +0100 Subject: [PATCH 03/13] feat(source): add logo url changed event for create source Introduces the `CreateSourceLogoUrlChanged` event to handle updates to the new `logoUrl` field within the `CreateSourceBloc`. --- .../bloc/create_source/create_source_event.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/content_management/bloc/create_source/create_source_event.dart b/lib/content_management/bloc/create_source/create_source_event.dart index cf476117..eedd2450 100644 --- a/lib/content_management/bloc/create_source/create_source_event.dart +++ b/lib/content_management/bloc/create_source/create_source_event.dart @@ -32,6 +32,14 @@ final class CreateSourceUrlChanged extends CreateSourceEvent { List get props => [url]; } +/// Event for when the source's logo URL is changed. +final class CreateSourceLogoUrlChanged extends CreateSourceEvent { + const CreateSourceLogoUrlChanged(this.logoUrl); + final String logoUrl; + @override + List get props => [logoUrl]; +} + /// Event for when the source's type is changed. final class CreateSourceTypeChanged extends CreateSourceEvent { const CreateSourceTypeChanged(this.sourceType); From 39e0f963bef144f5161b2b9ff3d1e3c569c0f91f Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:18:46 +0100 Subject: [PATCH 04/13] feat(source): integrate logoUrl into create source bloc Updates the `CreateSourceBloc` to fully manage the new `logoUrl` field. This change introduces a new event handler `_onLogoUrlChanged` to update the state with the logo URL from the UI. It also registers this handler and modifies the `_onSavedAsDraft` and `_onPublished` methods to include the `logoUrl` when creating a new `Source` instance, resolving the compilation errors. Comments for future logging have been added to enhance maintainability. --- .../create_source/create_source_bloc.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/content_management/bloc/create_source/create_source_bloc.dart b/lib/content_management/bloc/create_source/create_source_bloc.dart index 4a5dc0d7..ff9d98d1 100644 --- a/lib/content_management/bloc/create_source/create_source_bloc.dart +++ b/lib/content_management/bloc/create_source/create_source_bloc.dart @@ -18,6 +18,7 @@ class CreateSourceBloc extends Bloc { on(_onNameChanged); on(_onDescriptionChanged); on(_onUrlChanged); + on(_onLogoUrlChanged); on(_onSourceTypeChanged); on(_onLanguageChanged); on(_onHeadquartersChanged); @@ -49,6 +50,14 @@ class CreateSourceBloc extends Bloc { emit(state.copyWith(url: event.url)); } + void _onLogoUrlChanged( + CreateSourceLogoUrlChanged event, + Emitter emit, + ) { + // Update state when the logo URL input changes. + emit(state.copyWith(logoUrl: event.logoUrl)); + } + void _onSourceTypeChanged( CreateSourceTypeChanged event, Emitter emit, @@ -75,12 +84,14 @@ class CreateSourceBloc extends Bloc { CreateSourceSavedAsDraft event, Emitter emit, ) async { + // Log: Attempting to save source as draft with state: state emit(state.copyWith(status: CreateSourceStatus.submitting)); try { final now = DateTime.now(); final newSource = Source( id: _uuid.v4(), name: state.name, + logoUrl: state.logoUrl, description: state.description, url: state.url, sourceType: state.sourceType!, @@ -92,6 +103,7 @@ class CreateSourceBloc extends Bloc { ); await _sourcesRepository.create(item: newSource); + // Log: Successfully saved source as draft with id: newSource.id emit( state.copyWith( status: CreateSourceStatus.success, @@ -99,9 +111,11 @@ class CreateSourceBloc extends Bloc { ), ); } on HttpException catch (e) { + // Log: Failed to save source as draft. Error: e emit(state.copyWith(status: CreateSourceStatus.failure, exception: e)); } catch (e) { emit( + // Log: An unexpected error occurred while saving source as draft. Error: e state.copyWith( status: CreateSourceStatus.failure, exception: UnknownException('An unexpected error occurred: $e'), @@ -115,12 +129,14 @@ class CreateSourceBloc extends Bloc { CreateSourcePublished event, Emitter emit, ) async { + // Log: Attempting to publish source with state: state emit(state.copyWith(status: CreateSourceStatus.submitting)); try { final now = DateTime.now(); final newSource = Source( id: _uuid.v4(), name: state.name, + logoUrl: state.logoUrl, description: state.description, url: state.url, sourceType: state.sourceType!, @@ -132,6 +148,7 @@ class CreateSourceBloc extends Bloc { ); await _sourcesRepository.create(item: newSource); + // Log: Successfully published source with id: newSource.id emit( state.copyWith( status: CreateSourceStatus.success, @@ -139,9 +156,11 @@ class CreateSourceBloc extends Bloc { ), ); } on HttpException catch (e) { + // Log: Failed to publish source. Error: e emit(state.copyWith(status: CreateSourceStatus.failure, exception: e)); } catch (e) { emit( + // Log: An unexpected error occurred while publishing source. Error: e state.copyWith( status: CreateSourceStatus.failure, exception: UnknownException('An unexpected error occurred: $e'), From 9a78f046e186fda564cb8c145046c1b713b7e1d2 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:18:57 +0100 Subject: [PATCH 05/13] feat(source): integrate logoUrl into edit source state Adds the `logoUrl` field to the `EditSourceState`. This change updates the state class to manage the new logo URL for the editing workflow. It includes modifications to the constructor, `copyWith` method, `props` for equatability, and the `isFormValid` getter to enforce the new required field. --- .../bloc/edit_source/edit_source_state.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/content_management/bloc/edit_source/edit_source_state.dart b/lib/content_management/bloc/edit_source/edit_source_state.dart index 68403ad5..5bdf7810 100644 --- a/lib/content_management/bloc/edit_source/edit_source_state.dart +++ b/lib/content_management/bloc/edit_source/edit_source_state.dart @@ -26,6 +26,7 @@ final class EditSourceState extends Equatable { this.name = '', this.description = '', this.url = '', + this.logoUrl = '', this.sourceType, this.language, this.headquarters, @@ -38,6 +39,7 @@ final class EditSourceState extends Equatable { final String name; final String description; final String url; + final String logoUrl; final SourceType? sourceType; final Language? language; final Country? headquarters; @@ -50,6 +52,7 @@ final class EditSourceState extends Equatable { name.isNotEmpty && description.isNotEmpty && url.isNotEmpty && + logoUrl.isNotEmpty && sourceType != null && language != null && headquarters != null; @@ -60,6 +63,7 @@ final class EditSourceState extends Equatable { String? name, String? description, String? url, + String? logoUrl, ValueGetter? sourceType, ValueGetter? language, ValueGetter? headquarters, @@ -72,6 +76,7 @@ final class EditSourceState extends Equatable { name: name ?? this.name, description: description ?? this.description, url: url ?? this.url, + logoUrl: logoUrl ?? this.logoUrl, sourceType: sourceType != null ? sourceType() : this.sourceType, language: language != null ? language() : this.language, headquarters: headquarters != null ? headquarters() : this.headquarters, @@ -87,6 +92,7 @@ final class EditSourceState extends Equatable { name, description, url, + logoUrl, sourceType, language, headquarters, From 3ba27013b84d1659dd4088a47f6c1b8f20ba206d Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:19:14 +0100 Subject: [PATCH 06/13] feat(source): add logo url changed event for edit source Introduces the `EditSourceLogoUrlChanged` event. This allows the UI to notify the `EditSourceBloc` when the user modifies the `logoUrl` field, enabling state updates for the editing workflow. --- .../bloc/edit_source/edit_source_event.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/content_management/bloc/edit_source/edit_source_event.dart b/lib/content_management/bloc/edit_source/edit_source_event.dart index 5b5625ec..49598557 100644 --- a/lib/content_management/bloc/edit_source/edit_source_event.dart +++ b/lib/content_management/bloc/edit_source/edit_source_event.dart @@ -43,6 +43,16 @@ final class EditSourceUrlChanged extends EditSourceEvent { List get props => [url]; } +/// Event triggered when the source logo URL input changes. +final class EditSourceLogoUrlChanged extends EditSourceEvent { + const EditSourceLogoUrlChanged(this.logoUrl); + + final String logoUrl; + + @override + List get props => [logoUrl]; +} + /// Event triggered when the source type input changes. final class EditSourceTypeChanged extends EditSourceEvent { const EditSourceTypeChanged(this.sourceType); From 01e5a6f3c5bbce2833c6ae1eaa3440261755eea4 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:19:23 +0100 Subject: [PATCH 07/13] feat(source): integrate logoUrl into edit source bloc Updates the `EditSourceBloc` to fully manage the new `logoUrl` field. This change introduces and registers the `_onLogoUrlChanged` event handler. It also updates the `_onEditSourceLoaded` method to populate the `logoUrl` from the fetched source. Finally, it modifies the `_onSavedAsDraft` and `_onPublished` methods to include the `logoUrl` when updating the `Source` instance. Comments for future logging have been added to enhance maintainability. --- .../bloc/edit_source/edit_source_bloc.dart | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/content_management/bloc/edit_source/edit_source_bloc.dart b/lib/content_management/bloc/edit_source/edit_source_bloc.dart index be02bb7f..53967e1b 100644 --- a/lib/content_management/bloc/edit_source/edit_source_bloc.dart +++ b/lib/content_management/bloc/edit_source/edit_source_bloc.dart @@ -21,6 +21,7 @@ class EditSourceBloc extends Bloc { on(_onNameChanged); on(_onDescriptionChanged); on(_onUrlChanged); + on(_onLogoUrlChanged); on(_onSourceTypeChanged); on(_onLanguageChanged); on(_onHeadquartersChanged); @@ -44,6 +45,7 @@ class EditSourceBloc extends Bloc { name: source.name, description: source.description, url: source.url, + logoUrl: source.logoUrl, sourceType: () => source.sourceType, language: () => source.language, headquarters: () => source.headquarters, @@ -89,6 +91,16 @@ class EditSourceBloc extends Bloc { emit(state.copyWith(url: event.url, status: EditSourceStatus.initial)); } + void _onLogoUrlChanged( + EditSourceLogoUrlChanged event, + Emitter emit, + ) { + // Update state when the logo URL input changes. + emit( + state.copyWith(logoUrl: event.logoUrl, status: EditSourceStatus.initial), + ); + } + void _onSourceTypeChanged( EditSourceTypeChanged event, Emitter emit, @@ -130,11 +142,13 @@ class EditSourceBloc extends Bloc { EditSourceSavedAsDraft event, Emitter emit, ) async { + // Log: Attempting to save source as draft with state: state emit(state.copyWith(status: EditSourceStatus.submitting)); try { final originalSource = await _sourcesRepository.read(id: state.sourceId); final updatedSource = originalSource.copyWith( name: state.name, + logoUrl: state.logoUrl, description: state.description, url: state.url, sourceType: state.sourceType, @@ -148,6 +162,7 @@ class EditSourceBloc extends Bloc { id: state.sourceId, item: updatedSource, ); + // Log: Successfully saved source as draft with id: state.sourceId emit( state.copyWith( status: EditSourceStatus.success, @@ -155,9 +170,11 @@ class EditSourceBloc extends Bloc { ), ); } on HttpException catch (e) { + // Log: Failed to save source as draft. Error: e emit(state.copyWith(status: EditSourceStatus.failure, exception: e)); } catch (e) { emit( + // Log: An unexpected error occurred while saving source as draft. Error: e state.copyWith( status: EditSourceStatus.failure, exception: UnknownException('An unexpected error occurred: $e'), @@ -171,11 +188,13 @@ class EditSourceBloc extends Bloc { EditSourcePublished event, Emitter emit, ) async { + // Log: Attempting to publish source with state: state emit(state.copyWith(status: EditSourceStatus.submitting)); try { final originalSource = await _sourcesRepository.read(id: state.sourceId); final updatedSource = originalSource.copyWith( name: state.name, + logoUrl: state.logoUrl, description: state.description, url: state.url, sourceType: state.sourceType, @@ -189,6 +208,7 @@ class EditSourceBloc extends Bloc { id: state.sourceId, item: updatedSource, ); + // Log: Successfully published source with id: state.sourceId emit( state.copyWith( status: EditSourceStatus.success, @@ -196,9 +216,11 @@ class EditSourceBloc extends Bloc { ), ); } on HttpException catch (e) { + // Log: Failed to publish source. Error: e emit(state.copyWith(status: EditSourceStatus.failure, exception: e)); } catch (e) { emit( + // Log: An unexpected error occurred while publishing source. Error: e state.copyWith( status: EditSourceStatus.failure, exception: UnknownException('An unexpected error occurred: $e'), From 0f2dfc6a668e858ce077023ed12b02dad1ee8752 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:19:44 +0100 Subject: [PATCH 08/13] feat(source): add logo url field to create source page Integrates the `logoUrl` input field into the `CreateSourcePage` UI. This change adds the necessary `TextEditingController` and `TextFormField` to allow users to input a URL for the source's logo. The controller is properly initialized and disposed, and the text field is connected to the `CreateSourceBloc` to handle state updates. --- .../view/create_source_page.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/content_management/view/create_source_page.dart b/lib/content_management/view/create_source_page.dart index 1d67abf4..a19c8833 100644 --- a/lib/content_management/view/create_source_page.dart +++ b/lib/content_management/view/create_source_page.dart @@ -39,6 +39,7 @@ class _CreateSourceViewState extends State<_CreateSourceView> { late final TextEditingController _nameController; late final TextEditingController _descriptionController; late final TextEditingController _urlController; + late final TextEditingController _logoUrlController; @override void initState() { @@ -47,6 +48,7 @@ class _CreateSourceViewState extends State<_CreateSourceView> { _nameController = TextEditingController(text: state.name); _descriptionController = TextEditingController(text: state.description); _urlController = TextEditingController(text: state.url); + _logoUrlController = TextEditingController(text: state.logoUrl); } @override @@ -54,6 +56,7 @@ class _CreateSourceViewState extends State<_CreateSourceView> { _nameController.dispose(); _descriptionController.dispose(); _urlController.dispose(); + _logoUrlController.dispose(); super.dispose(); } @@ -211,6 +214,17 @@ class _CreateSourceViewState extends State<_CreateSourceView> { .add(CreateSourceUrlChanged(value)), ), const SizedBox(height: AppSpacing.lg), + TextFormField( + controller: _logoUrlController, + decoration: InputDecoration( + labelText: l10n.logoUrl, + border: const OutlineInputBorder(), + ), + onChanged: (value) => context + .read() + .add(CreateSourceLogoUrlChanged(value)), + ), + const SizedBox(height: AppSpacing.lg), SearchableSelectionInput( label: l10n.language, selectedItems: state.language != null From f0ae19cb914debf4d0706e24a90de8745c3a4119 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:19:56 +0100 Subject: [PATCH 09/13] feat(source): add logo url field to edit source page Integrates the `logoUrl` input field into the `EditSourcePage` UI. This change adds the necessary `TextEditingController` and `TextFormField` to allow users to edit the URL for the source's logo. The controller is properly initialized, disposed, and updated from the BLoC state. The text field is connected to the `EditSourceBloc` to handle state updates. --- lib/content_management/view/edit_source_page.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/content_management/view/edit_source_page.dart b/lib/content_management/view/edit_source_page.dart index c426a3d6..9f5b3410 100644 --- a/lib/content_management/view/edit_source_page.dart +++ b/lib/content_management/view/edit_source_page.dart @@ -43,6 +43,7 @@ class _EditSourceViewState extends State<_EditSourceView> { late final TextEditingController _nameController; late final TextEditingController _descriptionController; late final TextEditingController _urlController; + late final TextEditingController _logoUrlController; @override void initState() { @@ -50,6 +51,7 @@ class _EditSourceViewState extends State<_EditSourceView> { _nameController = TextEditingController(); _descriptionController = TextEditingController(); _urlController = TextEditingController(); + _logoUrlController = TextEditingController(); } @override @@ -57,6 +59,7 @@ class _EditSourceViewState extends State<_EditSourceView> { _nameController.dispose(); _descriptionController.dispose(); _urlController.dispose(); + _logoUrlController.dispose(); super.dispose(); } @@ -140,6 +143,7 @@ class _EditSourceViewState extends State<_EditSourceView> { _nameController.text = state.name; _descriptionController.text = state.description; _urlController.text = state.url; + _logoUrlController.text = state.logoUrl; } }, builder: (context, state) { @@ -201,6 +205,17 @@ class _EditSourceViewState extends State<_EditSourceView> { ), ), const SizedBox(height: AppSpacing.lg), + TextFormField( + controller: _logoUrlController, + decoration: InputDecoration( + labelText: l10n.logoUrl, + border: const OutlineInputBorder(), + ), + onChanged: (value) => context.read().add( + EditSourceLogoUrlChanged(value), + ), + ), + const SizedBox(height: AppSpacing.lg), SearchableSelectionInput( label: l10n.language, selectedItems: state.language != null From bd4af6df45c6676477e607fe2f5325695f564568 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:20:08 +0100 Subject: [PATCH 10/13] fix(source): resolve compilation error in filter dialog Corrects a compilation error in `filter_dialog.dart` by adding the required `logoUrl` parameter to the `Source` constructor within an `orElse` block. This dummy object is used as a fallback and now aligns with the updated `Source` model. --- lib/content_management/widgets/filter_dialog/filter_dialog.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/content_management/widgets/filter_dialog/filter_dialog.dart b/lib/content_management/widgets/filter_dialog/filter_dialog.dart index a71f7eca..d2a2de27 100644 --- a/lib/content_management/widgets/filter_dialog/filter_dialog.dart +++ b/lib/content_management/widgets/filter_dialog/filter_dialog.dart @@ -264,6 +264,7 @@ class _FilterDialogState extends State { name: '', description: '', url: '', + logoUrl: '', sourceType: SourceType.other, language: Language( id: '', From 6ca2b01d8ff7592dc08d358db636a244312efb8c Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:20:16 +0100 Subject: [PATCH 11/13] feat(l10n): add logo URL label translations and update descriptions - Add Arabic and English translations for "logoUrl" label - Update descriptions for "saveAdMessage" localization entries --- lib/l10n/arb/app_ar.arb | 4 ++++ lib/l10n/arb/app_en.arb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/l10n/arb/app_ar.arb b/lib/l10n/arb/app_ar.arb index 473bc180..3250489c 100644 --- a/lib/l10n/arb/app_ar.arb +++ b/lib/l10n/arb/app_ar.arb @@ -1919,5 +1919,9 @@ "saveAdMessage": "هل تريد نشر هذا الإعلان أم حفظه كمسودة؟", "@saveAdMessage": { "description": "رسالة مربع الحوار الذي يطلب حفظ إعلان" + }, + "logoUrl": "رابط الشعار", + "@logoUrl": { + "description": "تسمية حقل إدخال رابط شعار المصدر" } } \ No newline at end of file diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 92c89004..28e8f938 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -1915,5 +1915,9 @@ "saveAdMessage": "Do you want to publish this ad or save it as a draft?", "@saveAdMessage": { "description": "Message for the dialog asking to save an ad" + }, + "logoUrl": "Logo URL", + "@logoUrl": { + "description": "Label for the source logo URL input field" } } \ No newline at end of file From 4d8b049ef3da16be6b6e25b09416bcd3ff21ef29 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:20:48 +0100 Subject: [PATCH 12/13] build: l10n --- lib/l10n/app_localizations.dart | 6 ++++++ lib/l10n/app_localizations_ar.dart | 3 +++ lib/l10n/app_localizations_en.dart | 3 +++ 3 files changed, 12 insertions(+) diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index e014bb9e..898cedd0 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -2839,6 +2839,12 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Do you want to publish this ad or save it as a draft?'** String get saveAdMessage; + + /// Label for the source logo URL input field + /// + /// In en, this message translates to: + /// **'Logo URL'** + String get logoUrl; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_ar.dart b/lib/l10n/app_localizations_ar.dart index 28904e6b..c1e873ff 100644 --- a/lib/l10n/app_localizations_ar.dart +++ b/lib/l10n/app_localizations_ar.dart @@ -1512,4 +1512,7 @@ class AppLocalizationsAr extends AppLocalizations { @override String get saveAdMessage => 'هل تريد نشر هذا الإعلان أم حفظه كمسودة؟'; + + @override + String get logoUrl => 'رابط الشعار'; } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 445cdd07..227bb227 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1518,4 +1518,7 @@ class AppLocalizationsEn extends AppLocalizations { @override String get saveAdMessage => 'Do you want to publish this ad or save it as a draft?'; + + @override + String get logoUrl => 'Logo URL'; } From a2f2fecbb6db1fed5500436e05a1fe952f913900 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 24 Oct 2025 20:39:05 +0100 Subject: [PATCH 13/13] refactor(sources): Remove unnecessary logging comments in source creation and editing - Remove commented-out log statements in CreateSourceBloc and EditSourceBloc - These comments were likely intended for debugging purposes but are no longer --- .../bloc/create_source/create_source_bloc.dart | 10 ++-------- .../bloc/edit_source/edit_source_bloc.dart | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/content_management/bloc/create_source/create_source_bloc.dart b/lib/content_management/bloc/create_source/create_source_bloc.dart index ff9d98d1..6adb6e12 100644 --- a/lib/content_management/bloc/create_source/create_source_bloc.dart +++ b/lib/content_management/bloc/create_source/create_source_bloc.dart @@ -84,7 +84,6 @@ class CreateSourceBloc extends Bloc { CreateSourceSavedAsDraft event, Emitter emit, ) async { - // Log: Attempting to save source as draft with state: state emit(state.copyWith(status: CreateSourceStatus.submitting)); try { final now = DateTime.now(); @@ -103,7 +102,7 @@ class CreateSourceBloc extends Bloc { ); await _sourcesRepository.create(item: newSource); - // Log: Successfully saved source as draft with id: newSource.id + emit( state.copyWith( status: CreateSourceStatus.success, @@ -111,11 +110,9 @@ class CreateSourceBloc extends Bloc { ), ); } on HttpException catch (e) { - // Log: Failed to save source as draft. Error: e emit(state.copyWith(status: CreateSourceStatus.failure, exception: e)); } catch (e) { emit( - // Log: An unexpected error occurred while saving source as draft. Error: e state.copyWith( status: CreateSourceStatus.failure, exception: UnknownException('An unexpected error occurred: $e'), @@ -129,7 +126,6 @@ class CreateSourceBloc extends Bloc { CreateSourcePublished event, Emitter emit, ) async { - // Log: Attempting to publish source with state: state emit(state.copyWith(status: CreateSourceStatus.submitting)); try { final now = DateTime.now(); @@ -148,7 +144,7 @@ class CreateSourceBloc extends Bloc { ); await _sourcesRepository.create(item: newSource); - // Log: Successfully published source with id: newSource.id + emit( state.copyWith( status: CreateSourceStatus.success, @@ -156,11 +152,9 @@ class CreateSourceBloc extends Bloc { ), ); } on HttpException catch (e) { - // Log: Failed to publish source. Error: e emit(state.copyWith(status: CreateSourceStatus.failure, exception: e)); } catch (e) { emit( - // Log: An unexpected error occurred while publishing source. Error: e state.copyWith( status: CreateSourceStatus.failure, exception: UnknownException('An unexpected error occurred: $e'), diff --git a/lib/content_management/bloc/edit_source/edit_source_bloc.dart b/lib/content_management/bloc/edit_source/edit_source_bloc.dart index 53967e1b..ce587e2c 100644 --- a/lib/content_management/bloc/edit_source/edit_source_bloc.dart +++ b/lib/content_management/bloc/edit_source/edit_source_bloc.dart @@ -142,7 +142,6 @@ class EditSourceBloc extends Bloc { EditSourceSavedAsDraft event, Emitter emit, ) async { - // Log: Attempting to save source as draft with state: state emit(state.copyWith(status: EditSourceStatus.submitting)); try { final originalSource = await _sourcesRepository.read(id: state.sourceId); @@ -162,7 +161,7 @@ class EditSourceBloc extends Bloc { id: state.sourceId, item: updatedSource, ); - // Log: Successfully saved source as draft with id: state.sourceId + emit( state.copyWith( status: EditSourceStatus.success, @@ -170,11 +169,9 @@ class EditSourceBloc extends Bloc { ), ); } on HttpException catch (e) { - // Log: Failed to save source as draft. Error: e emit(state.copyWith(status: EditSourceStatus.failure, exception: e)); } catch (e) { emit( - // Log: An unexpected error occurred while saving source as draft. Error: e state.copyWith( status: EditSourceStatus.failure, exception: UnknownException('An unexpected error occurred: $e'), @@ -188,7 +185,6 @@ class EditSourceBloc extends Bloc { EditSourcePublished event, Emitter emit, ) async { - // Log: Attempting to publish source with state: state emit(state.copyWith(status: EditSourceStatus.submitting)); try { final originalSource = await _sourcesRepository.read(id: state.sourceId); @@ -208,7 +204,7 @@ class EditSourceBloc extends Bloc { id: state.sourceId, item: updatedSource, ); - // Log: Successfully published source with id: state.sourceId + emit( state.copyWith( status: EditSourceStatus.success, @@ -216,11 +212,9 @@ class EditSourceBloc extends Bloc { ), ); } on HttpException catch (e) { - // Log: Failed to publish source. Error: e emit(state.copyWith(status: EditSourceStatus.failure, exception: e)); } catch (e) { emit( - // Log: An unexpected error occurred while publishing source. Error: e state.copyWith( status: EditSourceStatus.failure, exception: UnknownException('An unexpected error occurred: $e'),