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
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🛠️ ht_shared

![coverage: percentage](https://img.shields.io/badge/coverage-92-green)
![coverage: percentage](https://img.shields.io/badge/coverage-95-green)
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
[![License: PolyForm Free Trial](https://img.shields.io/badge/License-PolyForm%20Free%20Trial-blue)](https://polyformproject.org/licenses/free-trial/1.0.0)

Expand All @@ -11,24 +11,20 @@ Think of it as the common language 🗣️ that all parts of your news applicati
## 🌟 Core Benefits of `ht_shared`

* **🧱 Unified Data Structure:** Guarantees that your `Headline`, `Source`, `User`, `FeedItem`, and configuration data are handled identically across the entire Headlines Toolkit.
* 💡 **Powering Intelligent Feeds:** Provides the foundational models and
configuration structures (like `EngagementRule`, `SuggestionRule`,
`EngagementContentTemplate`, `AppConfig` enhancements) that enable the
`ht_main` to deliver highly dynamic, personalized, and engaging content
feeds. Define *what* to show and *when* with enhanced flexibility!
* 💡 **Streamlined Feed Engagement:** Offers core models like `EngagementContent` and `Ad`, allowing your applications to seamlessly embed calls-to-action and advertisements. The logic for *when* and *how* these appear is now managed directly within your client applications, offering precise control over the user experience.
* **🚀 Rapid Development:** Start building features faster with pre-defined, robust models for common news application needs. No reinventing the wheel!
* **🔗 Seamless Integration:** Enables the Flutter mobile app, web dashboard, and Dart Frog API to work together flawlessly.
* **🎯 Consistency by Design:** Reduces errors and simplifies maintenance by providing a single source of truth for core data definitions.
* **🌟 Foundation for Rich Features:** Includes models for user personalization (preferences, settings), dynamic feeds, and standardized API responses.
* **🌟 Foundation for Rich Features:** Includes models for user personalization (`UserContentPreferences`, `UserAppSettings`), dynamic feed items (`Ad`, `EngagementContent`), application-wide settings (`AppConfig`, `UserPreferenceConfig`, `AdConfig`), and standardized API responses.

## 🎁 Key Models Provided

This package includes well-defined Dart classes for:

* 📰 **News Content:** `Headline`, `Category`, `Source`, `Country`
* 🧩 **Feed System:** `FeedItem` (and its subtypes like `Ad`, `SuggestedContent`, `EngagementContent`), `FeedItemAction`
* 👤 **User Data:** `User`, `UserContentPreferences`, `UserAppSettings`
* ⚙️ **Application Configuration:** `AppConfig`
* 🧩 **Feed System:** `FeedItem` (and its subtypes `Ad`, `EngagementContent`), `FeedItemAction`
* 👤 **User Data:** `User`, `UserRole`, `Permission`, `UserContentPreferences`, `UserAppSettings`
* ⚙️ **Application Configuration:** `AppConfig` (containing `AdConfig` and `UserPreferenceConfig`)
* 📡 **API Communication:** `PaginatedResponse`, `SuccessApiResponse`, and a comprehensive `HtHttpException` hierarchy for standardized error handling.

## 🔑 Access and Licensing
Expand Down Expand Up @@ -60,4 +56,3 @@ To integrate `ht_shared` into a Headlines Toolkit component (or your custom Dart

```dart
import 'package:ht_shared/ht_shared.dart';
```
3 changes: 0 additions & 3 deletions lib/src/models/core/feed_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:ht_shared/src/models/entities/headline.dart';
import 'package:ht_shared/src/models/entities/source.dart';
import 'package:ht_shared/src/models/feed_decorators/ad.dart';
import 'package:ht_shared/src/models/feed_decorators/engagement_content.dart';
import 'package:ht_shared/src/models/feed_decorators/suggested_content.dart';

/// {@template feed_item}
/// An abstract base class for all items that can appear in a mixed content
Expand Down Expand Up @@ -51,8 +50,6 @@ abstract class FeedItem extends Equatable {
return Country.fromJson(json);
case 'ad':
return Ad.fromJson(json);
case 'suggested_content':
return SuggestedContent.fromJson(json);
case 'engagement_content':
return EngagementContent.fromJson(json);
default:
Expand Down
14 changes: 13 additions & 1 deletion lib/src/models/feed_decorators/ad.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:ht_shared/src/models/core/feed_item.dart';
import 'package:ht_shared/src/models/core/feed_item_action.dart'
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
import 'package:ht_shared/src/models/feed_decorators/ad_placement.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';
import 'package:uuid/uuid.dart';
Expand All @@ -26,6 +25,19 @@ enum AdType {
interstitial,
}

/// {@template ad_placement}
/// Defines specific, known locations or contexts where an ad might appear.
/// {@endtemplate}
@JsonEnum(fieldRename: FieldRename.snake)
enum AdPlacement {
/// A standard banner ad placed inline within the main feed.
feedInlineStandardBanner,

/// A native ad designed to blend with content, placed inline within the main
/// feed.
feedInlineNativeBanner,
}

/// {@template ad}
/// Represents an advertisement item that can appear in the feed.
/// {@endtemplate}
Expand Down
14 changes: 0 additions & 14 deletions lib/src/models/feed_decorators/ad_placement.dart

This file was deleted.

16 changes: 15 additions & 1 deletion lib/src/models/feed_decorators/engagement_content.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import 'package:ht_shared/src/models/core/feed_item.dart';
import 'package:ht_shared/src/models/core/feed_item_action.dart'
show FeedItemAction, feedItemActionFromJson, feedItemActionToJson;
import 'package:ht_shared/src/models/feed_decorators/engagement_content_type.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';
import 'package:uuid/uuid.dart';

part 'engagement_content.g.dart';

/// {@template engagement_content_type}
/// Defines the specific type or purpose of an [EngagementContent] item.
/// {@endtemplate}
@JsonEnum(fieldRename: FieldRename.snake)
enum EngagementContentType {
/// A call-to-action to sign up for an account.
signUp,

/// A call-to-action to upgrade to a premium subscription.
upgrade,

/// A call-to-action to rate the application in an app store.
rateApp,
}

/// {@template engagement_content}
/// A generic model for in-feed calls-to-action or engagement prompts.
///
Expand Down
4 changes: 0 additions & 4 deletions lib/src/models/feed_decorators/engagement_content.g.dart

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

23 changes: 0 additions & 23 deletions lib/src/models/feed_decorators/engagement_content_type.dart

This file was deleted.

4 changes: 0 additions & 4 deletions lib/src/models/feed_decorators/feed_decorators.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
export 'ad.dart';
export 'ad_placement.dart';
export 'engagement_content.dart';
export 'engagement_content_type.dart';
export 'suggested_content.dart';
export 'suggested_content_display_type.dart';
125 changes: 0 additions & 125 deletions lib/src/models/feed_decorators/suggested_content.dart

This file was deleted.

50 changes: 0 additions & 50 deletions lib/src/models/feed_decorators/suggested_content.g.dart

This file was deleted.

32 changes: 0 additions & 32 deletions lib/src/models/feed_decorators/suggested_content_display_type.dart

This file was deleted.

Loading
Loading