Drops dead code across services, models, utils and widgets, including the connection auth service, which had no implementer, and the Live TV DVR provisioning models, which had no caller. Tests that only covered deleted behaviour are removed or trimmed. No behaviour change.
59 lines
1.4 KiB
Dart
59 lines
1.4 KiB
Dart
// ignore_for_file: invalid_annotation_target
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
import '../utils/formatters.dart';
|
|
|
|
part 'download_models.freezed.dart';
|
|
|
|
enum DownloadStatus {
|
|
queued,
|
|
downloading,
|
|
paused,
|
|
completed,
|
|
failed,
|
|
cancelled,
|
|
partial, // Some episodes downloaded, but not all (for shows/seasons)
|
|
}
|
|
|
|
@freezed
|
|
sealed class DownloadProgress with _$DownloadProgress {
|
|
const DownloadProgress._();
|
|
|
|
const factory DownloadProgress({
|
|
required String globalKey,
|
|
required DownloadStatus status,
|
|
@Default(0) int progress,
|
|
@Default(0) int downloadedBytes,
|
|
@Default(0) int totalBytes,
|
|
@Default(0.0) double speed,
|
|
String? errorMessage,
|
|
String? currentFile,
|
|
String? thumbPath,
|
|
}) = _DownloadProgress;
|
|
|
|
double get progressPercent => progress / 100.0;
|
|
|
|
String get speedFormatted => ByteFormatter.formatSpeed(speed);
|
|
|
|
bool get hasArtworkPaths => thumbPath != null;
|
|
}
|
|
|
|
@freezed
|
|
sealed class DeletionProgress with _$DeletionProgress {
|
|
const DeletionProgress._();
|
|
|
|
const factory DeletionProgress({
|
|
required String globalKey,
|
|
required String itemTitle,
|
|
required int currentItem,
|
|
required int totalItems,
|
|
String? currentOperation,
|
|
}) = _DeletionProgress;
|
|
|
|
double get progressPercent => totalItems > 0 ? (currentItem / totalItems) : 0.0;
|
|
|
|
int get progressPercentInt => (progressPercent * 100).round();
|
|
|
|
bool get isComplete => currentItem >= totalItems;
|
|
}
|