go straight to translation if message not in target language (#1176)
This commit is contained in:
parent
2840a7dcfd
commit
191607abcf
2 changed files with 6 additions and 6 deletions
|
|
@ -170,6 +170,10 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
|
|||
}
|
||||
}
|
||||
|
||||
bool get messageInUserL2 =>
|
||||
pangeaMessageEvent?.messageDisplayLangCode ==
|
||||
MatrixState.pangeaController.languageController.userL2?.langCode;
|
||||
|
||||
Future<void> _setInitialToolbarMode() async {
|
||||
if (widget._pangeaMessageEvent?.isAudioMessage ?? false) {
|
||||
toolbarMode = MessageMode.speechToText;
|
||||
|
|
@ -180,7 +184,7 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
|
|||
// 2) if the user selects a span on initialization, then we want to give
|
||||
// them a practice activity on that word
|
||||
// 3) if the user has activities left to complete, then we want to give them
|
||||
if (tokens != null && activitiesLeftToComplete > 0) {
|
||||
if (tokens != null && activitiesLeftToComplete > 0 && messageInUserL2) {
|
||||
return setState(() => toolbarMode = MessageMode.practiceActivity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,10 +51,6 @@ class MessageToolbar extends StatelessWidget {
|
|||
return const ToolbarContentLoadingIndicator();
|
||||
}
|
||||
|
||||
// Check if the message is in the user's second language
|
||||
final bool messageInUserL2 = pangeaMessageEvent.messageDisplayLangCode ==
|
||||
MatrixState.pangeaController.languageController.userL2?.langCode;
|
||||
|
||||
switch (overLayController.toolbarMode) {
|
||||
case MessageMode.translation:
|
||||
return MessageTranslationCard(
|
||||
|
|
@ -127,7 +123,7 @@ class MessageToolbar extends StatelessWidget {
|
|||
}
|
||||
case MessageMode.practiceActivity:
|
||||
// If not in the target language show specific messsage
|
||||
if (!messageInUserL2) {
|
||||
if (!overLayController.messageInUserL2) {
|
||||
return MessageDisplayCard(
|
||||
displayText: L10n.of(context)!
|
||||
.messageNotInTargetLang, // Pass the display text,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue