worldhopper/lib/providers/publication_cache_provider.g.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

274 lines
8.1 KiB
Dart

// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'publication_cache_provider.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$publicationRepositoryHash() =>
r'69873c0a15586a8d961f715f276d15be7dca65ed';
/// Provider for PublicationRepository instance
///
/// Copied from [publicationRepository].
@ProviderFor(publicationRepository)
final publicationRepositoryProvider =
AutoDisposeProvider<PublicationRepository>.internal(
publicationRepository,
name: r'publicationRepositoryProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$publicationRepositoryHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef PublicationRepositoryRef
= AutoDisposeProviderRef<PublicationRepository>;
String _$imageCacheServiceHash() => r'fbd6cd1281d79c781dfe621fbbc8862c32b911e4';
/// Provider for ImageCacheService instance
///
/// Copied from [imageCacheService].
@ProviderFor(imageCacheService)
final imageCacheServiceProvider =
AutoDisposeFutureProvider<ImageCacheService>.internal(
imageCacheService,
name: r'imageCacheServiceProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$imageCacheServiceHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef ImageCacheServiceRef = AutoDisposeFutureProviderRef<ImageCacheService>;
String _$readingProgressRepositoryHash() =>
r'f14aafb461cbe7249f01f827d192853a69851110';
/// Provider for ReadingProgressRepository instance (if not already provided elsewhere)
///
/// Copied from [readingProgressRepository].
@ProviderFor(readingProgressRepository)
final readingProgressRepositoryProvider =
AutoDisposeProvider<ReadingProgressRepository>.internal(
readingProgressRepository,
name: r'readingProgressRepositoryProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$readingProgressRepositoryHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef ReadingProgressRepositoryRef
= AutoDisposeProviderRef<ReadingProgressRepository>;
String _$cachedPublicationHash() => r'07cb1ea9a63bb21a192a99262f20170b2fdff270';
/// Copied from Dart SDK
class _SystemHash {
_SystemHash._();
static int combine(int hash, int value) {
// ignore: parameter_assignments
hash = 0x1fffffff & (hash + value);
// ignore: parameter_assignments
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
return hash ^ (hash >> 6);
}
static int finish(int hash) {
// ignore: parameter_assignments
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
// ignore: parameter_assignments
hash = hash ^ (hash >> 11);
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
}
}
/// Provider for single publication lookup
///
/// Copied from [cachedPublication].
@ProviderFor(cachedPublication)
const cachedPublicationProvider = CachedPublicationFamily();
/// Provider for single publication lookup
///
/// Copied from [cachedPublication].
class CachedPublicationFamily extends Family<AsyncValue<Publication?>> {
/// Provider for single publication lookup
///
/// Copied from [cachedPublication].
const CachedPublicationFamily();
/// Provider for single publication lookup
///
/// Copied from [cachedPublication].
CachedPublicationProvider call(
String serverId,
String opdsId,
) {
return CachedPublicationProvider(
serverId,
opdsId,
);
}
@override
CachedPublicationProvider getProviderOverride(
covariant CachedPublicationProvider provider,
) {
return call(
provider.serverId,
provider.opdsId,
);
}
static const Iterable<ProviderOrFamily>? _dependencies = null;
@override
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
@override
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
_allTransitiveDependencies;
@override
String? get name => r'cachedPublicationProvider';
}
/// Provider for single publication lookup
///
/// Copied from [cachedPublication].
class CachedPublicationProvider
extends AutoDisposeFutureProvider<Publication?> {
/// Provider for single publication lookup
///
/// Copied from [cachedPublication].
CachedPublicationProvider(
String serverId,
String opdsId,
) : this._internal(
(ref) => cachedPublication(
ref as CachedPublicationRef,
serverId,
opdsId,
),
from: cachedPublicationProvider,
name: r'cachedPublicationProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product')
? null
: _$cachedPublicationHash,
dependencies: CachedPublicationFamily._dependencies,
allTransitiveDependencies:
CachedPublicationFamily._allTransitiveDependencies,
serverId: serverId,
opdsId: opdsId,
);
CachedPublicationProvider._internal(
super._createNotifier, {
required super.name,
required super.dependencies,
required super.allTransitiveDependencies,
required super.debugGetCreateSourceHash,
required super.from,
required this.serverId,
required this.opdsId,
}) : super.internal();
final String serverId;
final String opdsId;
@override
Override overrideWith(
FutureOr<Publication?> Function(CachedPublicationRef provider) create,
) {
return ProviderOverride(
origin: this,
override: CachedPublicationProvider._internal(
(ref) => create(ref as CachedPublicationRef),
from: from,
name: null,
dependencies: null,
allTransitiveDependencies: null,
debugGetCreateSourceHash: null,
serverId: serverId,
opdsId: opdsId,
),
);
}
@override
AutoDisposeFutureProviderElement<Publication?> createElement() {
return _CachedPublicationProviderElement(this);
}
@override
bool operator ==(Object other) {
return other is CachedPublicationProvider &&
other.serverId == serverId &&
other.opdsId == opdsId;
}
@override
int get hashCode {
var hash = _SystemHash.combine(0, runtimeType.hashCode);
hash = _SystemHash.combine(hash, serverId.hashCode);
hash = _SystemHash.combine(hash, opdsId.hashCode);
return _SystemHash.finish(hash);
}
}
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
mixin CachedPublicationRef on AutoDisposeFutureProviderRef<Publication?> {
/// The parameter `serverId` of this provider.
String get serverId;
/// The parameter `opdsId` of this provider.
String get opdsId;
}
class _CachedPublicationProviderElement
extends AutoDisposeFutureProviderElement<Publication?>
with CachedPublicationRef {
_CachedPublicationProviderElement(super.provider);
@override
String get serverId => (origin as CachedPublicationProvider).serverId;
@override
String get opdsId => (origin as CachedPublicationProvider).opdsId;
}
String _$publicationCacheHash() => r'504654bd7d5f3d81f9c9f9b79fcd9ef0e3a17198';
/// Provider for publication cache operations
///
/// Copied from [PublicationCache].
@ProviderFor(PublicationCache)
final publicationCacheProvider =
AutoDisposeAsyncNotifierProvider<PublicationCache, void>.internal(
PublicationCache.new,
name: r'publicationCacheProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$publicationCacheHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef _$PublicationCache = AutoDisposeAsyncNotifier<void>;
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package