worldhopper/lib/models/downloaded_chapter.freezed.dart
Felipe M. d2497f8aed
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
feat: add background download service with error handling improvements
Add Android foreground service support for downloads to prevent OS
process killing during long operations. Fix multiple error handling
issues: foreground service leak on exceptions, polling stuck forever
on failure, double-counting chapters on retry, silent retry failures
without user feedback, and app crash if background service init fails.
Replace inaccurate failed chapter count heuristic with actual data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 11:44:37 +01:00

526 lines
18 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 'downloaded_chapter.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');
DownloadedChapter _$DownloadedChapterFromJson(Map<String, dynamic> json) {
return _DownloadedChapter.fromJson(json);
}
/// @nodoc
mixin _$DownloadedChapter {
String get id => throw _privateConstructorUsedError;
String get seriesId => throw _privateConstructorUsedError;
String get serverId => throw _privateConstructorUsedError;
String get entryId => throw _privateConstructorUsedError;
String get title => throw _privateConstructorUsedError;
ChapterContentType get contentType => throw _privateConstructorUsedError;
DownloadStatus get status => throw _privateConstructorUsedError;
String? get filePath => throw _privateConstructorUsedError;
int get totalPages => throw _privateConstructorUsedError;
int get downloadedPages => throw _privateConstructorUsedError;
String get entryJson => throw _privateConstructorUsedError;
String? get coverUrl => throw _privateConstructorUsedError;
String? get coverPath => throw _privateConstructorUsedError;
int get sortOrder => throw _privateConstructorUsedError;
String? get errorMessage => throw _privateConstructorUsedError;
DateTime? get downloadedAt => throw _privateConstructorUsedError;
DateTime get updatedAt => throw _privateConstructorUsedError;
/// Serializes this DownloadedChapter to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of DownloadedChapter
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$DownloadedChapterCopyWith<DownloadedChapter> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DownloadedChapterCopyWith<$Res> {
factory $DownloadedChapterCopyWith(
DownloadedChapter value, $Res Function(DownloadedChapter) then) =
_$DownloadedChapterCopyWithImpl<$Res, DownloadedChapter>;
@useResult
$Res call(
{String id,
String seriesId,
String serverId,
String entryId,
String title,
ChapterContentType contentType,
DownloadStatus status,
String? filePath,
int totalPages,
int downloadedPages,
String entryJson,
String? coverUrl,
String? coverPath,
int sortOrder,
String? errorMessage,
DateTime? downloadedAt,
DateTime updatedAt});
}
/// @nodoc
class _$DownloadedChapterCopyWithImpl<$Res, $Val extends DownloadedChapter>
implements $DownloadedChapterCopyWith<$Res> {
_$DownloadedChapterCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DownloadedChapter
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? seriesId = null,
Object? serverId = null,
Object? entryId = null,
Object? title = null,
Object? contentType = null,
Object? status = null,
Object? filePath = freezed,
Object? totalPages = null,
Object? downloadedPages = null,
Object? entryJson = null,
Object? coverUrl = freezed,
Object? coverPath = freezed,
Object? sortOrder = null,
Object? errorMessage = freezed,
Object? downloadedAt = freezed,
Object? updatedAt = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
seriesId: null == seriesId
? _value.seriesId
: seriesId // ignore: cast_nullable_to_non_nullable
as String,
serverId: null == serverId
? _value.serverId
: serverId // ignore: cast_nullable_to_non_nullable
as String,
entryId: null == entryId
? _value.entryId
: entryId // ignore: cast_nullable_to_non_nullable
as String,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
contentType: null == contentType
? _value.contentType
: contentType // ignore: cast_nullable_to_non_nullable
as ChapterContentType,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as DownloadStatus,
filePath: freezed == filePath
? _value.filePath
: filePath // ignore: cast_nullable_to_non_nullable
as String?,
totalPages: null == totalPages
? _value.totalPages
: totalPages // ignore: cast_nullable_to_non_nullable
as int,
downloadedPages: null == downloadedPages
? _value.downloadedPages
: downloadedPages // ignore: cast_nullable_to_non_nullable
as int,
entryJson: null == entryJson
? _value.entryJson
: entryJson // ignore: cast_nullable_to_non_nullable
as String,
coverUrl: freezed == coverUrl
? _value.coverUrl
: coverUrl // ignore: cast_nullable_to_non_nullable
as String?,
coverPath: freezed == coverPath
? _value.coverPath
: coverPath // ignore: cast_nullable_to_non_nullable
as String?,
sortOrder: null == sortOrder
? _value.sortOrder
: sortOrder // ignore: cast_nullable_to_non_nullable
as int,
errorMessage: freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
downloadedAt: freezed == downloadedAt
? _value.downloadedAt
: downloadedAt // ignore: cast_nullable_to_non_nullable
as DateTime?,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
}
/// @nodoc
abstract class _$$DownloadedChapterImplCopyWith<$Res>
implements $DownloadedChapterCopyWith<$Res> {
factory _$$DownloadedChapterImplCopyWith(_$DownloadedChapterImpl value,
$Res Function(_$DownloadedChapterImpl) then) =
__$$DownloadedChapterImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String id,
String seriesId,
String serverId,
String entryId,
String title,
ChapterContentType contentType,
DownloadStatus status,
String? filePath,
int totalPages,
int downloadedPages,
String entryJson,
String? coverUrl,
String? coverPath,
int sortOrder,
String? errorMessage,
DateTime? downloadedAt,
DateTime updatedAt});
}
/// @nodoc
class __$$DownloadedChapterImplCopyWithImpl<$Res>
extends _$DownloadedChapterCopyWithImpl<$Res, _$DownloadedChapterImpl>
implements _$$DownloadedChapterImplCopyWith<$Res> {
__$$DownloadedChapterImplCopyWithImpl(_$DownloadedChapterImpl _value,
$Res Function(_$DownloadedChapterImpl) _then)
: super(_value, _then);
/// Create a copy of DownloadedChapter
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? seriesId = null,
Object? serverId = null,
Object? entryId = null,
Object? title = null,
Object? contentType = null,
Object? status = null,
Object? filePath = freezed,
Object? totalPages = null,
Object? downloadedPages = null,
Object? entryJson = null,
Object? coverUrl = freezed,
Object? coverPath = freezed,
Object? sortOrder = null,
Object? errorMessage = freezed,
Object? downloadedAt = freezed,
Object? updatedAt = null,
}) {
return _then(_$DownloadedChapterImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
seriesId: null == seriesId
? _value.seriesId
: seriesId // ignore: cast_nullable_to_non_nullable
as String,
serverId: null == serverId
? _value.serverId
: serverId // ignore: cast_nullable_to_non_nullable
as String,
entryId: null == entryId
? _value.entryId
: entryId // ignore: cast_nullable_to_non_nullable
as String,
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
contentType: null == contentType
? _value.contentType
: contentType // ignore: cast_nullable_to_non_nullable
as ChapterContentType,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as DownloadStatus,
filePath: freezed == filePath
? _value.filePath
: filePath // ignore: cast_nullable_to_non_nullable
as String?,
totalPages: null == totalPages
? _value.totalPages
: totalPages // ignore: cast_nullable_to_non_nullable
as int,
downloadedPages: null == downloadedPages
? _value.downloadedPages
: downloadedPages // ignore: cast_nullable_to_non_nullable
as int,
entryJson: null == entryJson
? _value.entryJson
: entryJson // ignore: cast_nullable_to_non_nullable
as String,
coverUrl: freezed == coverUrl
? _value.coverUrl
: coverUrl // ignore: cast_nullable_to_non_nullable
as String?,
coverPath: freezed == coverPath
? _value.coverPath
: coverPath // ignore: cast_nullable_to_non_nullable
as String?,
sortOrder: null == sortOrder
? _value.sortOrder
: sortOrder // ignore: cast_nullable_to_non_nullable
as int,
errorMessage: freezed == errorMessage
? _value.errorMessage
: errorMessage // ignore: cast_nullable_to_non_nullable
as String?,
downloadedAt: freezed == downloadedAt
? _value.downloadedAt
: downloadedAt // ignore: cast_nullable_to_non_nullable
as DateTime?,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
@JsonSerializable()
class _$DownloadedChapterImpl extends _DownloadedChapter {
const _$DownloadedChapterImpl(
{required this.id,
required this.seriesId,
required this.serverId,
required this.entryId,
required this.title,
required this.contentType,
this.status = DownloadStatus.pending,
this.filePath,
this.totalPages = 0,
this.downloadedPages = 0,
required this.entryJson,
this.coverUrl,
this.coverPath,
this.sortOrder = 0,
this.errorMessage,
this.downloadedAt,
required this.updatedAt})
: super._();
factory _$DownloadedChapterImpl.fromJson(Map<String, dynamic> json) =>
_$$DownloadedChapterImplFromJson(json);
@override
final String id;
@override
final String seriesId;
@override
final String serverId;
@override
final String entryId;
@override
final String title;
@override
final ChapterContentType contentType;
@override
@JsonKey()
final DownloadStatus status;
@override
final String? filePath;
@override
@JsonKey()
final int totalPages;
@override
@JsonKey()
final int downloadedPages;
@override
final String entryJson;
@override
final String? coverUrl;
@override
final String? coverPath;
@override
@JsonKey()
final int sortOrder;
@override
final String? errorMessage;
@override
final DateTime? downloadedAt;
@override
final DateTime updatedAt;
@override
String toString() {
return 'DownloadedChapter(id: $id, seriesId: $seriesId, serverId: $serverId, entryId: $entryId, title: $title, contentType: $contentType, status: $status, filePath: $filePath, totalPages: $totalPages, downloadedPages: $downloadedPages, entryJson: $entryJson, coverUrl: $coverUrl, coverPath: $coverPath, sortOrder: $sortOrder, errorMessage: $errorMessage, downloadedAt: $downloadedAt, updatedAt: $updatedAt)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DownloadedChapterImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.seriesId, seriesId) ||
other.seriesId == seriesId) &&
(identical(other.serverId, serverId) ||
other.serverId == serverId) &&
(identical(other.entryId, entryId) || other.entryId == entryId) &&
(identical(other.title, title) || other.title == title) &&
(identical(other.contentType, contentType) ||
other.contentType == contentType) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.filePath, filePath) ||
other.filePath == filePath) &&
(identical(other.totalPages, totalPages) ||
other.totalPages == totalPages) &&
(identical(other.downloadedPages, downloadedPages) ||
other.downloadedPages == downloadedPages) &&
(identical(other.entryJson, entryJson) ||
other.entryJson == entryJson) &&
(identical(other.coverUrl, coverUrl) ||
other.coverUrl == coverUrl) &&
(identical(other.coverPath, coverPath) ||
other.coverPath == coverPath) &&
(identical(other.sortOrder, sortOrder) ||
other.sortOrder == sortOrder) &&
(identical(other.errorMessage, errorMessage) ||
other.errorMessage == errorMessage) &&
(identical(other.downloadedAt, downloadedAt) ||
other.downloadedAt == downloadedAt) &&
(identical(other.updatedAt, updatedAt) ||
other.updatedAt == updatedAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
id,
seriesId,
serverId,
entryId,
title,
contentType,
status,
filePath,
totalPages,
downloadedPages,
entryJson,
coverUrl,
coverPath,
sortOrder,
errorMessage,
downloadedAt,
updatedAt);
/// Create a copy of DownloadedChapter
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DownloadedChapterImplCopyWith<_$DownloadedChapterImpl> get copyWith =>
__$$DownloadedChapterImplCopyWithImpl<_$DownloadedChapterImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$DownloadedChapterImplToJson(
this,
);
}
}
abstract class _DownloadedChapter extends DownloadedChapter {
const factory _DownloadedChapter(
{required final String id,
required final String seriesId,
required final String serverId,
required final String entryId,
required final String title,
required final ChapterContentType contentType,
final DownloadStatus status,
final String? filePath,
final int totalPages,
final int downloadedPages,
required final String entryJson,
final String? coverUrl,
final String? coverPath,
final int sortOrder,
final String? errorMessage,
final DateTime? downloadedAt,
required final DateTime updatedAt}) = _$DownloadedChapterImpl;
const _DownloadedChapter._() : super._();
factory _DownloadedChapter.fromJson(Map<String, dynamic> json) =
_$DownloadedChapterImpl.fromJson;
@override
String get id;
@override
String get seriesId;
@override
String get serverId;
@override
String get entryId;
@override
String get title;
@override
ChapterContentType get contentType;
@override
DownloadStatus get status;
@override
String? get filePath;
@override
int get totalPages;
@override
int get downloadedPages;
@override
String get entryJson;
@override
String? get coverUrl;
@override
String? get coverPath;
@override
int get sortOrder;
@override
String? get errorMessage;
@override
DateTime? get downloadedAt;
@override
DateTime get updatedAt;
/// Create a copy of DownloadedChapter
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DownloadedChapterImplCopyWith<_$DownloadedChapterImpl> get copyWith =>
throw _privateConstructorUsedError;
}