feat: Enhance TTS player functionality and UI
- Added resume functionality to TTS player when paused. - Display voice name or language in TTS player UI. - Improved error handling in reader provider with debug messages. - Updated TTS service to configure Vietnamese voice and handle platform-specific audio settings. - Removed wakelock dependency and related code. - Fixed search screen error handling. - Updated settings screen to navigate to home after sign out. - Improved splash screen with timer management. - Enhanced main app error handling with logging. - Removed unused package_info_plus and wakelock_plus dependencies. - Added environment variable support for mobile runtime. - Integrated Google Sign-In configuration for Android. - Created logging observer for Riverpod providers. - Added scripts for environment setup and Google Sign-In validation.
This commit is contained in:
@@ -41,13 +41,24 @@ class NovelModel extends Equatable {
|
||||
final SeriesModel? series;
|
||||
final LatestChapterInfo? latestChapter;
|
||||
|
||||
static String _stringValue(dynamic value, {String fallback = ''}) {
|
||||
if (value is String) return value;
|
||||
if (value == null) return fallback;
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
static int _intValue(dynamic value, {int fallback = 0}) {
|
||||
if (value is num) return value.toInt();
|
||||
return fallback;
|
||||
}
|
||||
|
||||
factory NovelModel.fromJson(Map<String, dynamic> json) => NovelModel(
|
||||
id: json['id'] as String,
|
||||
title: json['title'] as String,
|
||||
slug: json['slug'] as String,
|
||||
authorName: json['authorName'] as String,
|
||||
status: json['status'] as String,
|
||||
totalChapters: (json['totalChapters'] as num).toInt(),
|
||||
id: _stringValue(json['id']),
|
||||
title: _stringValue(json['title'], fallback: 'Không rõ tiêu đề'),
|
||||
slug: _stringValue(json['slug']),
|
||||
authorName: _stringValue(json['authorName'], fallback: 'Chưa rõ tác giả'),
|
||||
status: _stringValue(json['status'], fallback: 'Đang ra'),
|
||||
totalChapters: _intValue(json['totalChapters']),
|
||||
originalTitle: json['originalTitle'] as String?,
|
||||
description: json['description'] as String?,
|
||||
coverUrl: json['coverUrl'] as String?,
|
||||
|
||||
@@ -4,24 +4,40 @@ class ReadingSettings {
|
||||
this.lineHeight = 1.8,
|
||||
this.letterSpacing = 0,
|
||||
this.fontFamily = 'serif',
|
||||
this.themePreset = 'paper',
|
||||
this.horizontalPadding = 20,
|
||||
this.paragraphSpacing = 24,
|
||||
this.textAlign = 'justify',
|
||||
});
|
||||
|
||||
final double fontSize;
|
||||
final double lineHeight;
|
||||
final double letterSpacing;
|
||||
final String fontFamily;
|
||||
final String themePreset;
|
||||
final double horizontalPadding;
|
||||
final double paragraphSpacing;
|
||||
final String textAlign;
|
||||
|
||||
ReadingSettings copyWith({
|
||||
double? fontSize,
|
||||
double? lineHeight,
|
||||
double? letterSpacing,
|
||||
String? fontFamily,
|
||||
String? themePreset,
|
||||
double? horizontalPadding,
|
||||
double? paragraphSpacing,
|
||||
String? textAlign,
|
||||
}) =>
|
||||
ReadingSettings(
|
||||
fontSize: fontSize ?? this.fontSize,
|
||||
lineHeight: lineHeight ?? this.lineHeight,
|
||||
letterSpacing: letterSpacing ?? this.letterSpacing,
|
||||
fontFamily: fontFamily ?? this.fontFamily,
|
||||
themePreset: themePreset ?? this.themePreset,
|
||||
horizontalPadding: horizontalPadding ?? this.horizontalPadding,
|
||||
paragraphSpacing: paragraphSpacing ?? this.paragraphSpacing,
|
||||
textAlign: textAlign ?? this.textAlign,
|
||||
);
|
||||
|
||||
factory ReadingSettings.fromJson(Map<String, dynamic> json) => ReadingSettings(
|
||||
@@ -29,6 +45,10 @@ class ReadingSettings {
|
||||
lineHeight: (json['lineHeight'] as num?)?.toDouble() ?? 1.8,
|
||||
letterSpacing: (json['letterSpacing'] as num?)?.toDouble() ?? 0,
|
||||
fontFamily: json['fontFamily'] as String? ?? 'serif',
|
||||
themePreset: json['themePreset'] as String? ?? 'paper',
|
||||
horizontalPadding: (json['horizontalPadding'] as num?)?.toDouble() ?? 20,
|
||||
paragraphSpacing: (json['paragraphSpacing'] as num?)?.toDouble() ?? 24,
|
||||
textAlign: json['textAlign'] as String? ?? 'justify',
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@@ -36,5 +56,9 @@ class ReadingSettings {
|
||||
'lineHeight': lineHeight,
|
||||
'letterSpacing': letterSpacing,
|
||||
'fontFamily': fontFamily,
|
||||
'themePreset': themePreset,
|
||||
'horizontalPadding': horizontalPadding,
|
||||
'paragraphSpacing': paragraphSpacing,
|
||||
'textAlign': textAlign,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user