Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Think of it as the common language 🗣️ that all parts of your news applicati
* **🔗 Seamless Integration:** Enables the Flutter mobile app, web dashboard, and Dart Frog API to work together flawlessly using a shared language.
* **🎯 Consistency by Design:** Reduces errors and simplifies maintenance by providing a single source of truth for all core data definitions.
* **🛡️ Standardized Error Handling:** Includes a comprehensive hierarchy of `HttpException` subtypes for predictable error management across all layers.
* **🌟 Foundation for Rich Features:** Provides models for user personalization (`UserContentPreferences`, `UserAppSettings`), dynamic feed items (e.g., `Ad`, `CallToActionItem`, `ContentCollectionItem`), remote configuration (`RemoteConfig`), and standardized API responses.
* **🌟 Foundation for Rich Features:** Provides models for user personalization (`UserContentPreferences`, `UserAppSettings`), dynamic feed items (e.g., `LocalAd`, `CallToActionItem`, `ContentCollectionItem`), remote configuration (`RemoteConfig`), and standardized API responses.

## 🎁 Key Models Provided

This package includes well-defined Dart classes for:

* **News & Content Entities:** `Headline`, `Topic`, `Source`, `Country`, `Language`
* **Feed System:** `FeedItem` (the abstract base class for all feed content) and its concrete subtypes like `Headline`, `Ad`, `CallToActionItem`, and `ContentCollectionItem`.
* **Feed System:** `FeedItem` (the abstract base class for all feed content) and its concrete subtypes like `Headline`, `LocalAd`, `CallToActionItem`, and `ContentCollectionItem`.
* **User Data:** `User`, `AppUserRole`, `DashboardUserRole`, `Permission`, `UserContentPreferences`, `UserAppSettings`
* **Application Configuration:** `RemoteConfig` (containing `AdConfig`, `UserPreferenceConfig`, `AppStatus`, and `FeedDecoratorConfig`)
* **Dashboard:** `DashboardSummary`
Expand Down
16 changes: 16 additions & 0 deletions lib/src/enums/ad_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// {@template ad_type}
/// Defines the visual format or type of an advertisement in the feed.
/// {@endtemplate}
enum AdType {
/// A banner advertisement, typically a rectangular image.
banner,

/// A native advertisement, designed to blend seamlessly with the feed content.
native,

/// A video advertisement.
video,

/// A full-screen interstitial advertisement.
interstitial,
}
1 change: 1 addition & 0 deletions lib/src/enums/enums.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export 'ad_platform_type.dart';
export 'ad_type.dart';
export 'app_accent_theme.dart';
export 'app_base_theme.dart';
export 'app_font_weight.dart';
Expand Down
42 changes: 0 additions & 42 deletions lib/src/fixtures/remote_configs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,6 @@ final List<RemoteConfig> remoteConfigsFixturesData = [
inArticleBannerAdId: 'local_in_article_banner_ad_id',
),
},
localAdsCatalog: {
'local_feed_native_ad_id': LocalAd(
id: 'local_feed_native_ad_id',
title: 'Local Native Ad Title',
subtitle: 'This is a local native ad description.',
imageUrl: 'https://example.com/local_native_ad.png',
targetUrl: 'https://example.com/local_native_ad_target',
adType: AdType.native,
),
'local_feed_banner_ad_id': LocalAd(
id: 'local_feed_banner_ad_id',
title: 'Local Banner Ad Title',
subtitle: 'This is a local banner ad description.',
imageUrl: 'https://example.com/local_banner_ad.png',
targetUrl: 'https://example.com/local_banner_ad_target',
adType: AdType.banner,
),
'local_article_interstitial_ad_id': LocalAd(
id: 'local_article_interstitial_ad_id',
title: 'Local Interstitial Ad Title',
subtitle: 'This is a local interstitial ad description.',
imageUrl: 'https://example.com/local_interstitial_ad.png',
targetUrl: 'https://example.com/local_interstitial_ad_target',
adType: AdType.interstitial,
),
'local_in_article_native_ad_id': LocalAd(
id: 'local_in_article_native_ad_id',
title: 'Local In-Article Native Ad Title',
subtitle: 'This is a local in-article native ad description.',
imageUrl: 'https://example.com/local_in_article_native_ad.png',
targetUrl: 'https://example.com/local_in_article_native_ad_target',
adType: AdType.native,
),
'local_in_article_banner_ad_id': LocalAd(
id: 'local_in_article_banner_ad_id',
title: 'Local In-Article Banner Ad Title',
subtitle: 'This is a local in-article banner ad description.',
imageUrl: 'https://example.com/local_in_article_banner_ad.png',
targetUrl: 'https://example.com/local_in_article_banner_ad_target',
adType: AdType.banner,
),
},
feedAdConfiguration: FeedAdConfiguration(
enabled: true,
adType: AdType.native,
Expand Down
8 changes: 0 additions & 8 deletions lib/src/models/config/ad_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:core/src/enums/ad_platform_type.dart';
import 'package:core/src/models/config/ad_platform_identifiers.dart';
import 'package:core/src/models/config/article_ad_configuration.dart';
import 'package:core/src/models/config/feed_ad_configuration.dart';
import 'package:core/src/models/config/local_ad.dart';
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';
Expand All @@ -19,7 +18,6 @@ class AdConfig extends Equatable {
const AdConfig({
required this.primaryAdPlatform,
required this.platformAdIdentifiers,
required this.localAdsCatalog,
required this.feedAdConfiguration,
required this.articleAdConfiguration,
});
Expand All @@ -37,9 +35,6 @@ class AdConfig extends Equatable {
/// Map to store identifiers for all platforms.
final Map<AdPlatformType, AdPlatformIdentifiers> platformAdIdentifiers;

/// All defined local ads by ID.
final Map<String, LocalAd> localAdsCatalog;

/// Configuration for main feed, search feed, similar headlines feed.
final FeedAdConfiguration feedAdConfiguration;

Expand All @@ -50,7 +45,6 @@ class AdConfig extends Equatable {
List<Object> get props => [
primaryAdPlatform,
platformAdIdentifiers,
localAdsCatalog,
feedAdConfiguration,
articleAdConfiguration,
];
Expand All @@ -60,15 +54,13 @@ class AdConfig extends Equatable {
AdConfig copyWith({
AdPlatformType? primaryAdPlatform,
Map<AdPlatformType, AdPlatformIdentifiers>? platformAdIdentifiers,
Map<String, LocalAd>? localAdsCatalog,
FeedAdConfiguration? feedAdConfiguration,
ArticleAdConfiguration? articleAdConfiguration,
}) {
return AdConfig(
primaryAdPlatform: primaryAdPlatform ?? this.primaryAdPlatform,
platformAdIdentifiers:
platformAdIdentifiers ?? this.platformAdIdentifiers,
localAdsCatalog: localAdsCatalog ?? this.localAdsCatalog,
feedAdConfiguration: feedAdConfiguration ?? this.feedAdConfiguration,
articleAdConfiguration:
articleAdConfiguration ?? this.articleAdConfiguration,
Expand Down
9 changes: 0 additions & 9 deletions lib/src/models/config/ad_config.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/src/models/config/article_ad_configuration.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:core/core.dart';
import 'package:core/src/enums/enums.dart';
import 'package:core/src/models/config/article_interstitial_ad_configuration.dart';
import 'package:core/src/models/config/in_article_ad_slot_configuration.dart';
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lib/src/models/config/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ export 'feed_ad_frequency_config.dart';
export 'feed_decorator_config.dart';
export 'feed_decorator_role_config.dart';
export 'in_article_ad_slot_configuration.dart';
export 'local_ad.dart';
export 'remote_config.dart';
export 'user_preference_config.dart';
4 changes: 2 additions & 2 deletions lib/src/models/core/feed_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ abstract class FeedItem extends Equatable {
return Source.fromJson(json);
case 'country':
return Country.fromJson(json);
case 'ad':
return Ad.fromJson(json);
case 'callToAction':
return CallToActionItem.fromJson(json);
case 'localAd':
return LocalAd.fromJson(json);
case 'contentCollection':
final contentType = json['contentType'] as String?;
if (contentType == null) {
Expand Down
98 changes: 0 additions & 98 deletions lib/src/models/feed_decorators/ad.dart

This file was deleted.

43 changes: 0 additions & 43 deletions lib/src/models/feed_decorators/ad.g.dart

This file was deleted.

2 changes: 1 addition & 1 deletion lib/src/models/feed_decorators/feed_decorators.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export 'ad.dart';
export 'call_to_action_item.dart';
export 'content_collection_item.dart';
export 'local_ad.dart';
Loading
Loading