Refactor chapter list provider and improve TTS functionality
- Removed the constant chapterPageSize and refactored ChapterListQuery to use a simpler approach for fetching chapters. - Updated the chapter list provider to handle fetching all chapters in a single request with pagination. - Enhanced error handling for fetching chapters by resolving canonical IDs when necessary. - Modified TTS functionality to ensure proper handling of Android fallback reading and improved error management. - Added a new setting to enable/disable TTS on sentence tap. - Updated UI components in the reader screen for better user experience and added navigation buttons for chapters. - Bumped version to 1.0.3+4 in pubspec.yaml.
This commit is contained in:
@@ -2,10 +2,26 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
import 'novel_model.dart';
|
||||
|
||||
enum BookmarkType {
|
||||
reading('reading'),
|
||||
bookmarked('bookmarked');
|
||||
|
||||
const BookmarkType(this.value);
|
||||
final String value;
|
||||
|
||||
static BookmarkType fromString(String? str) {
|
||||
return values.firstWhere(
|
||||
(e) => e.value == str,
|
||||
orElse: () => BookmarkType.bookmarked,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BookmarkModel extends Equatable {
|
||||
const BookmarkModel({
|
||||
required this.id,
|
||||
required this.novelId,
|
||||
this.type = BookmarkType.bookmarked,
|
||||
this.lastChapterId,
|
||||
this.lastChapterNumber,
|
||||
this.readChapters = const [],
|
||||
@@ -14,6 +30,7 @@ class BookmarkModel extends Equatable {
|
||||
|
||||
final String id;
|
||||
final String novelId;
|
||||
final BookmarkType type;
|
||||
final String? lastChapterId;
|
||||
final int? lastChapterNumber;
|
||||
final List<int> readChapters;
|
||||
@@ -22,6 +39,7 @@ class BookmarkModel extends Equatable {
|
||||
factory BookmarkModel.fromJson(Map<String, dynamic> json) => BookmarkModel(
|
||||
id: json['id'] as String,
|
||||
novelId: json['novelId'] as String,
|
||||
type: BookmarkType.fromString(json['type'] as String?),
|
||||
lastChapterId: json['lastChapterId'] as String?,
|
||||
lastChapterNumber: json['lastChapterNumber'] as int?,
|
||||
readChapters: (json['readChapters'] as List<dynamic>?)
|
||||
@@ -34,5 +52,5 @@ class BookmarkModel extends Equatable {
|
||||
);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, novelId];
|
||||
List<Object?> get props => [id, novelId, type];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user