Merge pull request #4813 from pangeachat/4808-translate-button-can-appear-for-l1-messages

chore: don't show translate button on L1 messages
This commit is contained in:
ggurdin 2025-12-05 12:44:15 -05:00 committed by GitHub
commit 58fc3b5daf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -97,14 +97,14 @@ class SelectModeController {
contentChangedStream.close();
}
static List<SelectMode> get textModes => [
static List<SelectMode> get _textModes => [
SelectMode.audio,
SelectMode.translate,
SelectMode.practice,
SelectMode.emoji,
];
static List<SelectMode> get audioModes => [
static List<SelectMode> get _audioModes => [
SelectMode.speechTranslation,
];
@ -128,13 +128,22 @@ class SelectModeController {
}
if (messageEvent.event.messageType == MessageTypes.Text) {
final matchesL2 = messageEvent.messageDisplayLangCode.split("-").first ==
final lang = messageEvent.messageDisplayLangCode.split("-").first;
final matchesL2 = lang ==
MatrixState.pangeaController.userController.userL2!.langCodeShort;
return matchesL2 ? textModes : [SelectMode.translate];
final matchesL1 = lang ==
MatrixState.pangeaController.userController.userL1!.langCodeShort;
return matchesL2
? _textModes
: matchesL1
? []
: [SelectMode.translate];
}
return audioModes;
return _audioModes;
}
bool get isLoading => currentModeStateNotifier?.value is AsyncLoading;