toolbar / popup updates
This commit is contained in:
parent
713bac400e
commit
423a3c3f72
4 changed files with 40 additions and 48 deletions
|
|
@ -3113,8 +3113,8 @@
|
|||
"almostPerfect": "That seems right! Here's what I would have said.",
|
||||
"prettyGood": "Pretty good! Here's what I would have said.",
|
||||
"letMeThink": "Hmm, let's see how you did!",
|
||||
"clickMessageTitle": "Select messages for language help!",
|
||||
"clickMessageBody": "Messages always show in your target language but you can select them to access definitions and translations!",
|
||||
"clickMessageTitle": "Need help?",
|
||||
"clickMessageBody": "Click messages to access definitions, translations, and audio!",
|
||||
"understandingMessagesTitle": "Definitions and translations!",
|
||||
"addToClass": "Add this chat to ",
|
||||
"understandingMessagesBody": "Click underlined words for definitions. Translate with message options (upper right).",
|
||||
|
|
|
|||
|
|
@ -3275,8 +3275,6 @@
|
|||
"almostPerfect": "¡Eso parece correcto! Esto es lo que yo hubiera dicho.",
|
||||
"prettyGood": "¡Bastante bien! Esto es lo que yo hubiera dicho.",
|
||||
"letMeThink": "Hmm, ¡vamos a ver cómo le fue!",
|
||||
"clickMessageTitle": "¡Seleccione mensajes para obtener ayuda con el idioma!",
|
||||
"clickMessageBody": "Los mensajes siempre se muestran en su idioma de destino, ¡pero puede seleccionarlos para acceder a definiciones y traducciones!",
|
||||
"understandingMessagesTitle": "¡Definiciones y traducciones!",
|
||||
"understandingMessagesBody": "Haga clic en las palabras subrayadas para ver las definiciones. Traduzca con 'opciones de mensajes' (arriba a la derecha).",
|
||||
"allDone": "¡Listo!",
|
||||
|
|
@ -4550,46 +4548,22 @@
|
|||
"showDefinition": "Mostrar definición",
|
||||
"acceptedKeyVerification": "{sender} verificación de clave aceptada",
|
||||
"@acceptedKeyVerification": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"canceledKeyVerification": "{sender} canceló la verificación de claves",
|
||||
"@canceledKeyVerification": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"completedKeyVerification": "{sender} verificación de claves completada",
|
||||
"@canceledKeyVerification": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"isReadyForKeyVerification": "{sender} está listo para la verificación de claves",
|
||||
"@canceledKeyVerification": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"requestedKeyVerification": "{sender} solicitó verificación de claves",
|
||||
"@canceledKeyVerification": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"startedKeyVerification": "{sender} ha iniciado la verificación de claves",
|
||||
"@canceledKeyVerification": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"subscriptionPopupTitle": "Esta frase podría tener un error gramatical...",
|
||||
"subscriptionPopupDesc": "Suscríbase hoy mismo para desbloquear la traducción y la corrección gramatical.",
|
||||
"seeOptions": "Ver opciones",
|
||||
|
|
@ -4599,5 +4573,7 @@
|
|||
"translation": "traducción",
|
||||
"audio": "mensaje de audio",
|
||||
"definitions": "definiciones",
|
||||
"subscribedToUnlockTools": "Suscríbase para desbloquear herramientas lingüísticas, como"
|
||||
"subscribedToUnlockTools": "Suscríbase para desbloquear herramientas lingüísticas, como",
|
||||
"clickMessageTitle": "¿Necesitas ayuda?",
|
||||
"clickMessageBody": "Haga clic en los mensajes para acceder a las definiciones, traducciones y audio."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ import 'package:fluffychat/pangea/models/pangea_message_event.dart';
|
|||
import 'package:fluffychat/pangea/models/student_analytics_summary_model.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/utils/firebase_analytics.dart';
|
||||
import 'package:fluffychat/pangea/utils/instructions.dart';
|
||||
import 'package:fluffychat/pangea/utils/report_message.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat/message_toolbar.dart';
|
||||
import 'package:fluffychat/pangea/widgets/igc/pangea_text_controller.dart';
|
||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||
import 'package:fluffychat/utils/error_reporter.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/filtered_timeline_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/app_lock.dart';
|
||||
|
|
@ -347,6 +349,17 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
loadTimelineFuture = _getTimeline();
|
||||
try {
|
||||
await loadTimelineFuture;
|
||||
// #Pangea
|
||||
if (timeline != null) {
|
||||
choreographer.pangeaController.instructions.show(
|
||||
context,
|
||||
InstructionsEnum.clickMessage,
|
||||
timeline!.events.firstWhereOrNull((e) => e.isVisibleInGui)?.eventId ??
|
||||
'',
|
||||
true,
|
||||
);
|
||||
}
|
||||
// Pangea#
|
||||
final fullyRead = room.fullyRead;
|
||||
if (fullyRead.isEmpty) return;
|
||||
if (timeline!.events.any((event) => event.eventId == fullyRead)) {
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class MessageToolbar extends StatefulWidget {
|
|||
class MessageToolbarState extends State<MessageToolbar> {
|
||||
Widget? child;
|
||||
MessageMode? currentMode;
|
||||
bool hasSelectedText = false;
|
||||
bool updatingMode = false;
|
||||
late StreamSubscription<String?> selectionStream;
|
||||
late StreamSubscription<MessageMode> toolbarModeStream;
|
||||
|
||||
|
|
@ -179,10 +179,14 @@ class MessageToolbarState extends State<MessageToolbar> {
|
|||
}
|
||||
|
||||
void updateMode(MessageMode newMode) {
|
||||
if (updatingMode) return;
|
||||
debugPrint("updating toolbar mode");
|
||||
final bool subscribed =
|
||||
MatrixState.pangeaController.subscriptionController.isSubscribed;
|
||||
setState(() => currentMode = newMode);
|
||||
setState(() {
|
||||
currentMode = newMode;
|
||||
updatingMode = true;
|
||||
});
|
||||
if (!subscribed) {
|
||||
child = MessageUnsubscribedCard(
|
||||
languageTool: getModeTitle(newMode),
|
||||
|
|
@ -202,7 +206,9 @@ class MessageToolbarState extends State<MessageToolbar> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
setState(() {
|
||||
updatingMode = false;
|
||||
});
|
||||
}
|
||||
|
||||
void showTranslation() {
|
||||
|
|
@ -250,20 +256,17 @@ class MessageToolbarState extends State<MessageToolbar> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.textSelection.selectedText != null) {
|
||||
hasSelectedText = true;
|
||||
}
|
||||
|
||||
toolbarModeStream = widget.toolbarModeStream.stream.listen((mode) {
|
||||
updateMode(mode);
|
||||
});
|
||||
|
||||
Timer? timer;
|
||||
updateMode(MessageMode.play);
|
||||
|
||||
Timer? timer;
|
||||
selectionStream =
|
||||
widget.textSelection.selectionStream.stream.listen((value) {
|
||||
timer?.cancel();
|
||||
timer = Timer(const Duration(milliseconds: 750), () {
|
||||
timer = Timer(const Duration(milliseconds: 500), () {
|
||||
if (currentMode != null || value != null && value.isNotEmpty) {
|
||||
updateMode(currentMode ?? MessageMode.translation);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue