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

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

@ -214,6 +214,8 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
isActive: true,
id: currentRecordModel?.hashCode.toString(),
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#
publish_to: none
# On version bump also increase the build number for F-Droid
version: 1.23.11+3570
version: 1.23.12+3571
environment:
sdk: ">=3.0.0 <4.0.0"

Loading…
Cancel
Save