20 lines
596 B
Dart
20 lines
596 B
Dart
import '../../core/data/models/drama.dart';
|
|
import '../../core/data/repositories/watch_history_repository.dart';
|
|
|
|
class DramaDetailLogic {
|
|
DramaDetailLogic({required this.drama, required this.history});
|
|
|
|
final Drama drama;
|
|
final WatchHistoryRepository history;
|
|
int? continueIndex;
|
|
|
|
Future<void> loadContinue() async {
|
|
final id = await history.lastEpisodeId(demoProfileId, drama.id);
|
|
if (id == null) return;
|
|
final index = drama.episodes.indexWhere((episode) => episode.id == id);
|
|
if (index >= 0 && drama.episodes[index].isFree) {
|
|
continueIndex = index;
|
|
}
|
|
}
|
|
}
|