Merge branch 'main' into decouple-audio
This commit is contained in:
commit
e427524724
7 changed files with 172 additions and 29 deletions
|
|
@ -3932,5 +3932,10 @@
|
|||
"subscriptionPopupDesc": "Subscribe today to unlock translation and grammar correction!",
|
||||
"seeOptions": "See options",
|
||||
"continuedWithoutSubscription": "Continue without subscribing",
|
||||
"trialPeriodExpired": "Your trial period has expired"
|
||||
"trialPeriodExpired": "Your trial period has expired",
|
||||
"selectToDefine": "To define a word in this message, just select it!",
|
||||
"translation": "translation",
|
||||
"audio": "message audio",
|
||||
"definitions": "definitions",
|
||||
"subscribedToUnlockTools": "Subscribe to unlock language tools, including"
|
||||
}
|
||||
|
|
@ -4543,5 +4543,61 @@
|
|||
"conversationTopic": "Tema de conversación",
|
||||
"enableModeration": "Activar la moderación",
|
||||
"enableModerationDesc": "Activar la moderación automática para revisar los mensajes antes de enviarlos",
|
||||
"conversationLanguageLevel": "¿Cuál es el nivel lingüístico de esta conversación?"
|
||||
}
|
||||
"conversationLanguageLevel": "¿Cuál es el nivel lingüístico de esta conversación?",
|
||||
"errorGettingAudio": "Error al recibir audio. Por favor, actualice e inténtelo de nuevo.",
|
||||
"define": "Defina",
|
||||
"listen": "Listas",
|
||||
"showDefinition": "Mostrar definición",
|
||||
"acceptedKeyVerification": "{sender} verificación de clave aceptada",
|
||||
"@acceptedKeyVerification": {
|
||||
"type": "text",
|
||||
"placeholders": {
|
||||
"sender": {}
|
||||
}
|
||||
},
|
||||
"canceledKeyVerification": "{sender} canceló la verificación de claves",
|
||||
"@canceledKeyVerification": {
|
||||
"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",
|
||||
"continuedWithoutSubscription": "Continuar sin suscribirse",
|
||||
"trialPeriodExpired": "Su periodo de prueba ha expirado",
|
||||
"selectToDefine": "Para definir una palabra en este mensaje, ¡sólo tiene que seleccionarla!",
|
||||
"translation": "traducción",
|
||||
"audio": "mensaje de audio",
|
||||
"definitions": "definiciones",
|
||||
"subscribedToUnlockTools": "Suscríbase para desbloquear herramientas lingüísticas, como"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ import 'package:fluffychat/pangea/utils/overlay.dart';
|
|||
import 'package:fluffychat/pangea/widgets/chat/message_audio_card.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat/message_text_selection.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat/message_translation_card.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat/message_unsubscribed_card.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat/overlay_message.dart';
|
||||
import 'package:fluffychat/pangea/widgets/igc/word_data_card.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
enum MessageMode { translation, play, definition }
|
||||
|
|
@ -162,35 +164,43 @@ class MessageToolbarState extends State<MessageToolbar> {
|
|||
}
|
||||
}
|
||||
|
||||
bool enabledButton(MessageMode mode) {
|
||||
String getModeTitle(MessageMode mode) {
|
||||
switch (mode) {
|
||||
case MessageMode.translation:
|
||||
return true;
|
||||
return L10n.of(context)!.translation;
|
||||
case MessageMode.play:
|
||||
return true;
|
||||
return L10n.of(context)!.audio;
|
||||
case MessageMode.definition:
|
||||
return widget.textSelection.selectedText != null;
|
||||
// return true;
|
||||
return L10n.of(context)!.definitions;
|
||||
default:
|
||||
return false;
|
||||
return L10n.of(context)!
|
||||
.oopsSomethingWentWrong; // Title to indicate an error or unsupported mode
|
||||
}
|
||||
}
|
||||
|
||||
void updateMode(MessageMode newMode) {
|
||||
debugPrint("updating toolbar mode");
|
||||
final bool subscribed =
|
||||
MatrixState.pangeaController.subscriptionController.isSubscribed;
|
||||
setState(() => currentMode = newMode);
|
||||
switch (currentMode) {
|
||||
case MessageMode.translation:
|
||||
showTranslation();
|
||||
break;
|
||||
case MessageMode.play:
|
||||
playAudio();
|
||||
break;
|
||||
case MessageMode.definition:
|
||||
showDefinition();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (!subscribed) {
|
||||
child = MessageUnsubscribedCard(
|
||||
languageTool: getModeTitle(newMode),
|
||||
);
|
||||
} else {
|
||||
switch (currentMode) {
|
||||
case MessageMode.translation:
|
||||
showTranslation();
|
||||
break;
|
||||
case MessageMode.play:
|
||||
playAudio();
|
||||
break;
|
||||
case MessageMode.definition:
|
||||
showDefinition();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
|
@ -214,6 +224,7 @@ class MessageToolbarState extends State<MessageToolbar> {
|
|||
void showDefinition() {
|
||||
if (widget.textSelection.selectedText == null ||
|
||||
widget.textSelection.selectedText!.isEmpty) {
|
||||
child = const SelectToDefine();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -312,8 +323,7 @@ class MessageToolbarState extends State<MessageToolbar> {
|
|||
color: currentMode == mode
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: null,
|
||||
onPressed:
|
||||
enabledButton(mode) ? () => updateMode(mode) : null,
|
||||
onPressed: () => updateMode(mode),
|
||||
);
|
||||
}).toList() +
|
||||
[
|
||||
|
|
|
|||
47
lib/pangea/widgets/chat/message_unsubscribed_card.dart
Normal file
47
lib/pangea/widgets/chat/message_unsubscribed_card.dart
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_style.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
class MessageUnsubscribedCard extends StatelessWidget {
|
||||
final String languageTool;
|
||||
|
||||
const MessageUnsubscribedCard({
|
||||
super.key,
|
||||
required this.languageTool,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
style: BotStyle.text(context),
|
||||
"${L10n.of(context)!.subscribedToUnlockTools} $languageTool",
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
MatrixState.pangeaController.subscriptionController
|
||||
.showPaywall(context);
|
||||
MatrixState.pAnyState.closeOverlay();
|
||||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all<Color>(
|
||||
(AppConfig.primaryColor).withOpacity(0.1),
|
||||
),
|
||||
),
|
||||
child: Text(L10n.of(context)!.getAccess),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -381,3 +381,20 @@ class PartOfSpeechBlock extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SelectToDefine extends StatelessWidget {
|
||||
const SelectToDefine({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(
|
||||
L10n.of(context)!.selectToDefine,
|
||||
style: BotStyle.text(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
pubspec.lock
11
pubspec.lock
|
|
@ -1375,11 +1375,12 @@ packages:
|
|||
matrix:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: matrix
|
||||
sha256: "187390203f6a5a7370490b7036f2defc306fda240f8d744191d406692c128469"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.25.8"
|
||||
path: "."
|
||||
ref: "ggurdin/indexeddb-clear-fix"
|
||||
resolved-ref: e9abfd041283595d38134410abeba71b6cf978f8
|
||||
url: "https://github.com/ggurdin/matrix-dart-sdk.git"
|
||||
source: git
|
||||
version: "0.25.9"
|
||||
matrix_api_lite:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -69,7 +69,14 @@ dependencies:
|
|||
keyboard_shortcuts: ^0.1.4
|
||||
latlong2: ^0.8.1
|
||||
linkify: ^5.0.0
|
||||
matrix: ^0.25.8
|
||||
# #Pangea
|
||||
# matrix: ^0.25.7
|
||||
matrix:
|
||||
git:
|
||||
url: https://github.com/ggurdin/matrix-dart-sdk.git
|
||||
ref: ggurdin/indexeddb-clear-fix
|
||||
# until https://github.com/famedly/matrix-dart-sdk/pull/1712
|
||||
# Pangea#
|
||||
native_imaging: ^0.1.0
|
||||
package_info_plus: ^4.0.0
|
||||
pasteboard: ^0.2.0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue