feat: Implement TTS playback store and enhance reading progress synchronization
- Added ReaderTtsPlaybackStore to manage TTS start requests with a maximum of 4 pending requests. - Updated app configuration to use a production API URL. - Enhanced BookmarkModel to infer type when not provided by the API for backward compatibility. - Introduced methods in LocalStore for saving, loading, and clearing the last route path. - Implemented syncProgress method in BookshelfNotifier to update reading progress and bookmarks from the server. - Modified ReaderScreen to handle chapter navigation and TTS playback more effectively, including auto-start logic. - Updated TtsPlayerWidget to accept additional parameters for chapter navigation. - Enhanced TtsNotifier to handle new parameters for TTS requests and manage playback state. - Improved SplashScreen to restore the last visited route after splash screen display.
This commit is contained in:
@@ -11,6 +11,9 @@ class TtsPlayerWidget extends ConsumerWidget {
|
||||
required this.content,
|
||||
this.contentKey,
|
||||
this.title,
|
||||
this.nextChapterId,
|
||||
this.chapterNumber,
|
||||
this.apiBaseUrl,
|
||||
this.includeTitleOnStart = true,
|
||||
this.resolveStartParagraphIndex,
|
||||
this.onStarted,
|
||||
@@ -20,6 +23,9 @@ class TtsPlayerWidget extends ConsumerWidget {
|
||||
final String content;
|
||||
final String? contentKey;
|
||||
final String? title;
|
||||
final String? nextChapterId;
|
||||
final int? chapterNumber;
|
||||
final String? apiBaseUrl;
|
||||
final bool includeTitleOnStart;
|
||||
final int Function()? resolveStartParagraphIndex;
|
||||
final VoidCallback? onStarted;
|
||||
@@ -39,6 +45,8 @@ class TtsPlayerWidget extends ConsumerWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
notifier.clearPendingAutoStartChapter();
|
||||
|
||||
unawaited(
|
||||
notifier.startReading(
|
||||
content,
|
||||
@@ -46,6 +54,9 @@ class TtsPlayerWidget extends ConsumerWidget {
|
||||
startParagraphIndex: resolveStartParagraphIndex?.call(),
|
||||
contentKey: contentKey,
|
||||
title: title,
|
||||
nextChapterId: nextChapterId,
|
||||
chapterNumber: chapterNumber,
|
||||
apiBaseUrl: apiBaseUrl,
|
||||
includeTitle: includeTitleOnStart,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user