don't play individual audios while main audio is playing (#1130)

* don't play individual audios while main audio is playing

* bump version
pull/1544/head
ggurdin 12 months ago committed by GitHub
parent 2397c8f78d
commit 30722b0615
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -25,6 +25,8 @@ class ChoicesArray extends StatefulWidget {
/// We don't want tts in the case of L1 options /// We don't want tts in the case of L1 options
final TtsController? tts; final TtsController? tts;
final bool enableAudio;
/// Used to unqiuely identify the keys for choices, in cases where multiple /// Used to unqiuely identify the keys for choices, in cases where multiple
/// choices could have identical text, like in back-to-back practice activities /// choices could have identical text, like in back-to-back practice activities
final String? id; final String? id;
@ -41,6 +43,7 @@ class ChoicesArray extends StatefulWidget {
required this.uniqueKeyForLayerLink, required this.uniqueKeyForLayerLink,
required this.selectedChoiceIndex, required this.selectedChoiceIndex,
required this.tts, required this.tts,
this.enableAudio = true,
this.isActive = true, this.isActive = true,
this.onLongPress, this.onLongPress,
this.id, this.id,
@ -87,8 +90,10 @@ class ChoicesArrayState extends State<ChoicesArray> {
? (String value, int index) { ? (String value, int index) {
widget.onPressed(value, index); widget.onPressed(value, index);
// TODO - what to pass here as eventID? // TODO - what to pass here as eventID?
if (widget.enableAudio && widget.tts != null) {
widget.tts?.tryToSpeak(value, context, null); widget.tts?.tryToSpeak(value, context, null);
} }
}
: (String value, int index) { : (String value, int index) {
debugger(when: kDebugMode); debugger(when: kDebugMode);
}, },

@ -66,7 +66,7 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
PangeaMessageEvent? get pangeaMessageEvent => widget._pangeaMessageEvent; PangeaMessageEvent? get pangeaMessageEvent => widget._pangeaMessageEvent;
bool _isPlayingAudio = false; bool isPlayingAudio = false;
bool get showToolbarButtons => bool get showToolbarButtons =>
pangeaMessageEvent != null && pangeaMessageEvent != null &&
@ -276,7 +276,7 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
MessageMode.practiceActivity, MessageMode.practiceActivity,
// MessageMode.textToSpeech // MessageMode.textToSpeech
].contains(toolbarMode) || ].contains(toolbarMode) ||
_isPlayingAudio) { isPlayingAudio) {
return; return;
} }
@ -360,7 +360,7 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
void setIsPlayingAudio(bool isPlaying) { void setIsPlayingAudio(bool isPlaying) {
if (mounted) { if (mounted) {
setState(() => _isPlayingAudio = isPlaying); setState(() => isPlayingAudio = isPlaying);
} }
} }

@ -214,6 +214,8 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
isActive: true, isActive: true,
id: currentRecordModel?.hashCode.toString(), id: currentRecordModel?.hashCode.toString(),
tts: practiceActivity.activityType.includeTTSOnClick ? tts : null, tts: practiceActivity.activityType.includeTTSOnClick ? tts : null,
enableAudio: !widget
.practiceCardController.widget.overlayController.isPlayingAudio,
), ),
], ],
); );

@ -6,7 +6,7 @@ description: Learn a language while texting your friends.
# Pangea# # Pangea#
publish_to: none publish_to: none
# On version bump also increase the build number for F-Droid # On version bump also increase the build number for F-Droid
version: 1.23.11+3570 version: 1.23.12+3571
environment: environment:
sdk: ">=3.0.0 <4.0.0" sdk: ">=3.0.0 <4.0.0"

Loading…
Cancel
Save