Initial commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../../core/domain/usecases/series_resume_target.dart';
|
||||
|
||||
|
||||
class EpisodeAutoSelectArgs {
|
||||
|
||||
final bool autoSelectFirstEpisode;
|
||||
|
||||
|
||||
final String? autoSelectEpisodeId;
|
||||
|
||||
|
||||
final String? autoSelectSeasonId;
|
||||
|
||||
const EpisodeAutoSelectArgs({
|
||||
required this.autoSelectFirstEpisode,
|
||||
required this.autoSelectEpisodeId,
|
||||
required this.autoSelectSeasonId,
|
||||
});
|
||||
|
||||
|
||||
factory EpisodeAutoSelectArgs.fromResume(
|
||||
AsyncValue<SeriesResumeTarget?>? resumeAsync,
|
||||
) {
|
||||
final loading = resumeAsync?.isLoading ?? false;
|
||||
final target = resumeAsync?.value;
|
||||
return EpisodeAutoSelectArgs(
|
||||
autoSelectFirstEpisode: !loading,
|
||||
autoSelectEpisodeId: target?.episodeId,
|
||||
autoSelectSeasonId: target?.seasonId,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user