commit
fa4cb10276
9 changed files with 54 additions and 44 deletions
|
|
@ -485,6 +485,14 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
Future<void>? setReadMarkerFuture;
|
||||
|
||||
void setReadMarker({String? eventId}) {
|
||||
// #Pangea
|
||||
if (eventId != null &&
|
||||
(eventId.contains("web") ||
|
||||
eventId.contains("android") ||
|
||||
eventId.contains("ios"))) {
|
||||
return;
|
||||
}
|
||||
// Pangea#
|
||||
if (setReadMarkerFuture != null) return;
|
||||
if (_scrolledUp) return;
|
||||
if (scrollUpBannerEventId != null) return;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ class NewSpaceController extends State<NewSpace> {
|
|||
await room.invite(BotName.byEnvironment);
|
||||
} catch (err) {
|
||||
ErrorHandler.logError(
|
||||
e: "Failed to invite pangea bot to space ${room.id}",
|
||||
e: "Failed to invite pangea bot to new space",
|
||||
data: {"spaceId": spaceId, "error": err},
|
||||
);
|
||||
}
|
||||
MatrixState.pangeaController.classController
|
||||
|
|
|
|||
|
|
@ -298,7 +298,8 @@ class PangeaController {
|
|||
await space.invite(BotName.byEnvironment);
|
||||
} catch (err) {
|
||||
ErrorHandler.logError(
|
||||
e: "Failed to invite pangea bot to space ${space.id}",
|
||||
e: "Failed to invite pangea bot to existing space",
|
||||
data: {"spaceId": space.id, "error": err},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,7 +210,9 @@ class MessageAudioCardState extends State<MessageAudioCard> {
|
|||
tts.missingVoiceButton,
|
||||
],
|
||||
)
|
||||
: const CardErrorWidget(),
|
||||
: const CardErrorWidget(
|
||||
error: "Null audio file in message_audio_card",
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class MessageTranslationCardState extends State<MessageTranslationCard> {
|
|||
if (!_fetchingTranslation &&
|
||||
repEvent == null &&
|
||||
selectionTranslation == null) {
|
||||
return const CardErrorWidget();
|
||||
return const CardErrorWidget(error: "No translation found");
|
||||
}
|
||||
|
||||
return Padding(
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class TtsController {
|
|||
|
||||
// return type is dynamic but apparent its supposed to be 1
|
||||
// https://pub.dev/packages/flutter_tts
|
||||
if (result != 1) {
|
||||
if (result != 1 && !kIsWeb) {
|
||||
ErrorHandler.logError(
|
||||
m: 'Unexpected result from tts.speak',
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:fluffychat/pangea/choreographer/controllers/choreographer.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_style.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat/message_toolbar.dart';
|
||||
import 'package:fluffychat/pangea/widgets/common/bot_face_svg.dart';
|
||||
import 'package:fluffychat/pangea/widgets/igc/card_header.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -21,30 +20,26 @@ class CardErrorWidget extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final ErrorCopy errorCopy = ErrorCopy(context, error);
|
||||
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: const BoxConstraints(minHeight: minCardHeight),
|
||||
alignment: Alignment.center,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
CardHeader(
|
||||
text: errorCopy.title,
|
||||
botExpression: BotExpression.addled,
|
||||
onClose: () => choreographer?.onMatchError(
|
||||
cursorOffset: offset,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
CardHeader(
|
||||
text: errorCopy.title,
|
||||
botExpression: BotExpression.addled,
|
||||
onClose: () => choreographer?.onMatchError(
|
||||
cursorOffset: offset,
|
||||
),
|
||||
const SizedBox(height: 10.0),
|
||||
Center(
|
||||
child: Text(
|
||||
errorCopy.body,
|
||||
style: BotStyle.text(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10.0),
|
||||
Center(
|
||||
child: Text(
|
||||
errorCopy.body,
|
||||
style: BotStyle.text(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import '../../../widgets/matrix.dart';
|
||||
import '../../utils/bot_style.dart';
|
||||
import '../common/bot_face_svg.dart';
|
||||
|
||||
class CardHeader extends StatelessWidget {
|
||||
|
|
@ -22,8 +22,6 @@ class CardHeader extends StatelessWidget {
|
|||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 5.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 3.0),
|
||||
|
|
@ -33,13 +31,12 @@ class CardHeader extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(width: 5.0),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: BotStyle.text(context),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
text,
|
||||
style: BotStyle.text(context),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
const SizedBox(width: 5.0),
|
||||
CircleAvatar(
|
||||
backgroundColor: AppConfig.primaryColor.withOpacity(0.1),
|
||||
child: IconButton(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import 'dart:developer';
|
|||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/enum/activity_type_enum.dart';
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_message_event.dart';
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/pangea_representation_event.dart';
|
||||
import 'package:fluffychat/pangea/matrix_event_wrappers/practice_activity_event.dart';
|
||||
import 'package:fluffychat/pangea/models/analytics/constructs_model.dart';
|
||||
import 'package:fluffychat/pangea/models/practice_activities.dart/message_activity_request.dart';
|
||||
|
|
@ -119,13 +118,25 @@ class MessagePracticeActivityCardState extends State<PracticeActivityCard> {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (widget.pangeaMessageEvent.originalSent == null) {
|
||||
debugger(when: kDebugMode);
|
||||
_updateFetchingActivity(false);
|
||||
ErrorHandler.logError(
|
||||
e: Exception('No original message found in _fetchNewActivity'),
|
||||
data: {
|
||||
'event': widget.pangeaMessageEvent.event.toJson(),
|
||||
},
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
final PracticeActivityModel? ourNewActivity = await pangeaController
|
||||
.practiceGenerationController
|
||||
.getPracticeActivity(
|
||||
MessageActivityRequest(
|
||||
userL1: pangeaController.languageController.userL1!.langCode,
|
||||
userL2: pangeaController.languageController.userL2!.langCode,
|
||||
messageText: representation!.text,
|
||||
messageText: widget.pangeaMessageEvent.originalSent!.text,
|
||||
tokensWithXP: await targetTokensController.targetTokens(
|
||||
context,
|
||||
widget.pangeaMessageEvent,
|
||||
|
|
@ -256,11 +267,6 @@ class MessagePracticeActivityCardState extends State<PracticeActivityCard> {
|
|||
});
|
||||
}
|
||||
|
||||
RepresentationEvent? get representation =>
|
||||
widget.pangeaMessageEvent.originalSent;
|
||||
|
||||
String get messsageText => representation!.text;
|
||||
|
||||
PangeaController get pangeaController => MatrixState.pangeaController;
|
||||
|
||||
/// The widget that displays the current activity.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue