add toggle for auto-playing messages in learning settings
This commit is contained in:
parent
64f57e0e48
commit
0880f6d120
6 changed files with 33 additions and 10 deletions
|
|
@ -3950,5 +3950,7 @@
|
|||
},
|
||||
"kickBotWarning": "Kicking Pangea Bot will remove the conversation bot from this chat.",
|
||||
"joinToView": "Join this room to view details",
|
||||
"refresh": "Refresh"
|
||||
"refresh": "Refresh",
|
||||
"autoPlayTitle": "Auto Play Messages",
|
||||
"autoPlayDesc": "When enabled, the text-to-speech audio of messages will play automatically when selected."
|
||||
}
|
||||
|
|
@ -4583,5 +4583,8 @@
|
|||
"selectToDefine": "Haga doble clic en una palabra para ver su definición.",
|
||||
"kickBotWarning": "Patear Pangea Bot eliminará el bot de conversación de este chat.",
|
||||
"activateTrial": "Activar prueba gratuita",
|
||||
"refresh": "Actualizar"
|
||||
"refresh": "Actualizar",
|
||||
"joinToView": "Únete a esta sala para ver los detalles",
|
||||
"autoPlayTitle": "Reproducción automática de mensajes",
|
||||
"autoPlayDesc": "Cuando está activado, el audio de texto a voz de los mensajes se reproducirá automáticamente cuando se seleccione."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ class PLocalKey {
|
|||
static const String activatedTrialKey = '7C4EuKIsph';
|
||||
static const String dismissedPaywall = 'dismissedPaywall';
|
||||
static const String paywallBackoff = 'paywallBackoff';
|
||||
static const String autoPlayMessages = 'autoPlayMessages';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/constants/local.key.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import 'package:fluffychat/pangea/pages/settings_learning/settings_learning.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
|
|
@ -10,6 +6,10 @@ import 'package:fluffychat/pangea/widgets/user_settings/country_picker_tile.dart
|
|||
import 'package:fluffychat/pangea/widgets/user_settings/language_tile.dart';
|
||||
import 'package:fluffychat/pangea/widgets/user_settings/p_settings_switch_list_tile.dart';
|
||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
|
||||
import '../../../config/app_config.dart';
|
||||
|
||||
class SettingsLearningView extends StatelessWidget {
|
||||
|
|
@ -60,6 +60,15 @@ class SettingsLearningView extends StatelessWidget {
|
|||
subtitle: setting.toolDescription(context),
|
||||
pStoreKey: setting.toString(),
|
||||
),
|
||||
PSettingsSwitchListTile.adaptive(
|
||||
defaultValue: controller.pangeaController.pStoreService.read(
|
||||
PLocalKey.autoPlayMessages,
|
||||
) ??
|
||||
true,
|
||||
title: L10n.of(context)!.autoPlayTitle,
|
||||
subtitle: L10n.of(context)!.autoPlayDesc,
|
||||
pStoreKey: PLocalKey.autoPlayMessages,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ class GetChatListItemSubtitle {
|
|||
);
|
||||
|
||||
while (index < timeline.events.length &&
|
||||
timeline.events[index].content.tryGet(ModelKey.transcription) !=
|
||||
null) {
|
||||
(timeline.events[index].content.tryGet(ModelKey.transcription) !=
|
||||
null ||
|
||||
timeline.events[index].type != EventTypes.Message)) {
|
||||
index++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/pages/chat/chat.dart';
|
||||
import 'package:fluffychat/pangea/constants/local.key.dart';
|
||||
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/utils/any_state_holder.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
|
|
@ -280,7 +281,13 @@ class MessageToolbarState extends State<MessageToolbar> {
|
|||
});
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
updateMode(MessageMode.play);
|
||||
final bool autoplay = MatrixState.pangeaController.pStoreService.read(
|
||||
PLocalKey.autoPlayMessages,
|
||||
) ??
|
||||
true;
|
||||
autoplay
|
||||
? updateMode(MessageMode.play)
|
||||
: updateMode(MessageMode.translation);
|
||||
});
|
||||
|
||||
Timer? timer;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue