diff --git a/lib/models/tts.dart b/lib/models/tts.dart index 8174119cd..650658897 100644 --- a/lib/models/tts.dart +++ b/lib/models/tts.dart @@ -37,6 +37,7 @@ class TtsModel extends ChangeNotifier { var _isRandomVoiceEnabled = true; var _isBotMuted = false; var _isEmoteMuted = false; + var _isPreludeMuted = false; var _speed = Platform.isAndroid ? 0.8 : 0.395; var _pitch = 1.0; var _isEnabled = false; @@ -131,7 +132,7 @@ class TtsModel extends ChangeNotifier { return ""; } final author = model.author.displayName ?? model.author.login; - if (!includeAuthorPrelude) { + if (!includeAuthorPrelude || isPreludeMuted) { return text; } return model.isAction ? "$author $text" : "$author said $text"; @@ -219,6 +220,15 @@ class TtsModel extends ChangeNotifier { notifyListeners(); } + bool get isPreludeMuted { + return _isPreludeMuted; + } + + set isPreludeMuted(bool value) { + _isPreludeMuted = value; + notifyListeners(); + } + bool get isCloudTtsEnabled { return _isCloudTtsEnabled; } @@ -383,6 +393,9 @@ class TtsModel extends ChangeNotifier { if (json['isEmoteMuted'] != null) { _isEmoteMuted = json['isEmoteMuted']; } + if (json['isPreludeMuted'] != null) { + _isPreludeMuted = json['isPreludeMuted']; + } if (json['isRandomVoiceEnabled'] != null) { _isRandomVoiceEnabled = json['isRandomVoiceEnabled']; } @@ -403,6 +416,7 @@ class TtsModel extends ChangeNotifier { Map toJson() => { "isBotMuted": isBotMuted, "isEmoteMuted": isEmoteMuted, + "isPreludeMuted": isPreludeMuted, "isRandomVoiceEnabled": isRandomVoiceEnabled, "language": language.languageCode, "pitch": pitch, diff --git a/lib/screens/settings/tts.dart b/lib/screens/settings/tts.dart index 4a53091a0..9c6dcbcf3 100644 --- a/lib/screens/settings/tts.dart +++ b/lib/screens/settings/tts.dart @@ -256,6 +256,13 @@ class TextToSpeechScreen extends StatelessWidget { model.isEmoteMuted = value; }, ), + SwitchListTile.adaptive( + title: const Text("Mute viewer names in text to speech"), + value: model.isPreludeMuted, + onChanged: (value) { + model.isPreludeMuted = value; + }, + ) ], ); }),