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>
364 lines
12 KiB
Dart
364 lines
12 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 'reading_progress.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');
|
|
|
|
ReadingProgress _$ReadingProgressFromJson(Map<String, dynamic> json) {
|
|
return _ReadingProgress.fromJson(json);
|
|
}
|
|
|
|
/// @nodoc
|
|
mixin _$ReadingProgress {
|
|
/// Unique identifier for the progress record
|
|
String get id => throw _privateConstructorUsedError;
|
|
|
|
/// Publication identifier from OPDS feed
|
|
String get publicationId => throw _privateConstructorUsedError;
|
|
|
|
/// Server identifier
|
|
String get serverId => throw _privateConstructorUsedError;
|
|
|
|
/// Current page (0-indexed)
|
|
int get currentPage => throw _privateConstructorUsedError;
|
|
|
|
/// Total number of pages
|
|
int get totalPages => throw _privateConstructorUsedError;
|
|
|
|
/// EPUB location for EPUB files (CFI, chapter, or position)
|
|
String? get epubLocation => throw _privateConstructorUsedError;
|
|
|
|
/// Last read timestamp
|
|
DateTime get lastReadAt => throw _privateConstructorUsedError;
|
|
|
|
/// Publication cache ID (references publications table)
|
|
String? get publicationCacheId => throw _privateConstructorUsedError;
|
|
|
|
/// Serializes this ReadingProgress to a JSON map.
|
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
|
|
|
/// Create a copy of ReadingProgress
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
$ReadingProgressCopyWith<ReadingProgress> get copyWith =>
|
|
throw _privateConstructorUsedError;
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract class $ReadingProgressCopyWith<$Res> {
|
|
factory $ReadingProgressCopyWith(
|
|
ReadingProgress value, $Res Function(ReadingProgress) then) =
|
|
_$ReadingProgressCopyWithImpl<$Res, ReadingProgress>;
|
|
@useResult
|
|
$Res call(
|
|
{String id,
|
|
String publicationId,
|
|
String serverId,
|
|
int currentPage,
|
|
int totalPages,
|
|
String? epubLocation,
|
|
DateTime lastReadAt,
|
|
String? publicationCacheId});
|
|
}
|
|
|
|
/// @nodoc
|
|
class _$ReadingProgressCopyWithImpl<$Res, $Val extends ReadingProgress>
|
|
implements $ReadingProgressCopyWith<$Res> {
|
|
_$ReadingProgressCopyWithImpl(this._value, this._then);
|
|
|
|
// ignore: unused_field
|
|
final $Val _value;
|
|
// ignore: unused_field
|
|
final $Res Function($Val) _then;
|
|
|
|
/// Create a copy of ReadingProgress
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline')
|
|
@override
|
|
$Res call({
|
|
Object? id = null,
|
|
Object? publicationId = null,
|
|
Object? serverId = null,
|
|
Object? currentPage = null,
|
|
Object? totalPages = null,
|
|
Object? epubLocation = freezed,
|
|
Object? lastReadAt = null,
|
|
Object? publicationCacheId = freezed,
|
|
}) {
|
|
return _then(_value.copyWith(
|
|
id: null == id
|
|
? _value.id
|
|
: id // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
publicationId: null == publicationId
|
|
? _value.publicationId
|
|
: publicationId // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
serverId: null == serverId
|
|
? _value.serverId
|
|
: serverId // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
currentPage: null == currentPage
|
|
? _value.currentPage
|
|
: currentPage // ignore: cast_nullable_to_non_nullable
|
|
as int,
|
|
totalPages: null == totalPages
|
|
? _value.totalPages
|
|
: totalPages // ignore: cast_nullable_to_non_nullable
|
|
as int,
|
|
epubLocation: freezed == epubLocation
|
|
? _value.epubLocation
|
|
: epubLocation // ignore: cast_nullable_to_non_nullable
|
|
as String?,
|
|
lastReadAt: null == lastReadAt
|
|
? _value.lastReadAt
|
|
: lastReadAt // ignore: cast_nullable_to_non_nullable
|
|
as DateTime,
|
|
publicationCacheId: freezed == publicationCacheId
|
|
? _value.publicationCacheId
|
|
: publicationCacheId // ignore: cast_nullable_to_non_nullable
|
|
as String?,
|
|
) as $Val);
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
abstract class _$$ReadingProgressImplCopyWith<$Res>
|
|
implements $ReadingProgressCopyWith<$Res> {
|
|
factory _$$ReadingProgressImplCopyWith(_$ReadingProgressImpl value,
|
|
$Res Function(_$ReadingProgressImpl) then) =
|
|
__$$ReadingProgressImplCopyWithImpl<$Res>;
|
|
@override
|
|
@useResult
|
|
$Res call(
|
|
{String id,
|
|
String publicationId,
|
|
String serverId,
|
|
int currentPage,
|
|
int totalPages,
|
|
String? epubLocation,
|
|
DateTime lastReadAt,
|
|
String? publicationCacheId});
|
|
}
|
|
|
|
/// @nodoc
|
|
class __$$ReadingProgressImplCopyWithImpl<$Res>
|
|
extends _$ReadingProgressCopyWithImpl<$Res, _$ReadingProgressImpl>
|
|
implements _$$ReadingProgressImplCopyWith<$Res> {
|
|
__$$ReadingProgressImplCopyWithImpl(
|
|
_$ReadingProgressImpl _value, $Res Function(_$ReadingProgressImpl) _then)
|
|
: super(_value, _then);
|
|
|
|
/// Create a copy of ReadingProgress
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@pragma('vm:prefer-inline')
|
|
@override
|
|
$Res call({
|
|
Object? id = null,
|
|
Object? publicationId = null,
|
|
Object? serverId = null,
|
|
Object? currentPage = null,
|
|
Object? totalPages = null,
|
|
Object? epubLocation = freezed,
|
|
Object? lastReadAt = null,
|
|
Object? publicationCacheId = freezed,
|
|
}) {
|
|
return _then(_$ReadingProgressImpl(
|
|
id: null == id
|
|
? _value.id
|
|
: id // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
publicationId: null == publicationId
|
|
? _value.publicationId
|
|
: publicationId // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
serverId: null == serverId
|
|
? _value.serverId
|
|
: serverId // ignore: cast_nullable_to_non_nullable
|
|
as String,
|
|
currentPage: null == currentPage
|
|
? _value.currentPage
|
|
: currentPage // ignore: cast_nullable_to_non_nullable
|
|
as int,
|
|
totalPages: null == totalPages
|
|
? _value.totalPages
|
|
: totalPages // ignore: cast_nullable_to_non_nullable
|
|
as int,
|
|
epubLocation: freezed == epubLocation
|
|
? _value.epubLocation
|
|
: epubLocation // ignore: cast_nullable_to_non_nullable
|
|
as String?,
|
|
lastReadAt: null == lastReadAt
|
|
? _value.lastReadAt
|
|
: lastReadAt // ignore: cast_nullable_to_non_nullable
|
|
as DateTime,
|
|
publicationCacheId: freezed == publicationCacheId
|
|
? _value.publicationCacheId
|
|
: publicationCacheId // ignore: cast_nullable_to_non_nullable
|
|
as String?,
|
|
));
|
|
}
|
|
}
|
|
|
|
/// @nodoc
|
|
@JsonSerializable()
|
|
class _$ReadingProgressImpl extends _ReadingProgress {
|
|
const _$ReadingProgressImpl(
|
|
{required this.id,
|
|
required this.publicationId,
|
|
required this.serverId,
|
|
required this.currentPage,
|
|
required this.totalPages,
|
|
this.epubLocation,
|
|
required this.lastReadAt,
|
|
this.publicationCacheId})
|
|
: super._();
|
|
|
|
factory _$ReadingProgressImpl.fromJson(Map<String, dynamic> json) =>
|
|
_$$ReadingProgressImplFromJson(json);
|
|
|
|
/// Unique identifier for the progress record
|
|
@override
|
|
final String id;
|
|
|
|
/// Publication identifier from OPDS feed
|
|
@override
|
|
final String publicationId;
|
|
|
|
/// Server identifier
|
|
@override
|
|
final String serverId;
|
|
|
|
/// Current page (0-indexed)
|
|
@override
|
|
final int currentPage;
|
|
|
|
/// Total number of pages
|
|
@override
|
|
final int totalPages;
|
|
|
|
/// EPUB location for EPUB files (CFI, chapter, or position)
|
|
@override
|
|
final String? epubLocation;
|
|
|
|
/// Last read timestamp
|
|
@override
|
|
final DateTime lastReadAt;
|
|
|
|
/// Publication cache ID (references publications table)
|
|
@override
|
|
final String? publicationCacheId;
|
|
|
|
@override
|
|
String toString() {
|
|
return 'ReadingProgress(id: $id, publicationId: $publicationId, serverId: $serverId, currentPage: $currentPage, totalPages: $totalPages, epubLocation: $epubLocation, lastReadAt: $lastReadAt, publicationCacheId: $publicationCacheId)';
|
|
}
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
return identical(this, other) ||
|
|
(other.runtimeType == runtimeType &&
|
|
other is _$ReadingProgressImpl &&
|
|
(identical(other.id, id) || other.id == id) &&
|
|
(identical(other.publicationId, publicationId) ||
|
|
other.publicationId == publicationId) &&
|
|
(identical(other.serverId, serverId) ||
|
|
other.serverId == serverId) &&
|
|
(identical(other.currentPage, currentPage) ||
|
|
other.currentPage == currentPage) &&
|
|
(identical(other.totalPages, totalPages) ||
|
|
other.totalPages == totalPages) &&
|
|
(identical(other.epubLocation, epubLocation) ||
|
|
other.epubLocation == epubLocation) &&
|
|
(identical(other.lastReadAt, lastReadAt) ||
|
|
other.lastReadAt == lastReadAt) &&
|
|
(identical(other.publicationCacheId, publicationCacheId) ||
|
|
other.publicationCacheId == publicationCacheId));
|
|
}
|
|
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@override
|
|
int get hashCode => Object.hash(runtimeType, id, publicationId, serverId,
|
|
currentPage, totalPages, epubLocation, lastReadAt, publicationCacheId);
|
|
|
|
/// Create a copy of ReadingProgress
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
@override
|
|
@pragma('vm:prefer-inline')
|
|
_$$ReadingProgressImplCopyWith<_$ReadingProgressImpl> get copyWith =>
|
|
__$$ReadingProgressImplCopyWithImpl<_$ReadingProgressImpl>(
|
|
this, _$identity);
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() {
|
|
return _$$ReadingProgressImplToJson(
|
|
this,
|
|
);
|
|
}
|
|
}
|
|
|
|
abstract class _ReadingProgress extends ReadingProgress {
|
|
const factory _ReadingProgress(
|
|
{required final String id,
|
|
required final String publicationId,
|
|
required final String serverId,
|
|
required final int currentPage,
|
|
required final int totalPages,
|
|
final String? epubLocation,
|
|
required final DateTime lastReadAt,
|
|
final String? publicationCacheId}) = _$ReadingProgressImpl;
|
|
const _ReadingProgress._() : super._();
|
|
|
|
factory _ReadingProgress.fromJson(Map<String, dynamic> json) =
|
|
_$ReadingProgressImpl.fromJson;
|
|
|
|
/// Unique identifier for the progress record
|
|
@override
|
|
String get id;
|
|
|
|
/// Publication identifier from OPDS feed
|
|
@override
|
|
String get publicationId;
|
|
|
|
/// Server identifier
|
|
@override
|
|
String get serverId;
|
|
|
|
/// Current page (0-indexed)
|
|
@override
|
|
int get currentPage;
|
|
|
|
/// Total number of pages
|
|
@override
|
|
int get totalPages;
|
|
|
|
/// EPUB location for EPUB files (CFI, chapter, or position)
|
|
@override
|
|
String? get epubLocation;
|
|
|
|
/// Last read timestamp
|
|
@override
|
|
DateTime get lastReadAt;
|
|
|
|
/// Publication cache ID (references publications table)
|
|
@override
|
|
String? get publicationCacheId;
|
|
|
|
/// Create a copy of ReadingProgress
|
|
/// with the given fields replaced by the non-null parameter values.
|
|
@override
|
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
_$$ReadingProgressImplCopyWith<_$ReadingProgressImpl> get copyWith =>
|
|
throw _privateConstructorUsedError;
|
|
}
|