worldhopper/lib/database/tables/downloaded_series_table.dart
Felipe M. 30df288552
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
feat: add offline series download with local reading support
Enable downloading entire series for offline reading. Includes database
tables and migration for downloaded series/chapters, download orchestration
with progress tracking, per-chapter EPUB and image stream downloading,
a Downloaded section in the library, and offline-first reader support.

Key changes:
- DB migration v11 with downloaded_series and downloaded_chapters tables
- Series download service with pagination, cancellation, and progress stream
- Feed screen download button with status indicators and completion feedback
- Library screen Downloaded section with series cards and detail screen
- Reader pre-caching using local files (including two-page spread mode)
- Next-in-series navigation resolves from downloaded chapters when offline
- Skip image downloads and progress sync when device is offline
- Settings screen shows download storage usage with clear option

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:40:15 +01:00

42 lines
1.3 KiB
Dart

/// SQL schema for the downloaded_series table
class DownloadedSeriesTable {
DownloadedSeriesTable._();
static const String tableName = 'downloaded_series';
/// SQL statement to create the downloaded_series table
static const String createTable = '''
CREATE TABLE $tableName (
id TEXT PRIMARY KEY,
server_id TEXT NOT NULL,
series_feed_url TEXT NOT NULL,
title TEXT NOT NULL,
cover_url TEXT,
cover_path TEXT,
thumbnail_url TEXT,
thumbnail_path TEXT,
status TEXT NOT NULL DEFAULT 'pending',
total_chapters INTEGER NOT NULL DEFAULT 0,
downloaded_chapters_count INTEGER NOT NULL DEFAULT 0,
downloaded_at INTEGER,
updated_at INTEGER NOT NULL,
FOREIGN KEY (server_id) REFERENCES servers(id) ON DELETE CASCADE,
UNIQUE(server_id, series_feed_url)
)
''';
/// SQL statement to drop the downloaded_series table
static const String dropTable = 'DROP TABLE IF EXISTS $tableName';
/// Create index on server_id for faster lookups
static const String createServerIndex = '''
CREATE INDEX idx_downloaded_series_server_id
ON $tableName(server_id)
''';
/// Create index on status for filtering
static const String createStatusIndex = '''
CREATE INDEX idx_downloaded_series_status
ON $tableName(status)
''';
}