worldhopper/lib/models/publication.freezed.dart
Felipe M. 1074e3808d
feat: basic navigation
feat: navigation store

feat: implement OPDS entry caching system

Add comprehensive caching for OPDS publications with local image storage and Dublin Core Terms metadata extraction. This enables offline viewing, fixes Library screen to show book titles and covers, and improves overall UX.

- Add publications table with full metadata (title, authors, series, publisher, ISBN, language)
- Implement local image cache service for covers and thumbnails
- Extract DCTerms metadata (series, publisher, language, ISBN) from OPDS feeds
- Link reading progress to cached publications
- Update Library screen to display cached publication data and covers
- Cache publications automatically when starting to read
- Fix navigation stack issues by using context.push() instead of context.go()
- Add explicit back button to EPUB reader with proper PopScope handling
- Implement UNIQUE constraint on reading_progress to prevent duplicates
- Save reading progress on screen dispose for both EPUB and image readers

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-28 18:24:07 +01:00

713 lines
24 KiB
Dart

// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'publication.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Publication _$PublicationFromJson(Map<String, dynamic> json) {
return _Publication.fromJson(json);
}
/// @nodoc
mixin _$Publication {
String get id => throw _privateConstructorUsedError;
String get serverId => throw _privateConstructorUsedError;
String get opdsId => throw _privateConstructorUsedError;
String get title => throw _privateConstructorUsedError;
List<String> get authors => throw _privateConstructorUsedError;
String? get summary => throw _privateConstructorUsedError;
String? get content => throw _privateConstructorUsedError;
String? get coverPath => throw _privateConstructorUsedError;
String? get thumbnailPath => throw _privateConstructorUsedError;
String? get coverUrl => throw _privateConstructorUsedError;
String? get thumbnailUrl => throw _privateConstructorUsedError;
String? get series => throw _privateConstructorUsedError;
double? get seriesPosition => throw _privateConstructorUsedError;
String? get publisher => throw _privateConstructorUsedError;
String? get language => throw _privateConstructorUsedError;
String? get isbn => throw _privateConstructorUsedError;
List<String> get categories => throw _privateConstructorUsedError;
List<OPDSLink> get links => throw _privateConstructorUsedError;
OPDSStreamLink? get streamLink => throw _privateConstructorUsedError;
DateTime? get published => throw _privateConstructorUsedError;
DateTime? get updated => throw _privateConstructorUsedError;
DateTime get firstCachedAt => throw _privateConstructorUsedError;
DateTime get lastCachedAt => throw _privateConstructorUsedError;
DateTime get lastAccessedAt => throw _privateConstructorUsedError;
/// Serializes this Publication to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of Publication
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$PublicationCopyWith<Publication> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PublicationCopyWith<$Res> {
factory $PublicationCopyWith(
Publication value, $Res Function(Publication) then) =
_$PublicationCopyWithImpl<$Res, Publication>;
@useResult
$Res call(
{String id,
String serverId,
String opdsId,
String title,
List<String> authors,
String? summary,
String? content,
String? coverPath,
String? thumbnailPath,
String? coverUrl,
String? thumbnailUrl,
String? series,
double? seriesPosition,
String? publisher,
String? language,
String? isbn,
List<String> categories,
List<OPDSLink> links,
OPDSStreamLink? streamLink,
DateTime? published,
DateTime? updated,
DateTime firstCachedAt,
DateTime lastCachedAt,
DateTime lastAccessedAt});
$OPDSStreamLinkCopyWith<$Res>? get streamLink;
}
/// @nodoc
class _$PublicationCopyWithImpl<$Res, $Val extends Publication>
implements $PublicationCopyWith<$Res> {
_$PublicationCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Publication
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? serverId = null,
Object? opdsId = null,
Object? title = null,
Object? authors = null,
Object? summary = freezed,
Object? content = freezed,
Object? coverPath = freezed,
Object? thumbnailPath = freezed,
Object? coverUrl = freezed,
Object? thumbnailUrl = freezed,
Object? series = freezed,
Object? seriesPosition = freezed,
Object? publisher = freezed,
Object? language = freezed,
Object? isbn = freezed,
Object? categories = null,
Object? links = null,
Object? streamLink = freezed,
Object? published = freezed,
Object? updated = freezed,
Object? firstCachedAt = null,
Object? lastCachedAt = null,
Object? lastAccessedAt = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
serverId: null == serverId
? _value.serverId
: serverId // ignore: cast_nullable_to_non_nullable
as String,
opdsId: null == opdsId
? _value.opdsId
: opdsId // ignore: cast_nullable_to_non_nullable
as String,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
authors: null == authors
? _value.authors
: authors // ignore: cast_nullable_to_non_nullable
as List<String>,
summary: freezed == summary
? _value.summary
: summary // ignore: cast_nullable_to_non_nullable
as String?,
content: freezed == content
? _value.content
: content // ignore: cast_nullable_to_non_nullable
as String?,
coverPath: freezed == coverPath
? _value.coverPath
: coverPath // ignore: cast_nullable_to_non_nullable
as String?,
thumbnailPath: freezed == thumbnailPath
? _value.thumbnailPath
: thumbnailPath // ignore: cast_nullable_to_non_nullable
as String?,
coverUrl: freezed == coverUrl
? _value.coverUrl
: coverUrl // ignore: cast_nullable_to_non_nullable
as String?,
thumbnailUrl: freezed == thumbnailUrl
? _value.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String?,
series: freezed == series
? _value.series
: series // ignore: cast_nullable_to_non_nullable
as String?,
seriesPosition: freezed == seriesPosition
? _value.seriesPosition
: seriesPosition // ignore: cast_nullable_to_non_nullable
as double?,
publisher: freezed == publisher
? _value.publisher
: publisher // ignore: cast_nullable_to_non_nullable
as String?,
language: freezed == language
? _value.language
: language // ignore: cast_nullable_to_non_nullable
as String?,
isbn: freezed == isbn
? _value.isbn
: isbn // ignore: cast_nullable_to_non_nullable
as String?,
categories: null == categories
? _value.categories
: categories // ignore: cast_nullable_to_non_nullable
as List<String>,
links: null == links
? _value.links
: links // ignore: cast_nullable_to_non_nullable
as List<OPDSLink>,
streamLink: freezed == streamLink
? _value.streamLink
: streamLink // ignore: cast_nullable_to_non_nullable
as OPDSStreamLink?,
published: freezed == published
? _value.published
: published // ignore: cast_nullable_to_non_nullable
as DateTime?,
updated: freezed == updated
? _value.updated
: updated // ignore: cast_nullable_to_non_nullable
as DateTime?,
firstCachedAt: null == firstCachedAt
? _value.firstCachedAt
: firstCachedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
lastCachedAt: null == lastCachedAt
? _value.lastCachedAt
: lastCachedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
lastAccessedAt: null == lastAccessedAt
? _value.lastAccessedAt
: lastAccessedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
/// Create a copy of Publication
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OPDSStreamLinkCopyWith<$Res>? get streamLink {
if (_value.streamLink == null) {
return null;
}
return $OPDSStreamLinkCopyWith<$Res>(_value.streamLink!, (value) {
return _then(_value.copyWith(streamLink: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$PublicationImplCopyWith<$Res>
implements $PublicationCopyWith<$Res> {
factory _$$PublicationImplCopyWith(
_$PublicationImpl value, $Res Function(_$PublicationImpl) then) =
__$$PublicationImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
String serverId,
String opdsId,
String title,
List<String> authors,
String? summary,
String? content,
String? coverPath,
String? thumbnailPath,
String? coverUrl,
String? thumbnailUrl,
String? series,
double? seriesPosition,
String? publisher,
String? language,
String? isbn,
List<String> categories,
List<OPDSLink> links,
OPDSStreamLink? streamLink,
DateTime? published,
DateTime? updated,
DateTime firstCachedAt,
DateTime lastCachedAt,
DateTime lastAccessedAt});
@override
$OPDSStreamLinkCopyWith<$Res>? get streamLink;
}
/// @nodoc
class __$$PublicationImplCopyWithImpl<$Res>
extends _$PublicationCopyWithImpl<$Res, _$PublicationImpl>
implements _$$PublicationImplCopyWith<$Res> {
__$$PublicationImplCopyWithImpl(
_$PublicationImpl _value, $Res Function(_$PublicationImpl) _then)
: super(_value, _then);
/// Create a copy of Publication
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? serverId = null,
Object? opdsId = null,
Object? title = null,
Object? authors = null,
Object? summary = freezed,
Object? content = freezed,
Object? coverPath = freezed,
Object? thumbnailPath = freezed,
Object? coverUrl = freezed,
Object? thumbnailUrl = freezed,
Object? series = freezed,
Object? seriesPosition = freezed,
Object? publisher = freezed,
Object? language = freezed,
Object? isbn = freezed,
Object? categories = null,
Object? links = null,
Object? streamLink = freezed,
Object? published = freezed,
Object? updated = freezed,
Object? firstCachedAt = null,
Object? lastCachedAt = null,
Object? lastAccessedAt = null,
}) {
return _then(_$PublicationImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
serverId: null == serverId
? _value.serverId
: serverId // ignore: cast_nullable_to_non_nullable
as String,
opdsId: null == opdsId
? _value.opdsId
: opdsId // ignore: cast_nullable_to_non_nullable
as String,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
authors: null == authors
? _value._authors
: authors // ignore: cast_nullable_to_non_nullable
as List<String>,
summary: freezed == summary
? _value.summary
: summary // ignore: cast_nullable_to_non_nullable
as String?,
content: freezed == content
? _value.content
: content // ignore: cast_nullable_to_non_nullable
as String?,
coverPath: freezed == coverPath
? _value.coverPath
: coverPath // ignore: cast_nullable_to_non_nullable
as String?,
thumbnailPath: freezed == thumbnailPath
? _value.thumbnailPath
: thumbnailPath // ignore: cast_nullable_to_non_nullable
as String?,
coverUrl: freezed == coverUrl
? _value.coverUrl
: coverUrl // ignore: cast_nullable_to_non_nullable
as String?,
thumbnailUrl: freezed == thumbnailUrl
? _value.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String?,
series: freezed == series
? _value.series
: series // ignore: cast_nullable_to_non_nullable
as String?,
seriesPosition: freezed == seriesPosition
? _value.seriesPosition
: seriesPosition // ignore: cast_nullable_to_non_nullable
as double?,
publisher: freezed == publisher
? _value.publisher
: publisher // ignore: cast_nullable_to_non_nullable
as String?,
language: freezed == language
? _value.language
: language // ignore: cast_nullable_to_non_nullable
as String?,
isbn: freezed == isbn
? _value.isbn
: isbn // ignore: cast_nullable_to_non_nullable
as String?,
categories: null == categories
? _value._categories
: categories // ignore: cast_nullable_to_non_nullable
as List<String>,
links: null == links
? _value._links
: links // ignore: cast_nullable_to_non_nullable
as List<OPDSLink>,
streamLink: freezed == streamLink
? _value.streamLink
: streamLink // ignore: cast_nullable_to_non_nullable
as OPDSStreamLink?,
published: freezed == published
? _value.published
: published // ignore: cast_nullable_to_non_nullable
as DateTime?,
updated: freezed == updated
? _value.updated
: updated // ignore: cast_nullable_to_non_nullable
as DateTime?,
firstCachedAt: null == firstCachedAt
? _value.firstCachedAt
: firstCachedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
lastCachedAt: null == lastCachedAt
? _value.lastCachedAt
: lastCachedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
lastAccessedAt: null == lastAccessedAt
? _value.lastAccessedAt
: lastAccessedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
@JsonSerializable()
class _$PublicationImpl extends _Publication {
const _$PublicationImpl(
{required this.id,
required this.serverId,
required this.opdsId,
required this.title,
final List<String> authors = const [],
this.summary,
this.content,
this.coverPath,
this.thumbnailPath,
this.coverUrl,
this.thumbnailUrl,
this.series,
this.seriesPosition,
this.publisher,
this.language,
this.isbn,
final List<String> categories = const [],
final List<OPDSLink> links = const [],
this.streamLink,
this.published,
this.updated,
required this.firstCachedAt,
required this.lastCachedAt,
required this.lastAccessedAt})
: _authors = authors,
_categories = categories,
_links = links,
super._();
factory _$PublicationImpl.fromJson(Map<String, dynamic> json) =>
_$$PublicationImplFromJson(json);
@override
final String id;
@override
final String serverId;
@override
final String opdsId;
@override
final String title;
final List<String> _authors;
@override
@JsonKey()
List<String> get authors {
if (_authors is EqualUnmodifiableListView) return _authors;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_authors);
}
@override
final String? summary;
@override
final String? content;
@override
final String? coverPath;
@override
final String? thumbnailPath;
@override
final String? coverUrl;
@override
final String? thumbnailUrl;
@override
final String? series;
@override
final double? seriesPosition;
@override
final String? publisher;
@override
final String? language;
@override
final String? isbn;
final List<String> _categories;
@override
@JsonKey()
List<String> get categories {
if (_categories is EqualUnmodifiableListView) return _categories;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_categories);
}
final List<OPDSLink> _links;
@override
@JsonKey()
List<OPDSLink> get links {
if (_links is EqualUnmodifiableListView) return _links;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_links);
}
@override
final OPDSStreamLink? streamLink;
@override
final DateTime? published;
@override
final DateTime? updated;
@override
final DateTime firstCachedAt;
@override
final DateTime lastCachedAt;
@override
final DateTime lastAccessedAt;
@override
String toString() {
return 'Publication(id: $id, serverId: $serverId, opdsId: $opdsId, title: $title, authors: $authors, summary: $summary, content: $content, coverPath: $coverPath, thumbnailPath: $thumbnailPath, coverUrl: $coverUrl, thumbnailUrl: $thumbnailUrl, series: $series, seriesPosition: $seriesPosition, publisher: $publisher, language: $language, isbn: $isbn, categories: $categories, links: $links, streamLink: $streamLink, published: $published, updated: $updated, firstCachedAt: $firstCachedAt, lastCachedAt: $lastCachedAt, lastAccessedAt: $lastAccessedAt)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PublicationImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.serverId, serverId) ||
other.serverId == serverId) &&
(identical(other.opdsId, opdsId) || other.opdsId == opdsId) &&
(identical(other.title, title) || other.title == title) &&
const DeepCollectionEquality().equals(other._authors, _authors) &&
(identical(other.summary, summary) || other.summary == summary) &&
(identical(other.content, content) || other.content == content) &&
(identical(other.coverPath, coverPath) ||
other.coverPath == coverPath) &&
(identical(other.thumbnailPath, thumbnailPath) ||
other.thumbnailPath == thumbnailPath) &&
(identical(other.coverUrl, coverUrl) ||
other.coverUrl == coverUrl) &&
(identical(other.thumbnailUrl, thumbnailUrl) ||
other.thumbnailUrl == thumbnailUrl) &&
(identical(other.series, series) || other.series == series) &&
(identical(other.seriesPosition, seriesPosition) ||
other.seriesPosition == seriesPosition) &&
(identical(other.publisher, publisher) ||
other.publisher == publisher) &&
(identical(other.language, language) ||
other.language == language) &&
(identical(other.isbn, isbn) || other.isbn == isbn) &&
const DeepCollectionEquality()
.equals(other._categories, _categories) &&
const DeepCollectionEquality().equals(other._links, _links) &&
(identical(other.streamLink, streamLink) ||
other.streamLink == streamLink) &&
(identical(other.published, published) ||
other.published == published) &&
(identical(other.updated, updated) || other.updated == updated) &&
(identical(other.firstCachedAt, firstCachedAt) ||
other.firstCachedAt == firstCachedAt) &&
(identical(other.lastCachedAt, lastCachedAt) ||
other.lastCachedAt == lastCachedAt) &&
(identical(other.lastAccessedAt, lastAccessedAt) ||
other.lastAccessedAt == lastAccessedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([
runtimeType,
id,
serverId,
opdsId,
title,
const DeepCollectionEquality().hash(_authors),
summary,
content,
coverPath,
thumbnailPath,
coverUrl,
thumbnailUrl,
series,
seriesPosition,
publisher,
language,
isbn,
const DeepCollectionEquality().hash(_categories),
const DeepCollectionEquality().hash(_links),
streamLink,
published,
updated,
firstCachedAt,
lastCachedAt,
lastAccessedAt
]);
/// Create a copy of Publication
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PublicationImplCopyWith<_$PublicationImpl> get copyWith =>
__$$PublicationImplCopyWithImpl<_$PublicationImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$PublicationImplToJson(
this,
);
}
}
abstract class _Publication extends Publication {
const factory _Publication(
{required final String id,
required final String serverId,
required final String opdsId,
required final String title,
final List<String> authors,
final String? summary,
final String? content,
final String? coverPath,
final String? thumbnailPath,
final String? coverUrl,
final String? thumbnailUrl,
final String? series,
final double? seriesPosition,
final String? publisher,
final String? language,
final String? isbn,
final List<String> categories,
final List<OPDSLink> links,
final OPDSStreamLink? streamLink,
final DateTime? published,
final DateTime? updated,
required final DateTime firstCachedAt,
required final DateTime lastCachedAt,
required final DateTime lastAccessedAt}) = _$PublicationImpl;
const _Publication._() : super._();
factory _Publication.fromJson(Map<String, dynamic> json) =
_$PublicationImpl.fromJson;
@override
String get id;
@override
String get serverId;
@override
String get opdsId;
@override
String get title;
@override
List<String> get authors;
@override
String? get summary;
@override
String? get content;
@override
String? get coverPath;
@override
String? get thumbnailPath;
@override
String? get coverUrl;
@override
String? get thumbnailUrl;
@override
String? get series;
@override
double? get seriesPosition;
@override
String? get publisher;
@override
String? get language;
@override
String? get isbn;
@override
List<String> get categories;
@override
List<OPDSLink> get links;
@override
OPDSStreamLink? get streamLink;
@override
DateTime? get published;
@override
DateTime? get updated;
@override
DateTime get firstCachedAt;
@override
DateTime get lastCachedAt;
@override
DateTime get lastAccessedAt;
/// Create a copy of Publication
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PublicationImplCopyWith<_$PublicationImpl> get copyWith =>
throw _privateConstructorUsedError;
}