mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-21 16:01:58 +00:00
- Added UpcomingUIModel for managing upcoming manga list items with headers and items. - Introduced CalendarDay widget to display individual days with event indicators. - Created CalendarHeader widget for navigating between months. - Developed CalendarIndicator for visualizing events on specific days. - Implemented UpcomingCalendar to manage the calendar view and event loading. - Added UpcomingItem widget for displaying individual upcoming manga with cover images. - Introduced FetchInterval utility to calculate fetch intervals based on chapter upload dates. - Refactored updateMangaDetail to utilize FetchInterval for smart update days. - Enhanced MedianExtension to ensure correct median calculation. - Removed unused imports and commented-out code for cleaner implementation.
41 lines
1 KiB
Dart
41 lines
1 KiB
Dart
import 'package:mangayomi/models/manga.dart';
|
|
|
|
/// Sealed model for upcoming manga list items.
|
|
///
|
|
/// The list alternates between [Header] (date separator with count badge)
|
|
/// and [Item] (individual manga) entries.
|
|
sealed class UpcomingUIModel {
|
|
const UpcomingUIModel();
|
|
}
|
|
|
|
class UpcomingHeader extends UpcomingUIModel {
|
|
final DateTime date;
|
|
final int mangaCount;
|
|
|
|
const UpcomingHeader({required this.date, required this.mangaCount});
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is UpcomingHeader &&
|
|
date == other.date &&
|
|
mangaCount == other.mangaCount;
|
|
|
|
@override
|
|
int get hashCode => Object.hash(date, mangaCount);
|
|
}
|
|
|
|
class UpcomingItem extends UpcomingUIModel {
|
|
final Manga manga;
|
|
final DateTime expectedDate;
|
|
|
|
const UpcomingItem({required this.manga, required this.expectedDate});
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is UpcomingItem && manga.id == other.manga.id;
|
|
|
|
@override
|
|
int get hashCode => manga.id.hashCode;
|
|
}
|