mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-05-13 22:50:39 +00:00
- Added new localization strings for total, mean per title, completion rate, watching time, reading time, average chapters per title, read percentage, and entries in multiple languages. - Enhanced the History model to include readingTimeSeconds. - Updated AnimeStreamController and ReaderController to track reading time and save it to history. - Implemented reading time tracking in Anime and Novel reader views. - Introduced statistics calculations for total reading time across histories. - Updated statistics screen to display total reading time and average reading time per title.
59 lines
1.2 KiB
Dart
59 lines
1.2 KiB
Dart
import 'package:isar_community/isar.dart';
|
|
import 'package:mangayomi/models/chapter.dart';
|
|
import 'package:mangayomi/models/manga.dart';
|
|
part 'history.g.dart';
|
|
|
|
@collection
|
|
@Name("History")
|
|
class History {
|
|
Id? id;
|
|
|
|
int? mangaId;
|
|
|
|
int? chapterId;
|
|
|
|
bool? isManga;
|
|
|
|
@enumerated
|
|
late ItemType itemType;
|
|
|
|
final chapter = IsarLink<Chapter>();
|
|
|
|
String? date;
|
|
|
|
int? updatedAt;
|
|
|
|
int? readingTimeSeconds;
|
|
|
|
History({
|
|
this.id = Isar.autoIncrement,
|
|
this.isManga,
|
|
required this.itemType,
|
|
required this.chapterId,
|
|
required this.mangaId,
|
|
required this.date,
|
|
this.updatedAt = 0,
|
|
this.readingTimeSeconds,
|
|
});
|
|
|
|
History.fromJson(Map<String, dynamic> json) {
|
|
chapterId = json['chapterId'];
|
|
date = json['date'];
|
|
id = json['id'];
|
|
isManga = json['isManga'];
|
|
itemType = ItemType.values[json['itemType'] ?? 0];
|
|
mangaId = json['mangaId'];
|
|
updatedAt = json['updatedAt'];
|
|
readingTimeSeconds = json['readingTimeSeconds'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'chapterId': chapterId,
|
|
'date': date,
|
|
'id': id,
|
|
'itemType': itemType.index,
|
|
'mangaId': mangaId,
|
|
'updatedAt': updatedAt ?? 0,
|
|
'readingTimeSeconds': readingTimeSeconds ?? 0,
|
|
};
|
|
}
|