Merge pull request #57 from pangeachat/toolbar

Toolbar
This commit is contained in:
ggurdin 2024-02-10 10:57:04 -05:00 committed by GitHub
commit 6af9a7540d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 2290 additions and 843 deletions

View file

@ -1,11 +1,4 @@
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
"search.exclude": {
"**/.fvm": true
},
"files.watcherExclude": {
"**/.fvm": true
},
"dart.previewLsp": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",

View file

@ -3795,6 +3795,7 @@
"successfullySubscribed": "You have successfully subscribed!",
"clickToManageSubscription": "Click here to manage your subscription.",
"emptyInviteWarning": "Add this chat to a class or exchange to invite other users.",
"errorGettingAudio": "Error getting audio. Please refresh and try again.",
"nothingFound": "Nothing found...",
"groupName": "Group name",
"createGroupAndInviteUsers": "Create a group and invite users",
@ -3873,6 +3874,8 @@
"type": "text",
"placeholders": {}
},
"define": "Define",
"listen": "Listen",
"addConversationBot": "Enable Conversation Bot",
"addConversationBotDesc": "Add a bot to this group chat that will ask questions on a specific topic",
"convoBotSettingsTitle": "Conversation Bot Settings",

View file

@ -1,12 +1,4 @@
import 'package:flutter/material.dart';
import 'package:collection/collection.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:get_storage/get_storage.dart';
import 'package:matrix/matrix.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/config/environment.dart';
import 'package:fluffychat/pangea/controllers/language_list_controller.dart';
@ -15,6 +7,13 @@ import 'package:fluffychat/pangea/utils/firebase_analytics.dart';
import 'package:fluffychat/utils/client_manager.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/error_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:get_storage/get_storage.dart';
import 'package:matrix/matrix.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'config/setting_keys.dart';
import 'utils/background_push.dart';
import 'widgets/fluffy_chat_app.dart';

View file

@ -3,7 +3,7 @@ import 'dart:developer';
import 'dart:io';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:desktop_drop/desktop_drop.dart';
import 'package:collection/collection.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:file_picker/file_picker.dart';
@ -20,10 +20,12 @@ import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
import 'package:fluffychat/pangea/models/choreo_record.dart';
import 'package:fluffychat/pangea/models/class_model.dart';
import 'package:fluffychat/pangea/models/message_data_models.dart';
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/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';
@ -144,45 +146,45 @@ class ChatController extends State<ChatPageWithRoom>
Timer? typingCoolDown;
Timer? typingTimeout;
bool currentlyTyping = false;
bool dragging = false;
// #Pangea
// bool dragging = false;
void onDragEntered(_) => setState(() => dragging = true);
// void onDragEntered(_) => setState(() => dragging = true);
void onDragExited(_) => setState(() => dragging = false);
// void onDragExited(_) => setState(() => dragging = false);
void onDragDone(DropDoneDetails details) async {
setState(() => dragging = false);
final bytesList = await showFutureLoadingDialog(
context: context,
future: () => Future.wait(
details.files.map(
(xfile) => xfile.readAsBytes(),
),
),
);
if (bytesList.error != null) return;
// void onDragDone(DropDoneDetails details) async {
// setState(() => dragging = false);
// final bytesList = await showFutureLoadingDialog(
// context: context,
// future: () => Future.wait(
// details.files.map(
// (xfile) => xfile.readAsBytes(),
// ),
// ),
// );
// if (bytesList.error != null) return;
final matrixFiles = <MatrixFile>[];
for (var i = 0; i < bytesList.result!.length; i++) {
matrixFiles.add(
MatrixFile(
bytes: bytesList.result![i],
name: details.files[i].name,
).detectFileType,
);
}
// #Pangea
if (matrixFiles.isEmpty) return;
// Pangea#
// final matrixFiles = <MatrixFile>[];
// for (var i = 0; i < bytesList.result!.length; i++) {
// matrixFiles.add(
// MatrixFile(
// bytes: bytesList.result![i],
// name: details.files[i].name,
// ).detectFileType,
// );
// }
// if (matrixFiles.isEmpty) return;
await showAdaptiveDialog(
context: context,
builder: (c) => SendFileDialog(
files: matrixFiles,
room: room,
),
);
}
// await showAdaptiveDialog(
// context: context,
// builder: (c) => SendFileDialog(
// files: matrixFiles,
// room: room,
// ),
// );
// }
// Pangea#
bool get canSaveSelectedEvent =>
selectedEvents.length == 1 &&
@ -1277,10 +1279,11 @@ class ChatController extends State<ChatPageWithRoom>
}
void onSelectMessage(Event event) {
// #Pangea
// #Pangea
if (choreographer.itController.isOpen) {
return;
}
// Pangea#
if (!event.redacted) {
if (selectedEvents.contains(event)) {
@ -1541,7 +1544,55 @@ class ChatController extends State<ChatPageWithRoom>
lastState = currentState;
return currentState;
}
// #Pangea
final Map<String, PangeaMessageEvent> _pangeaMessageEvents = {};
final Map<String, ToolbarDisplayController> _toolbarDisplayControllers = {};
void setPangeaMessageEvent(String eventId) {
final Event? event = timeline!.events.firstWhereOrNull(
(e) => e.eventId == eventId,
);
if (event == null || timeline == null) return;
_pangeaMessageEvents[eventId] = PangeaMessageEvent(
event: event,
timeline: timeline!,
ownMessage: event.senderId == room.client.userID,
);
_pangeaMessageEvents[eventId]!.setDisplayRepresentation(context);
}
void setToolbarDisplayController(String eventId) {
final Event? event = timeline!.events.firstWhereOrNull(
(e) => e.eventId == eventId,
);
if (event == null || timeline == null) return;
if (_pangeaMessageEvents[eventId] == null) {
setPangeaMessageEvent(eventId);
if (_pangeaMessageEvents[eventId] == null) return;
}
_toolbarDisplayControllers[eventId] = ToolbarDisplayController(
targetId: event.eventId,
pangeaMessageEvent: _pangeaMessageEvents[eventId]!,
immersionMode: choreographer.immersionMode,
controller: this,
);
_toolbarDisplayControllers[eventId]!.setToolbar();
}
PangeaMessageEvent? getPangeaMessageEvent(String eventId) {
if (_pangeaMessageEvents[eventId] == null) {
setPangeaMessageEvent(eventId);
}
return _pangeaMessageEvents[eventId];
}
ToolbarDisplayController? getToolbarDisplayController(String eventId) {
if (_toolbarDisplayControllers[eventId] == null) {
setToolbarDisplayController(eventId);
}
return _toolbarDisplayControllers[eventId];
}
// Pangea#
@override
Widget build(BuildContext context) => ChatView(this);

View file

@ -27,6 +27,7 @@ class ChatEventList extends StatelessWidget {
final events = controller.timeline!.events
.where((event) => event.isVisibleInGui)
.toList();
final animateInEventIndex = controller.animateInEventIndex;
// create a map of eventId --> index to greatly improve performance of
@ -148,11 +149,12 @@ class ChatEventList extends StatelessWidget {
scrollToEventId: (String eventId) =>
controller.scrollToEventId(eventId),
// #Pangea
// longPressSelect: controller.selectedEvents.isEmpty,
longPressSelect: controller.selectedEvents.isNotEmpty,
selectedDisplayLang:
controller.choreographer.messageOptions.selectedDisplayLang,
immersionMode: controller.choreographer.immersionMode,
definitions: controller.choreographer.definitionsEnabled,
controller: controller,
// Pangea#
selected: controller.selectedEvents
.any((e) => e.eventId == event.eventId),

View file

@ -2,6 +2,7 @@ import 'package:animations/animations.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/choreographer/widgets/it_bar.dart';
import 'package:fluffychat/pangea/choreographer/widgets/send_button.dart';
import 'package:fluffychat/pangea/widgets/chat/message_actions.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/matrix.dart';

View file

@ -1,5 +1,4 @@
import 'package:badges/badges.dart';
import 'package:desktop_drop/desktop_drop.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/chat/chat.dart';
@ -36,9 +35,6 @@ class ChatView extends StatelessWidget {
List<Widget> _appBarActions(BuildContext context) {
if (controller.selectMode) {
return [
// #Pangea
LanguageDisplayToggle(controller: controller),
// Pangea#
if (controller.canEditSelectedEvents)
IconButton(
icon: const Icon(Icons.edit_outlined),
@ -229,199 +225,199 @@ class ChatView extends StatelessWidget {
: null)
// #Pangea
: null,
body: DropTarget(
onDragDone: controller.onDragDone,
onDragEntered: controller.onDragEntered,
onDragExited: controller.onDragExited,
child: Stack(
children: <Widget>[
SafeArea(
child: Column(
children: <Widget>[
TombstoneDisplay(controller),
if (scrollUpBannerEventId != null)
Material(
color: Theme.of(context)
.colorScheme
.surfaceVariant,
shape: Border(
bottom: BorderSide(
width: 1,
color: Theme.of(context).dividerColor,
),
),
child: ListTile(
leading: IconButton(
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
icon: const Icon(Icons.close),
tooltip: L10n.of(context)!.close,
onPressed: () {
controller
.discardScrollUpBannerEventId();
controller.setReadMarker();
},
),
title: Text(
L10n.of(context)!.jumpToLastReadMessage,
),
contentPadding:
const EdgeInsets.only(left: 8),
trailing: TextButton(
onPressed: () {
controller.scrollToEventId(
scrollUpBannerEventId,
);
controller
.discardScrollUpBannerEventId();
},
child: Text(L10n.of(context)!.jump),
),
body:
// #Pangea
// DropTarget(
// onDragDone: controller.onDragDone,
// onDragEntered: controller.onDragEntered,
// onDragExited: controller.onDragExited,
// child:
// Pangea#
Stack(
children: <Widget>[
SafeArea(
child: Column(
children: <Widget>[
TombstoneDisplay(controller),
if (scrollUpBannerEventId != null)
Material(
color: Theme.of(context)
.colorScheme
.surfaceVariant,
shape: Border(
bottom: BorderSide(
width: 1,
color: Theme.of(context).dividerColor,
),
),
PinnedEvents(controller),
Expanded(
child: GestureDetector(
onTap: controller.clearSingleSelectedEvent,
child: Builder(
builder: (context) {
if (controller.timeline == null) {
return const Center(
child: CircularProgressIndicator
.adaptive(
strokeWidth: 2,
),
);
}
return ChatEventList(
controller: controller,
);
child: ListTile(
leading: IconButton(
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
icon: const Icon(Icons.close),
tooltip: L10n.of(context)!.close,
onPressed: () {
controller.discardScrollUpBannerEventId();
controller.setReadMarker();
},
),
title: Text(
L10n.of(context)!.jumpToLastReadMessage,
),
contentPadding:
const EdgeInsets.only(left: 8),
trailing: TextButton(
onPressed: () {
controller.scrollToEventId(
scrollUpBannerEventId,
);
controller.discardScrollUpBannerEventId();
},
child: Text(L10n.of(context)!.jump),
),
),
),
if (controller.room.canSendDefaultMessages &&
controller.room.membership == Membership.join)
// #Pangea
// Container(
ConditionalFlexible(
PinnedEvents(controller),
Expanded(
child: GestureDetector(
onTap: controller.clearSingleSelectedEvent,
child: Builder(
builder: (context) {
if (controller.timeline == null) {
return const Center(
child:
CircularProgressIndicator.adaptive(
strokeWidth: 2,
),
);
}
return ChatEventList(
controller: controller,
);
},
),
),
),
if (controller.room.canSendDefaultMessages &&
controller.room.membership == Membership.join)
// #Pangea
// Container(
ConditionalFlexible(
isScroll: controller.isRowScrollable,
child: ConditionalScroll(
isScroll: controller.isRowScrollable,
child: ConditionalScroll(
isScroll: controller.isRowScrollable,
child: MeasurableWidget(
onChange: (size, position) {
controller.inputRowSize = size!.height;
},
child: Container(
// Pangea#
margin: EdgeInsets.only(
bottom: bottomSheetPadding,
left: bottomSheetPadding,
right: bottomSheetPadding,
),
constraints: const BoxConstraints(
maxWidth:
FluffyThemes.columnWidth * 2.5,
),
alignment: Alignment.center,
child: Material(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(
AppConfig.borderRadius,
),
bottomRight: Radius.circular(
AppConfig.borderRadius,
),
child: MeasurableWidget(
onChange: (size, position) {
controller.inputRowSize = size!.height;
},
child: Container(
// Pangea#
margin: EdgeInsets.only(
bottom: bottomSheetPadding,
left: bottomSheetPadding,
right: bottomSheetPadding,
),
constraints: const BoxConstraints(
maxWidth:
FluffyThemes.columnWidth * 2.5,
),
alignment: Alignment.center,
child: Material(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(
AppConfig.borderRadius,
),
bottomRight: Radius.circular(
AppConfig.borderRadius,
),
elevation: 4,
shadowColor:
Colors.black.withAlpha(64),
clipBehavior: Clip.hardEdge,
color: Theme.of(context).brightness ==
Brightness.light
? Colors.white
: Colors.black,
child: controller
.room.isAbandonedDMRoom ==
true
? Row(
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
TextButton.icon(
style:
TextButton.styleFrom(
padding:
const EdgeInsets
.all(16),
foregroundColor:
Theme.of(context)
.colorScheme
.error,
),
icon: const Icon(
Icons.archive_outlined,
),
onPressed:
controller.leaveChat,
label: Text(
L10n.of(context)!.leave,
),
),
TextButton.icon(
style:
TextButton.styleFrom(
padding:
const EdgeInsets
.all(16),
),
icon: const Icon(
Icons.forum_outlined,
),
onPressed: controller
.recreateChat,
label: Text(
L10n.of(context)!
.reopenChat,
),
),
],
)
: Column(
mainAxisSize:
MainAxisSize.min,
children: [
const ConnectionStatusHeader(),
ReactionsPicker(controller),
ReplyDisplay(controller),
ChatInputRow(controller),
ChatEmojiPicker(controller),
],
),
),
elevation: 4,
shadowColor: Colors.black.withAlpha(64),
clipBehavior: Clip.hardEdge,
color: Theme.of(context).brightness ==
Brightness.light
? Colors.white
: Colors.black,
child: controller
.room.isAbandonedDMRoom ==
true
? Row(
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
TextButton.icon(
style: TextButton.styleFrom(
padding:
const EdgeInsets.all(
16),
foregroundColor:
Theme.of(context)
.colorScheme
.error,
),
icon: const Icon(
Icons.archive_outlined,
),
onPressed:
controller.leaveChat,
label: Text(
L10n.of(context)!.leave,
),
),
TextButton.icon(
style: TextButton.styleFrom(
padding:
const EdgeInsets.all(
16),
),
icon: const Icon(
Icons.forum_outlined,
),
onPressed:
controller.recreateChat,
label: Text(
L10n.of(context)!
.reopenChat,
),
),
],
)
: Column(
mainAxisSize: MainAxisSize.min,
children: [
const ConnectionStatusHeader(),
ReactionsPicker(controller),
ReplyDisplay(controller),
ChatInputRow(controller),
ChatEmojiPicker(controller),
],
),
),
),
),
),
if (controller.dragging)
Container(
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.9),
alignment: Alignment.center,
child: const Icon(
Icons.upload_outlined,
size: 100,
),
),
],
),
),
// #Pangea
// if (controller.dragging)
// Container(
// color: Theme.of(context)
// .scaffoldBackgroundColor
// .withOpacity(0.9),
// alignment: Alignment.center,
// child: const Icon(
// Icons.upload_outlined,
// size: 100,
// ),
// ),
// Pangea#
],
),
],
),
),
],
),
// ),
);
},
),
@ -462,4 +458,4 @@ class ConditionalScroll extends StatelessWidget {
return child;
}
}
// #Pangea
// #Pangea

View file

@ -1,15 +1,16 @@
import 'dart:async';
import 'dart:developer';
import 'dart:io';
import 'package:fluffychat/pangea/controllers/text_to_speech_controller.dart';
import 'package:fluffychat/utils/error_reporter.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:just_audio/just_audio.dart';
import 'package:matrix/matrix.dart';
import 'package:path_provider/path_provider.dart';
import 'package:fluffychat/utils/error_reporter.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart';
import '../../../utils/matrix_sdk_extensions/event_extension.dart';
class AudioPlayerWidget extends StatefulWidget {
@ -80,6 +81,9 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
});
_playAction();
} catch (e, s) {
// #Pangea
debugger();
// Pangea#
Logs().v('Could not download audio file', e, s);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
@ -132,7 +136,30 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
if (audioFile != null) {
audioPlayer.setFilePath(audioFile.path);
} else {
await audioPlayer.setAudioSource(MatrixFileAudioSource(matrixFile!));
// #Pangea
final data = matrixFile!.bytes;
final mimeType = matrixFile!.mimeType;
//shouldn't have to be settting this here
//TODO: figure out why this is necessary
matrixFile = MatrixAudioFile(
bytes: matrixFile!.bytes,
name: matrixFile!.name,
mimeType: "audio/ogg",
);
debugPrint("audioType is $mimeType");
if (!TextToSpeechController.isOggFile(matrixFile!.bytes)) {
debugger(when: kDebugMode);
} else {
debugPrint("still an ogg file!");
}
try {
// Pangea#
await audioPlayer.setAudioSource(MatrixFileAudioSource(matrixFile!));
// #Pangea
} catch (e, s) {
debugger(when: kDebugMode);
}
// Pangea#
}
audioPlayer.play().onError(
ErrorReporter(context, 'Unable to play audio message')

View file

@ -1,10 +1,8 @@
import 'package:collection/collection.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/utils/show_defintion_util.dart';
import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/mxc_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_highlighter/flutter_highlighter.dart';
import 'package:flutter_highlighter/themes/shades-of-purple.dart';
import 'package:flutter_html/flutter_html.dart';
@ -20,18 +18,12 @@ class HtmlMessage extends StatelessWidget {
final String html;
final Room room;
final Color textColor;
// #Pangea
final ShowDefintionUtil? messageToolbar;
// Pangea#
const HtmlMessage({
super.key,
required this.html,
required this.room,
this.textColor = Colors.black,
// #Pangea
this.messageToolbar,
// Pangea#
});
dom.Node _linkifyHtml(dom.Node element) {
@ -101,20 +93,20 @@ class HtmlMessage extends StatelessWidget {
// there is no need to pre-validate the html, as we validate it while rendering
// #Pangea
return MouseRegion(
onHover: messageToolbar?.onMouseRegionUpdate,
// onHover: messageToolbar?.onMouseRegionUpdate,
child: SelectionArea(
onSelectionChanged: (SelectedContent? selection) =>
messageToolbar?.onTextSelection(
selectedContent: selection,
context: context,
),
focusNode: messageToolbar?.focusNode,
contextMenuBuilder: (context, state) =>
messageToolbar?.contextMenuOverride(
context: context,
contentSelection: state,
) ??
const SizedBox(),
// onSelectionChanged: (SelectedContent? selection) =>
// messageToolbar?.onTextSelection(
// selectedContent: selection,
// context: context,
// ),
// focusNode: messageToolbar?.focusNode,
// contextMenuBuilder: (context, state) =>
// messageToolbar?.contextMenuOverride(
// context: context,
// contentSelection: state,
// ) ??
// const SizedBox(),
// Pangea#
child: Html.fromElement(
documentElement: element as dom.Element,

View file

@ -1,18 +1,19 @@
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/pangea/enum/use_type.dart';
import 'package:fluffychat/pangea/models/language_model.dart';
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
import 'package:fluffychat/pangea/widgets/chat/message_toolbar.dart';
import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/utils/string_color.dart';
import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/hover_builder.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:swipe_to_action/swipe_to_action.dart';
import 'package:vibration/vibration.dart';
import '../../../config/app_config.dart';
import 'message_content.dart';
@ -40,6 +41,7 @@ class Message extends StatelessWidget {
final LanguageModel? selectedDisplayLang;
final bool immersionMode;
final bool definitions;
final ChatController controller;
// Pangea#
const Message(
@ -61,6 +63,7 @@ class Message extends StatelessWidget {
required this.selectedDisplayLang,
required this.immersionMode,
required this.definitions,
required this.controller,
// Pangea#
super.key,
});
@ -138,12 +141,10 @@ class Message extends StatelessWidget {
}
// #Pangea
final pangeaMessageEvent = PangeaMessageEvent(
event: event,
timeline: timeline,
ownMessage: ownMessage,
selected: selected,
);
final PangeaMessageEvent? pangeaMessageEvent =
controller.getPangeaMessageEvent(event.eventId);
final ToolbarDisplayController? toolbarController =
controller.getToolbarDisplayController(event.eventId);
// Pangea#
final resetAnimateIn = this.resetAnimateIn;
@ -241,18 +242,16 @@ class Message extends StatelessWidget {
alignment: alignment,
padding: const EdgeInsets.only(left: 8),
child: GestureDetector(
// #Pangea
onTap: () => toolbarController?.showToolbar(context),
onDoubleTap: () =>
toolbarController?.showToolbar(context),
// Pangea#
onLongPress: longPressSelect
? null
: () {
onSelect(event);
// Android usually has a vibration effect on long press:
if (PlatformInfos.isAndroid) {
Vibration.hasVibrator().then((has) {
if (has == true) {
Vibration.vibrate(duration: 50);
}
});
}
HapticFeedback.selectionClick();
},
child: AnimatedOpacity(
opacity: animateIn
@ -350,9 +349,8 @@ class Message extends StatelessWidget {
// #Pangea
selected: selected,
pangeaMessageEvent: pangeaMessageEvent,
selectedDisplayLang: selectedDisplayLang,
immersionMode: immersionMode,
definitions: definitions,
toolbarController: toolbarController,
// Pangea#
),
if (event.hasAggregatedEvents(
@ -360,7 +358,8 @@ class Message extends StatelessWidget {
RelationshipTypes.edit,
) // #Pangea
||
(pangeaMessageEvent.showUseType)
(pangeaMessageEvent?.showUseType ??
false)
// Pangea#
)
Padding(
@ -372,8 +371,9 @@ class Message extends StatelessWidget {
children: [
// #Pangea
if (pangeaMessageEvent
.showUseType) ...[
pangeaMessageEvent.useType
?.showUseType ??
false) ...[
pangeaMessageEvent!.useType
.iconView(
context,
textColor.withAlpha(164),

View file

@ -1,14 +1,13 @@
import 'package:fluffychat/pages/chat/events/html_message.dart';
import 'package:fluffychat/pages/chat/events/video_player.dart';
import 'package:fluffychat/pangea/models/language_model.dart';
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
import 'package:fluffychat/pangea/utils/show_defintion_util.dart';
import 'package:fluffychat/pangea/widgets/chat/message_context_menu.dart';
import 'package:fluffychat/pangea/widgets/chat/message_toolbar.dart';
import 'package:fluffychat/pangea/widgets/igc/pangea_rich_text.dart';
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
@ -31,27 +30,24 @@ class MessageContent extends StatelessWidget {
final BorderRadius borderRadius;
// #Pangea
final bool selected;
final PangeaMessageEvent pangeaMessageEvent;
final PangeaMessageEvent? pangeaMessageEvent;
//question: are there any performance benefits to using booleans
//here rather than passing the choreographer? pangea rich text, a widget
//further down in the chain is also using pangeaController so its not constant
final LanguageModel? selectedDisplayLang;
final bool immersionMode;
final bool definitions;
ShowDefintionUtil? messageToolbar;
final ToolbarDisplayController? toolbarController;
// Pangea#
MessageContent(
const MessageContent(
this.event, {
this.onInfoTab,
super.key,
required this.textColor,
// #Pangea
required this.selected,
required this.pangeaMessageEvent,
required this.selectedDisplayLang,
this.pangeaMessageEvent,
required this.immersionMode,
required this.definitions,
required this.toolbarController,
// Pangea#
required this.borderRadius,
});
@ -124,18 +120,6 @@ class MessageContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
// #Pangea
messageToolbar = ShowDefintionUtil(
targetId: pangeaMessageEvent.eventId,
room: pangeaMessageEvent.room,
langCode: selectedDisplayLang?.langCode ??
MatrixState.pangeaController.languageController.activeL2Code(
roomID: pangeaMessageEvent.room.id,
) ??
LanguageModel.unknown.langCode,
messageText: "",
);
// Pangea#
final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor;
final buttonTextColor = textColor;
switch (event.type) {
@ -186,21 +170,17 @@ class MessageContent extends StatelessWidget {
event.isRichMessage
// #Pangea
&&
!pangeaMessageEvent.showRichText
!(pangeaMessageEvent?.showRichText(selected) ?? false)
// Pangea#
) {
var html = event.formattedText;
if (event.messageType == MessageTypes.Emote) {
html = '* $html';
}
// #Pangea
messageToolbar?.messageText = html;
// Pangea#
return HtmlMessage(
html: html,
textColor: textColor,
room: event.room,
messageToolbar: messageToolbar,
);
}
// else we fall through to the normal message rendering
@ -286,84 +266,95 @@ class MessageContent extends StatelessWidget {
decoration: event.redacted ? TextDecoration.lineThrough : null,
height: 1.3,
);
if (pangeaMessageEvent.showRichText) {
return MouseRegion(
onHover: messageToolbar?.onMouseRegionUpdate,
child: PangeaRichText(
style: messageTextStyle,
selected: selected,
pangeaMessageEvent: pangeaMessageEvent,
immersionMode: immersionMode,
definitions: definitions,
selectedDisplayLang: selectedDisplayLang,
messageToolbar: messageToolbar,
),
if (pangeaMessageEvent?.showRichText(selected) ?? false) {
return PangeaRichText(
style: messageTextStyle,
pangeaMessageEvent: pangeaMessageEvent!,
immersionMode: immersionMode,
toolbarController: toolbarController!,
);
}
return MouseRegion(
onHover: messageToolbar?.onMouseRegionUpdate,
child: FutureBuilder<String>(
// Pangea#
future: event.calcLocalizedBody(
MatrixLocals(L10n.of(context)!),
hideReply: true,
),
builder: (context, snapshot) {
// #Pangea
if (!snapshot.hasData) {
return Text(
event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
hideReply: true,
),
style: messageTextStyle,
);
}
// return Linkify(
final String messageText = snapshot.data ??
event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
hideReply: true,
);
messageToolbar?.messageText = messageText;
return SelectableLinkify(
// Pangea#
text: messageText,
focusNode: messageToolbar?.focusNode,
contextMenuBuilder: (context, state) =>
messageToolbar?.contextMenuOverride(
context: context,
textSelection: state,
) ??
const SizedBox(),
// text: snapshot.data ??
// event.calcLocalizedBodyFallback(
// MatrixLocals(L10n.of(context)!),
// hideReply: true,
// ),
style: TextStyle(
color: textColor,
fontSize: bigEmotes ? fontSize * 3 : fontSize,
decoration:
event.redacted ? TextDecoration.lineThrough : null,
),
options: const LinkifyOptions(humanize: false),
linkStyle: TextStyle(
color: textColor.withAlpha(150),
fontSize: bigEmotes ? fontSize * 3 : fontSize,
decoration: TextDecoration.underline,
decorationColor: textColor.withAlpha(150),
),
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
onSelectionChanged: (selection, cause) =>
messageToolbar?.onTextSelection(
selectedText: selection,
cause: cause,
context: context,
),
);
},
// Pangea#
return FutureBuilder<String>(
future: event.calcLocalizedBody(
MatrixLocals(L10n.of(context)!),
hideReply: true,
),
builder: (context, snapshot) {
// #Pangea
if (!snapshot.hasData) {
return Text(
// Pangea#
event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
hideReply: true,
),
// #Pangea
style: messageTextStyle,
);
}
// return Linkify(
final String messageText = snapshot.data ??
event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
hideReply: true,
);
toolbarController?.toolbar?.textSelection.setMessageText(
messageText,
);
return SelectableLinkify(
onSelectionChanged: (selection, cause) {
if (cause == SelectionChangedCause.longPress &&
toolbarController != null &&
pangeaMessageEvent != null &&
!(toolbarController!.highlighted)) {
toolbarController!.controller.onSelectMessage(
pangeaMessageEvent!.event,
);
return;
}
toolbarController?.toolbar?.textSelection
.onTextSelection(selection);
},
onTap: () => toolbarController?.showToolbar(context),
text: toolbarController?.toolbar?.textSelection.messageText ??
messageText,
focusNode: toolbarController?.focusNode,
contextMenuBuilder: (context, state) =>
MessageContextMenu.contextMenuOverride(
context: context,
textSelection: state,
onDefine: () => toolbarController?.showToolbar(
context,
mode: MessageMode.definition,
),
onListen: () => toolbarController?.showToolbar(
context,
mode: MessageMode.play,
),
),
// text: snapshot.data ??
// event.calcLocalizedBodyFallback(
// MatrixLocals(L10n.of(context)!),
// hideReply: true,
// ),
// Pangea#
style: TextStyle(
color: textColor,
fontSize: bigEmotes ? fontSize * 3 : fontSize,
decoration:
event.redacted ? TextDecoration.lineThrough : null,
),
options: const LinkifyOptions(humanize: false),
linkStyle: TextStyle(
color: textColor.withAlpha(150),
fontSize: bigEmotes ? fontSize * 3 : fontSize,
decoration: TextDecoration.underline,
decorationColor: textColor.withAlpha(150),
),
onOpen: (url) => UrlLauncher(context, url.url).launchUrl(),
);
},
);
}
case EventTypes.CallInvite:

View file

@ -269,6 +269,7 @@ class ITController {
completedITSteps.add(itStep);
showChoiceFeedback = true;
Future.delayed(
const Duration(
milliseconds: ChoreoConstants.millisecondsToDisplayFeedback,

View file

@ -224,39 +224,40 @@ class ITChoices extends StatelessWidget {
int index, [
Color? borderColor,
String? choiceFeedback,
]) =>
OverlayUtil.showPositionedCard(
context: context,
cardToShow: choiceFeedback == null
? WordDataCard(
word: controller.currentITStep!.continuances[index].text,
wordLang: controller.targetLangCode,
fullText: sourceText ?? controller.choreographer.currentText,
fullTextLang: sourceText != null
? controller.sourceLangCode
: controller.targetLangCode,
hasInfo: controller.currentITStep!.continuances[index].hasInfo,
choiceFeedback: choiceFeedback,
room: controller.choreographer.chatController.room,
)
: ITFeedbackCard(
req: ITFeedbackRequestModel(
sourceText: sourceText!,
currentText: controller.choreographer.currentText,
chosenContinuance:
controller.currentITStep!.continuances[index].text,
bestContinuance: controller.currentITStep!.best.text,
feedbackLang: controller.targetLangCode,
sourceTextLang: controller.sourceLangCode,
targetLang: controller.targetLangCode,
),
choiceFeedback: choiceFeedback,
]) {
OverlayUtil.showPositionedCard(
context: context,
cardToShow: choiceFeedback == null
? WordDataCard(
word: controller.currentITStep!.continuances[index].text,
wordLang: controller.targetLangCode,
fullText: sourceText ?? controller.choreographer.currentText,
fullTextLang: sourceText != null
? controller.sourceLangCode
: controller.targetLangCode,
hasInfo: controller.currentITStep!.continuances[index].hasInfo,
choiceFeedback: choiceFeedback,
room: controller.choreographer.chatController.room,
)
: ITFeedbackCard(
req: ITFeedbackRequestModel(
sourceText: sourceText!,
currentText: controller.choreographer.currentText,
chosenContinuance:
controller.currentITStep!.continuances[index].text,
bestContinuance: controller.currentITStep!.best.text,
feedbackLang: controller.targetLangCode,
sourceTextLang: controller.sourceLangCode,
targetLang: controller.targetLangCode,
),
cardSize: const Size(300, 300),
borderColor: borderColor,
transformTargetId: controller.choreographer.itBarTransformTargetKey,
backDropToDismiss: false,
);
choiceFeedback: choiceFeedback,
),
cardSize: const Size(300, 300),
borderColor: borderColor,
transformTargetId: controller.choreographer.itBarTransformTargetKey,
backDropToDismiss: false,
);
}
@override
Widget build(BuildContext context) {

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import '../../../config/app_config.dart';

View file

@ -51,7 +51,7 @@ class ModelKey {
static const String word = "word";
static const String lang = "lang";
static const String deepL = "deepl";
static const String langCode = 'langCode';
static const String langCode = 'lang_code';
static const String wordLang = "word_lang";
static const String lemma = "lemma";
static const String saveVocab = "save_vocab";
@ -88,6 +88,8 @@ class ModelKey {
static const String bestContinuance = "best_continuance";
static const String feedbackLang = "feedback_lang";
static const String transcription = "transcription";
// bot options
static const String languageLevel = "difficulty";
static const String conversationTopic = "conversation_topic";

View file

@ -13,5 +13,7 @@ class PangeaEventTypes {
static const vocab = "p.vocab";
static const roomInfo = "pangea.roomtopic";
static const audio = "p.audio";
static const botOptions = "pangea.bot_options";
}

View file

@ -1,17 +1,16 @@
import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:collection/collection.dart';
import 'package:matrix/matrix.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:fluffychat/pangea/controllers/base_controller.dart';
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
import 'package:fluffychat/pangea/models/message_data_models.dart';
import 'package:fluffychat/pangea/repo/tokens_repo.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import '../constants/pangea_event_types.dart';
import '../enum/use_type.dart';
import '../models/choreo_record.dart';

View file

@ -11,6 +11,7 @@ import 'package:fluffychat/pangea/controllers/message_data_controller.dart';
import 'package:fluffychat/pangea/controllers/my_analytics_controller.dart';
import 'package:fluffychat/pangea/controllers/permissions_controller.dart';
import 'package:fluffychat/pangea/controllers/subscription_controller.dart';
import 'package:fluffychat/pangea/controllers/text_to_speech_controller.dart';
import 'package:fluffychat/pangea/controllers/user_controller.dart';
import 'package:fluffychat/pangea/controllers/word_net_controller.dart';
import 'package:fluffychat/pangea/guard/p_vguard.dart';
@ -44,6 +45,7 @@ class PangeaController {
late ITFeedbackController itFeedback;
late InstructionsController instructions;
late SubscriptionController subscriptionController;
late TextToSpeechController textToSpeech;
///store Services
late PLocalStore pStoreService;
@ -89,6 +91,7 @@ class PangeaController {
instructions = InstructionsController(this);
subscriptionController = SubscriptionController(this);
itFeedback = ITFeedbackController(this);
textToSpeech = TextToSpeechController(this);
PAuthGaurd.pController = this;
}

View file

@ -0,0 +1,159 @@
import 'dart:async';
import 'dart:convert';
import 'dart:typed_data';
import 'package:fluffychat/pangea/config/environment.dart';
import 'package:fluffychat/pangea/constants/model_keys.dart';
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
import 'package:fluffychat/pangea/network/urls.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import '../network/requests.dart';
class TextToSpeechRequest {
String text;
String langCode;
TextToSpeechRequest({required this.text, required this.langCode});
Map<String, dynamic> toJson() => {
ModelKey.text: text,
ModelKey.langCode: langCode,
};
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is TextToSpeechRequest &&
other.text == text &&
other.langCode == langCode;
}
@override
int get hashCode => text.hashCode ^ langCode.hashCode;
}
class TextToSpeechResponse {
String audioContent;
String mediaType;
int durationMillis;
List<int> waveform;
TextToSpeechResponse({
required this.audioContent,
required this.mediaType,
required this.durationMillis,
required this.waveform,
});
factory TextToSpeechResponse.fromJson(
Map<String, dynamic> json,
) =>
TextToSpeechResponse(
audioContent: json["audio_content"],
mediaType: json["media_type"],
durationMillis: json["duration_millis"],
waveform: List<int>.from(json["wave_form"]),
);
}
class _TextToSpeechCacheItem {
Future<TextToSpeechResponse> data;
_TextToSpeechCacheItem({
required this.data,
});
}
class TextToSpeechController {
static final Map<TextToSpeechRequest, _TextToSpeechCacheItem> _cache = {};
late final PangeaController _pangeaController;
Timer? _cacheClearTimer;
TextToSpeechController(PangeaController pangeaController) {
_pangeaController = pangeaController;
_initializeCacheClearing();
}
void _initializeCacheClearing() {
const duration = Duration(minutes: 15); // Adjust the duration as needed
_cacheClearTimer = Timer.periodic(duration, (Timer t) => _clearCache());
}
void _clearCache() {
_cache.clear();
}
void dispose() {
_cacheClearTimer?.cancel();
}
Future<TextToSpeechResponse> get(
TextToSpeechRequest params,
) async {
if (_cache.containsKey(params)) {
return _cache[params]!.data;
} else {
final Future<TextToSpeechResponse> response = _fetchResponse(
await _pangeaController.userController.accessToken,
params,
);
_cache[params] = _TextToSpeechCacheItem(data: response);
return response;
}
}
static Future<TextToSpeechResponse> _fetchResponse(
String accessToken,
TextToSpeechRequest params,
) async {
final Requests request = Requests(
choreoApiKey: Environment.choreoApiKey,
accessToken: accessToken,
);
final Response res = await request.post(
url: PApiUrls.textToSpeech,
body: params.toJson(),
);
final Map<String, dynamic> json = jsonDecode(res.body);
return TextToSpeechResponse.fromJson(json);
}
// if (json["wave_form"] == null) {
// json["wave_form"] = getWaveForm();
// }
// return TextToSpeechResponse(
// audioContent: String.fromCharCodes(base64Decode(json["audio_content"])),
// mediaType: json["media_type"],
// durationMillis: durationMillis(json["duration_millis"]),
// waveform: getWaveForm(json["audio_content"]),
// );
// }
// static List<int> getWaveForm(audioContent) {
// return [];
// }
// static int durationMillis(audioContent) {
// return 0;
// }
static bool isOggFile(Uint8List bytes) {
// Check if the file has enough bytes for the header
if (bytes.length < 4) {
return false;
}
// Check the magic number for OGG file
return bytes[0] == 0x4F &&
bytes[1] == 0x67 &&
bytes[2] == 0x67 &&
bytes[3] == 0x53;
}
}

View file

@ -563,7 +563,6 @@ extension PangeaRoom on Room {
event: event,
timeline: timeline,
ownMessage: true,
selected: false,
);
msgs.add(
RecentMessageRecord(
@ -614,10 +613,11 @@ extension PangeaRoom on Room {
if (newEventId == null) {
debugger(when: kDebugMode);
return null;
}
//PTODO - handle the frequent case of a null newEventId
final Event? newEvent = await getEventById(newEventId!);
final Event? newEvent = await getEventById(newEventId);
if (newEvent == null) {
debugger(when: kDebugMode);
@ -625,7 +625,7 @@ extension PangeaRoom on Room {
return newEvent;
} catch (err, stack) {
debugger(when: kDebugMode);
// debugger(when: kDebugMode);
ErrorHandler.logError(
e: err,
s: stack,

View file

@ -283,10 +283,20 @@ class IGCTextData {
nextTokenIndex = matchTokens.length;
}
final String matchText = originalInput.substring(
matchTokens[tokenIndex].token.text.offset,
matchTokens[nextTokenIndex - 1].token.end,
);
String matchText;
try {
matchText = originalInput.substring(
matchTokens[tokenIndex].token.text.offset,
matchTokens[nextTokenIndex - 1].token.end,
);
} catch (err) {
return [
TextSpan(
text: originalInput,
style: defaultStyle,
),
];
}
items.add(
TextSpan(

View file

@ -0,0 +1,9 @@
// relates to a pangea representation event
// the matrix even fits the form of a regular matrix audio event
// but with something to distinguish it as a pangea audio event
import 'package:matrix/matrix.dart';
class PangeaAudioEvent {
Event? _event;
}

View file

@ -1,12 +1,17 @@
import 'dart:convert';
import 'dart:developer';
import 'package:collection/collection.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/constants/model_keys.dart';
import 'package:fluffychat/pangea/constants/pangea_message_types.dart';
import 'package:fluffychat/pangea/controllers/text_to_speech_controller.dart';
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
import 'package:fluffychat/pangea/models/choreo_record.dart';
import 'package:fluffychat/pangea/models/class_model.dart';
import 'package:fluffychat/pangea/models/message_data_models.dart';
import 'package:fluffychat/pangea/models/pangea_representation_event.dart';
import 'package:fluffychat/pangea/utils/bot_name.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart';
@ -20,14 +25,12 @@ class PangeaMessageEvent {
late Event _event;
final Timeline timeline;
final bool ownMessage;
final bool selected;
bool _isValidPangeaMessageEvent = true;
PangeaMessageEvent({
required Event event,
required this.timeline,
required this.ownMessage,
required this.selected,
}) {
if (event.type != EventTypes.Message) {
_isValidPangeaMessageEvent = false;
@ -41,6 +44,8 @@ class PangeaMessageEvent {
//the timeline filters the edits and uses the original events
//so this event will always be the original and the sdk getter body
//handles getting the latest text from the aggregated events
Event get event => _event;
String get body => _event.body;
String get senderId => _event.senderId;
@ -64,7 +69,7 @@ class PangeaMessageEvent {
.firstOrNull ??
_event;
bool get showRichText {
bool showRichText(bool selected) {
if (!_isValidPangeaMessageEvent) {
return false;
}
@ -79,6 +84,126 @@ class PangeaMessageEvent {
return true;
}
//get audio for text and language
//if no audio exists, create it
//if audio exists, return it
Future<Event?> getAudioGlobal(String langCode) async {
// try {
final String text = representationByLanguage(langCode)?.text ?? body;
final local = getAudioLocal(langCode, text);
if (local != null) return Future.value(local);
final TextToSpeechRequest params = TextToSpeechRequest(
text: text,
langCode: langCode,
);
final TextToSpeechResponse response =
await MatrixState.pangeaController.textToSpeech.get(
params,
);
if (response.mediaType != 'audio/ogg') {
throw Exception('Unexpected media type: ${response.mediaType}');
}
final audioBytes = base64.decode(response.audioContent);
if (!TextToSpeechController.isOggFile(audioBytes)) {
throw Exception("File is not a valid OGG format");
} else {
debugPrint("File is a valid OGG format");
}
// from text, trim whitespace, remove special characters, and limit to 20 characters
// final fileName =
// text.trim().replaceAll(RegExp('[^A-Za-z0-9]'), '').substring(0, 20);
final fileName = "audio_for_${eventId}_$langCode";
final file = MatrixAudioFile(
bytes: audioBytes,
name: fileName,
mimeType: response.mediaType,
);
if (file.mimeType != "audio/ogg") {
throw Exception("Unexpected mime type: ${file.mimeType}");
}
try {
final String? eventId = await room.sendFileEvent(
file,
inReplyTo: _event,
extraContent: {
'info': {
...file.info,
'duration': response.durationMillis,
},
'org.matrix.msc3245.voice': {},
'org.matrix.msc1767.audio': {
'duration': response.durationMillis,
'waveform': response.waveform,
},
ModelKey.transcription: {
ModelKey.text: text,
ModelKey.langCode: langCode,
},
},
);
// .timeout(
// Durations.long4,
// onTimeout: () {
// debugPrint("timeout in getAudioGlobal");
// return null;
// },
// );
debugPrint("eventId in getAudioGlobal $eventId");
return eventId != null ? room.getEventById(eventId) : null;
} catch (err) {
debugPrint("error in getAudioGlobal");
debugger(when: kDebugMode);
return null;
}
}
Event? getAudioLocal(String langCode, String text) {
return allAudio.firstWhereOrNull(
(element) {
// Safely access the transcription map
final transcription = element.content.tryGetMap(ModelKey.transcription);
// return transcription != null;
if (transcription == null) {
// If transcription is null, this element does not match.
return false;
}
// Safely get language code and text from the transcription
final elementLangCode = transcription[ModelKey.langCode];
final elementText = transcription[ModelKey.text];
// Check if both language code and text matsch
return elementLangCode == langCode && elementText == text;
},
);
}
// get audio events that are related to this event
Set<Event> get allAudio => _latestEdit
.aggregatedEvents(
timeline,
RelationshipTypes.reply,
)
.where((element) {
return element.content.tryGet<Map<String, dynamic>>(
ModelKey.transcription,
) !=
null;
}).toSet();
List<RepresentationEvent>? _representations;
List<RepresentationEvent> get representations {
if (_representations != null) return _representations!;
@ -186,11 +311,6 @@ class PangeaMessageEvent {
RepresentationEvent? rep = representationByLanguage(langCode);
//if event is less than 1 minute old, then print new event
// if (isNew) {
// debugger(when: kDebugMode);
// }
while ((isNew || eventId.contains("web")) && tries < 20) {
if (rep != null) return rep;
await Future.delayed(const Duration(milliseconds: 500));
@ -269,14 +389,55 @@ class PangeaMessageEvent {
!room.isUserSpaceAdmin(_event.senderId) &&
_event.messageType != PangeaMessageTypes.report;
String get messageDisplayLangCode {
final bool immersionMode = MatrixState
.pangeaController.permissionsController
.isToolEnabled(ToolSetting.immersionMode, room);
final String? l2Code = MatrixState.pangeaController.languageController
.activeL2Code(roomID: room.id);
final String? langCode = immersionMode ? l2Code : originalWritten?.langCode;
return langCode ?? LanguageKeys.unknownLanguage;
}
RepresentationEvent? _displayRepresentation;
RepresentationEvent? displayRepresentation(String langCode) =>
_displayRepresentation;
Future<void> setDisplayRepresentation(
BuildContext context,
) async {
if (messageDisplayLangCode == LanguageKeys.unknownLanguage ||
_displayRepresentation != null) {
return;
}
_displayRepresentation = representationByLanguage(messageDisplayLangCode);
if (_displayRepresentation != null) return;
try {
_displayRepresentation = await representationByLanguageGlobal(
context: context,
langCode: messageDisplayLangCode,
);
return;
} catch (err, s) {
ErrorHandler.logError(
m: "error in getDisplayRepresentation",
e: err,
s: s,
);
}
}
// List<SpanData> get activities =>
//each match is turned into an activity that other students can access
//they're not told the answer but have to find it themselves
//the message has a blank piece which they fill in themselves
// replication of logic from message_content.dart
bool get isHtml =>
AppConfig.renderHtml && !_event.redacted && _event.isRichMessage;
// bool get isHtml =>
// AppConfig.renderHtml && !_event.redacted && _event.isRichMessage;
}
class URLFinder {

View file

@ -10,7 +10,6 @@ import 'package:fluffychat/pangea/config/environment.dart';
/// https://api.staging.pangea.chat/api/v1/
class PApiUrls {
static String baseAPI = Environment.baseAPI;
static String choreoBaseApi = Environment.choreoApi;
/// ---------------------- Languages --------------------------------------
static String getLanguages = "/languages";
@ -51,6 +50,8 @@ class PApiUrls {
static String firstStep = "/it_initialstep";
static String subseqStep = "/it_step";
static String textToSpeech = "${Environment.choreoApi}/text_to_speech";
///-------------------------------- revenue cat --------------------------
static String rcApiV1 = "https://api.revenuecat.com/v1";
static String rcApiV2 =

View file

@ -0,0 +1,72 @@
import 'dart:convert';
import 'dart:developer';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart';
import '../config/environment.dart';
import '../network/requests.dart';
class GenerateImageeResponse {
final String imageUrl;
final String prompt;
GenerateImageeResponse({
required this.imageUrl,
required this.prompt,
});
factory GenerateImageeResponse.fromJson(Map<String, dynamic> json) {
return GenerateImageeResponse(
imageUrl: json['image_url'],
prompt: json['prompt'],
);
}
factory GenerateImageeResponse.error() {
return GenerateImageeResponse(
imageUrl: 'https://i.imgur.com/2L2JYqk.png',
prompt: 'Error',
);
}
}
class GenerateImageRequest {
String prompt;
GenerateImageRequest({required this.prompt});
Map<String, dynamic> toJson() => {
'prompt': prompt,
};
}
class ImageRepo {
static Future<GenerateImageeResponse> fetchImage(
GenerateImageRequest request) async {
final Requests req =
Requests(baseUrl: Environment.choreoApi); // Set your API base URL
final requestBody = request.toJson();
try {
final Response res = await req.post(
url: '/generate-image/', // Endpoint in your FastAPI server
body: requestBody,
);
if (res.statusCode == 200) {
final decodedBody = jsonDecode(utf8.decode(res.bodyBytes));
return GenerateImageeResponse.fromJson(
decodedBody); // Convert response to ImageModel
} else {
throw Exception('Failed to load image');
}
} catch (err, stack) {
debugger(when: kDebugMode);
ErrorHandler.logError(e: err, s: stack, data: requestBody);
return GenerateImageeResponse
.error(); // Return an error model or handle accordingly
}
}
}

View file

@ -14,7 +14,7 @@ class ITRepo {
CustomInputRequestModel initalText,
) async {
final Requests req = Requests(
baseUrl: PApiUrls.choreoBaseApi,
baseUrl: Environment.choreoApi,
choreoApiKey: Environment.choreoApiKey,
);
final Response res =
@ -29,7 +29,7 @@ class ITRepo {
SystemChoiceRequestModel subseqText,
) async {
final Requests req = Requests(
baseUrl: PApiUrls.choreoBaseApi,
baseUrl: Environment.choreoApi,
choreoApiKey: Environment.choreoApiKey,
);

View file

@ -8,7 +8,7 @@ class MessageServiceRepo {
String messageId,
) async {
final Requests req = Requests(
baseUrl: PApiUrls.choreoBaseApi,
baseUrl: Environment.choreoApi,
choreoApiKey: Environment.choreoApiKey,
);

View file

@ -0,0 +1,66 @@
// import 'dart:async';
// import 'dart:convert';
// import 'package:fluffychat/pangea/config/environment.dart';
// import 'package:fluffychat/pangea/constants/model_keys.dart';
// import 'package:fluffychat/pangea/network/urls.dart';
// import 'package:http/http.dart';
// import '../network/requests.dart';
// class TextToSpeechRequest {
// String text;
// String langCode;
// TextToSpeechRequest({required this.text, required this.langCode});
// Map<String, dynamic> toJson() => {
// ModelKey.text: text,
// ModelKey.langCode: langCode,
// };
// }
// class TextToSpeechResponse {
// String audioContent;
// String mediaType;
// int durationMillis;
// List<int> waveform;
// TextToSpeechResponse({
// required this.audioContent,
// required this.mediaType,
// required this.durationMillis,
// required this.waveform,
// });
// factory TextToSpeechResponse.fromJson(
// Map<String, dynamic> json,
// ) =>
// TextToSpeechResponse(
// audioContent: json["audio_content"],
// mediaType: json["media_type"],
// durationMillis: json["duration_millis"],
// waveform: List<int>.from(json["wave_form"]),
// );
// }
// class TextToSpeechService {
// static Future<TextToSpeechResponse> get({
// required String accessToken,
// required TextToSpeechRequest params,
// }) async {
// final Requests request = Requests(
// choreoApiKey: Environment.choreoApiKey,
// accessToken: accessToken,
// );
// final Response res = await request.post(
// url: PApiUrls.textToSpeech,
// body: params.toJson(),
// );
// final Map<String, dynamic> json = jsonDecode(res.body);
// return TextToSpeechResponse.fromJson(json);
// }
// }

View file

@ -3,11 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import '../models/widget_measurement.dart';
class PangeaAnyState {
final Map<String, StreamController<WidgetMeasurements>?> _streams = {};
final Map<String, List<WidgetMeasurements>> _pastValues = {};
final Map<String, LayerLinkAndKey> _layerLinkAndKeys = {};
OverlayEntry? overlay;

View file

@ -136,7 +136,6 @@ List<PangeaMessageEvent> getPangeaMessageEvents(
event: message,
timeline: timeline,
ownMessage: false,
selected: false,
),
)
.cast<PangeaMessageEvent>()

View file

@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/pangea/constants/language_keys.dart';
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
import 'package:fluffychat/pangea/models/class_model.dart';
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import '../../utils/matrix_sdk_extensions/matrix_locals.dart';
class GetChatListItemSubtitle {
@ -31,13 +30,17 @@ class GetChatListItemSubtitle {
);
}
String? eventContextId = event.eventId;
if (!event.eventId.isValidMatrixId || event.eventId.sigil != '\$') {
eventContextId = null;
}
final Timeline timeline =
await event.room.getTimeline(eventContextId: event.eventId);
await event.room.getTimeline(eventContextId: eventContextId);
final PangeaMessageEvent pangeaMessageEvent = PangeaMessageEvent(
event: event,
timeline: timeline,
ownMessage: false,
selected: false,
);
final l2Code =
pangeaController.languageController.activeL2Code(roomID: event.roomId);

View file

@ -15,11 +15,16 @@ class OverlayUtil {
static showOverlay({
required BuildContext context,
required Widget child,
required Size size,
required String transformTargetId,
// Size? size,
double? width,
double? height,
Offset? offset,
backDropToDismiss = true,
Color? borderColor,
Color? backgroundColor,
Alignment? targetAnchor,
Alignment? followerAnchor,
}) {
try {
MatrixState.pAnyState.closeOverlay();
@ -27,29 +32,29 @@ class OverlayUtil {
MatrixState.pAnyState.layerLinkAndKey(transformTargetId);
final OverlayEntry entry = OverlayEntry(
builder: (context) => Stack(
children: [
// GestureDetector to detect when dismissed by clicking outside
Positioned.fill(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
MatrixState.pAnyState.closeOverlay();
},
builder: (context) => AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
child: Stack(
children: [
if (backDropToDismiss)
TransparentBackdrop(
backgroundColor: backgroundColor,
),
Positioned(
width: width,
height: height,
child: CompositedTransformFollower(
targetAnchor: targetAnchor ?? Alignment.topLeft,
followerAnchor: followerAnchor ?? Alignment.topLeft,
link: layerLinkAndKey.link,
showWhenUnlinked: false,
offset: offset ?? Offset.zero,
child: child,
),
),
),
if (backDropToDismiss) const TransparentBackdrop(),
Positioned(
width: size.width,
height: size.height,
child: CompositedTransformFollower(
link: layerLinkAndKey.link,
showWhenUnlinked: false,
offset: offset ?? Offset.zero,
child: child,
),
),
],
],
),
),
);
@ -90,7 +95,8 @@ class OverlayUtil {
showOverlay(
context: context,
child: child,
size: cardSize,
width: cardSize.width,
height: cardSize.height,
transformTargetId: transformTargetId,
offset: cardOffset,
backDropToDismiss: backDropToDismiss,
@ -174,15 +180,17 @@ class OverlayUtil {
}
class TransparentBackdrop extends StatelessWidget {
final Color? backgroundColor;
const TransparentBackdrop({
super.key,
this.backgroundColor,
});
@override
Widget build(BuildContext context) {
return Material(
borderOnForeground: false,
color: Colors.transparent,
color: backgroundColor ?? Colors.transparent,
clipBehavior: Clip.antiAlias,
child: InkWell(
hoverColor: Colors.transparent,

View file

@ -1,159 +0,0 @@
import 'dart:async';
import 'package:fluffychat/pangea/utils/any_state_holder.dart';
import 'package:fluffychat/pangea/utils/overlay.dart';
import 'package:fluffychat/pangea/widgets/igc/word_data_card.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
class ShowDefintionUtil {
String messageText;
final String langCode;
final String targetId;
final FocusNode focusNode = FocusNode();
final Room room;
String? textSelection;
bool inCooldown = false;
double? dx;
double? dy;
ShowDefintionUtil({
required this.targetId,
required this.room,
required this.langCode,
required this.messageText,
});
void onTextSelection({
required BuildContext context,
TextSelection? selectedText,
SelectedContent? selectedContent,
SelectionChangedCause? cause,
}) {
if ((selectedText == null && selectedContent == null) ||
selectedText?.isCollapsed == true) {
clearTextSelection();
return;
}
textSelection = selectedText != null
? selectedText.textInside(messageText)
: selectedContent!.plainText;
if (BrowserContextMenu.enabled && kIsWeb) {
BrowserContextMenu.disableContextMenu();
}
if (kIsWeb && cause != SelectionChangedCause.tap) {
handleToolbar(context);
}
}
void clearTextSelection() {
textSelection = null;
if (kIsWeb && !BrowserContextMenu.enabled) {
BrowserContextMenu.enableContextMenu();
}
}
void handleToolbar(BuildContext context) async {
if (inCooldown || OverlayUtil.isOverlayOpen || !kIsWeb) return;
inCooldown = true;
Timer(const Duration(milliseconds: 750), () => inCooldown = false);
await Future.delayed(const Duration(milliseconds: 750));
showToolbar(context);
}
void showDefinition(BuildContext context) {
if (textSelection == null) return;
OverlayUtil.showPositionedCard(
context: context,
cardToShow: WordDataCard(
word: textSelection!,
wordLang: langCode,
fullText: messageText,
fullTextLang: langCode,
hasInfo: false,
room: room,
),
cardSize: const Size(300, 300),
transformTargetId: targetId,
backDropToDismiss: false,
);
}
// web toolbar
Future<dynamic> showToolbar(BuildContext context) async {
final LayerLinkAndKey layerLinkAndKey =
MatrixState.pAnyState.layerLinkAndKey(targetId);
final RenderObject? targetRenderBox =
layerLinkAndKey.key.currentContext!.findRenderObject();
final Offset transformTargetOffset =
(targetRenderBox as RenderBox).localToGlobal(Offset.zero);
if (dx != null && dx! > MediaQuery.of(context).size.width - 130) {
dx = MediaQuery.of(context).size.width - 130;
}
final double xOffset = dx != null ? dx! - transformTargetOffset.dx : 0;
final double yOffset =
dy != null ? dy! - transformTargetOffset.dy + 10 : 10;
OverlayUtil.showOverlay(
context: context,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size.zero,
padding: EdgeInsets.zero,
),
onPressed: () {
showDefinition(context);
},
child: Text(
L10n.of(context)!.showDefinition,
style: const TextStyle(
fontSize: 14,
),
),
),
size: const Size(130, 45),
transformTargetId: targetId,
offset: Offset(xOffset, yOffset),
);
}
void onMouseRegionUpdate(PointerEvent event) {
dx = event.position.dx;
dy = event.position.dy;
}
Widget contextMenuOverride({
required BuildContext context,
EditableTextState? textSelection,
SelectableRegionState? contentSelection,
}) {
if (textSelection == null && contentSelection == null) {
return const SizedBox();
}
return AdaptiveTextSelectionToolbar.buttonItems(
anchors: textSelection?.contextMenuAnchors ??
contentSelection!.contextMenuAnchors,
buttonItems: [
if (textSelection != null) ...textSelection.contextMenuButtonItems,
if (contentSelection != null)
...contentSelection.contextMenuButtonItems,
ContextMenuButtonItem(
label: L10n.of(context)!.showDefinition,
onPressed: () {
showDefinition(context);
focusNode.unfocus();
},
),
],
);
}
}

View file

@ -0,0 +1,29 @@
import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/pangea/widgets/chat/text_to_speech_button.dart';
import 'package:flutter/material.dart';
class PangeaMessageActions extends StatelessWidget {
final ChatController chatController;
const PangeaMessageActions({super.key, required this.chatController});
@override
Widget build(BuildContext context) {
return chatController.selectedEvents.length == 1
? Row(
children: <Widget>[
// LanguageToggleSwitch(controller: chatController),
TextToSpeechButton(
controller: chatController,
selectedEvent: chatController.selectedEvents.first,
),
// IconButton(
// icon: Icon(Icons.mic),
// onPressed: chatController.onMicTap,
// ),
// Add more IconButton widgets here
],
)
: const SizedBox();
}
}

View file

@ -0,0 +1,103 @@
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pages/chat/events/audio_player.dart';
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
class MessageAudioCard extends StatefulWidget {
final PangeaMessageEvent messageEvent;
const MessageAudioCard({
super.key,
required this.messageEvent,
});
@override
MessageAudioCardState createState() => MessageAudioCardState();
}
class MessageAudioCardState extends State<MessageAudioCard> {
bool _isLoading = false;
Event? localAudioEvent;
void fetchAudio() {
if (!mounted) return;
setState(() => _isLoading = true);
widget.messageEvent
.getAudioGlobal(widget.messageEvent.messageDisplayLangCode)
.then((Event? event) {
localAudioEvent = event;
}).catchError((e) {
if (!mounted) return null;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(L10n.of(context)!.errorGettingAudio),
),
);
return null;
}).whenComplete(() {
if (mounted) setState(() => _isLoading = false);
});
}
@override
void initState() {
super.initState();
fetchAudio();
}
@override
void dispose() {
super.dispose();
setState(() => _isLoading = false);
}
@override
Widget build(BuildContext context) {
final playButton = InkWell(
borderRadius: BorderRadius.circular(64),
onTap: fetchAudio,
child: Material(
color: AppConfig.primaryColor.withAlpha(64),
borderRadius: BorderRadius.circular(64),
child: const Icon(
// Change the icon based on some condition. If you have an audio player state, use it here.
Icons.play_arrow_outlined,
color: AppConfig.primaryColor,
),
),
);
return Padding(
padding: const EdgeInsets.all(8),
child: _isLoading
? SizedBox(
height: 14,
width: 14,
child: CircularProgressIndicator(
strokeWidth: 2.0,
color: Theme.of(context).colorScheme.primary,
),
)
: localAudioEvent != null
? Container(
constraints: const BoxConstraints(
maxWidth: 250,
),
child: Column(
children: [
AudioPlayerWidget(
localAudioEvent!,
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
],
),
)
: Padding(
padding: const EdgeInsets.only(left: 8),
child: playButton,
),
);
}
}

View file

@ -0,0 +1,69 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
class MessageContextMenu {
static List<ContextMenuButtonItem> customToolbarOptions(
BuildContext context,
void Function()? onDefine,
void Function()? onListen,
) {
return [
ContextMenuButtonItem(
label: L10n.of(context)!.define,
onPressed: onDefine,
),
ContextMenuButtonItem(
label: L10n.of(context)!.listen,
onPressed: onListen,
),
];
}
static List<ContextMenuButtonItem> toolbarOptions(
EditableTextState? textSelection,
SelectableRegionState? contentSelection,
BuildContext context,
void Function()? onDefine,
void Function()? onListen,
) {
final List<ContextMenuButtonItem> menuItems =
textSelection?.contextMenuButtonItems ??
contentSelection?.contextMenuButtonItems ??
[];
menuItems.sort((a, b) {
if (a.type == ContextMenuButtonType.copy) return -1;
if (b.type == ContextMenuButtonType.copy) return 1;
return 0;
});
return MessageContextMenu.customToolbarOptions(
context, onDefine, onListen) +
menuItems;
}
static Widget contextMenuOverride({
required BuildContext context,
EditableTextState? textSelection,
SelectableRegionState? contentSelection,
void Function()? onDefine,
void Function()? onListen,
}) {
if (textSelection == null && contentSelection == null) {
return const SizedBox();
}
final List<ContextMenuButtonItem> menuItems =
MessageContextMenu.toolbarOptions(
textSelection,
contentSelection,
context,
onDefine,
onListen,
);
return AdaptiveTextSelectionToolbar.buttonItems(
anchors: textSelection?.contextMenuAnchors ??
contentSelection!.contextMenuAnchors,
buttonItems: menuItems,
);
}
}

View file

@ -0,0 +1,34 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class MessageTextSelection {
String? selectedText;
String messageText = "";
void setMessageText(String text) {
messageText = text;
}
void onTextSelection(TextSelection selection) => selection.isCollapsed == true
? clearTextSelection()
: setTextSelection(selection);
void setTextSelection(TextSelection selection) {
selectedText = selection.textInside(messageText);
if (BrowserContextMenu.enabled && kIsWeb) {
BrowserContextMenu.disableContextMenu();
}
// selectionStream.add(selectedText);
}
void clearTextSelection() {
selectedText = null;
if (kIsWeb && !BrowserContextMenu.enabled) {
BrowserContextMenu.enableContextMenu();
}
// selectionStream.add(selectedText);
}
}

View file

@ -0,0 +1,304 @@
import 'dart:async';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/chat/chat.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';
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/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:matrix/matrix.dart';
enum MessageMode { translation, play, definition }
class ToolbarDisplayController {
final FocusNode focusNode = FocusNode();
final PangeaMessageEvent pangeaMessageEvent;
final String targetId;
final bool immersionMode;
final ChatController controller;
MessageToolbar? toolbar;
String? overlayId;
double? messageWidth;
final toolbarModeStream = StreamController<MessageMode>.broadcast();
ToolbarDisplayController({
required this.pangeaMessageEvent,
required this.targetId,
required this.immersionMode,
required this.controller,
});
void setToolbar() {
toolbar ??= MessageToolbar(
textSelection: MessageTextSelection(),
room: pangeaMessageEvent.room,
toolbarModeStream: toolbarModeStream,
pangeaMessageEvent: pangeaMessageEvent,
immersionMode: immersionMode,
controller: controller,
);
final LayerLinkAndKey layerLinkAndKey =
MatrixState.pAnyState.layerLinkAndKey(targetId);
final targetRenderBox =
layerLinkAndKey.key.currentContext?.findRenderObject();
if (targetRenderBox == null) return;
final Size transformTargetSize = (targetRenderBox as RenderBox).size;
messageWidth = transformTargetSize.width;
}
void showToolbar(BuildContext context, {MessageMode? mode}) {
if (highlighted) return;
if (controller.selectMode) {
controller.clearSelectedEvents();
}
focusNode.unfocus();
Widget overlayEntry;
try {
overlayEntry = Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: pangeaMessageEvent.ownMessage
? CrossAxisAlignment.end
: CrossAxisAlignment.start,
children: [
toolbar!,
OverlayMessage(
pangeaMessageEvent.event,
timeline: pangeaMessageEvent.timeline,
immersionMode: immersionMode,
ownMessage: pangeaMessageEvent.ownMessage,
toolbarController: this,
width: messageWidth,
),
],
);
} catch (err) {
ErrorHandler.logError(e: err, s: StackTrace.current);
return;
}
OverlayUtil.showOverlay(
context: context,
child: overlayEntry,
transformTargetId: targetId,
targetAnchor: pangeaMessageEvent.ownMessage
? Alignment.bottomRight
: Alignment.bottomLeft,
followerAnchor: pangeaMessageEvent.ownMessage
? Alignment.bottomRight
: Alignment.bottomLeft,
backgroundColor: const Color.fromRGBO(0, 0, 0, 1).withAlpha(164),
);
if (MatrixState.pAnyState.overlay != null) {
overlayId = MatrixState.pAnyState.overlay.hashCode.toString();
}
if (mode != null) {
Future.delayed(
const Duration(milliseconds: 100),
() => toolbarModeStream.add(mode),
);
}
}
bool get highlighted =>
MatrixState.pAnyState.overlay.hashCode.toString() == overlayId;
}
class MessageToolbar extends StatefulWidget {
final MessageTextSelection textSelection;
final Room room;
final PangeaMessageEvent pangeaMessageEvent;
final StreamController<MessageMode> toolbarModeStream;
final bool immersionMode;
final ChatController controller;
const MessageToolbar({
super.key,
required this.textSelection,
required this.room,
required this.pangeaMessageEvent,
required this.toolbarModeStream,
required this.immersionMode,
required this.controller,
});
@override
MessageToolbarState createState() => MessageToolbarState();
}
class MessageToolbarState extends State<MessageToolbar> {
Widget? child;
MessageMode? _currentMode;
late StreamSubscription<String?> _selectionStream;
late StreamSubscription<MessageMode> _toolbarModeStream;
IconData _getIconData(MessageMode mode) {
switch (mode) {
case MessageMode.translation:
return Icons.g_translate;
case MessageMode.play:
return Icons.play_arrow;
case MessageMode.definition:
return Icons.book;
default:
return Icons.error; // Icon to indicate an error or unsupported mode
}
}
bool _enabledButton(MessageMode mode) {
switch (mode) {
case MessageMode.translation:
return true;
case MessageMode.play:
return true;
case MessageMode.definition:
// return widget.textSelection.selectedText != null;
return true;
default:
return false;
}
}
void updateMode(MessageMode newMode) {
debugPrint("updating toolbar mode");
setState(() => _currentMode = newMode);
switch (_currentMode) {
case MessageMode.translation:
showTranslation();
break;
case MessageMode.play:
playAudio();
break;
case MessageMode.definition:
showDefinition();
break;
default:
break;
}
setState(() {});
}
void showTranslation() {
debugPrint("show translation");
child = MessageTranslationCard(
messageEvent: widget.pangeaMessageEvent,
immersionMode: widget.immersionMode,
);
}
void playAudio() {
debugPrint("play audio");
child = MessageAudioCard(
messageEvent: widget.pangeaMessageEvent,
);
}
void showDefinition() {
if (widget.textSelection.selectedText == null ||
widget.textSelection.selectedText!.isEmpty) {
return;
}
child = WordDataCard(
word: widget.textSelection.selectedText!,
wordLang: widget.pangeaMessageEvent.messageDisplayLangCode,
fullText: widget.textSelection.messageText,
fullTextLang: widget.pangeaMessageEvent.messageDisplayLangCode,
hasInfo: false,
room: widget.room,
);
}
void showImage() {}
void spellCheck() {}
void showMore() {
MatrixState.pAnyState.closeOverlay();
widget.controller.onSelectMessage(widget.pangeaMessageEvent.event);
}
@override
void initState() {
super.initState();
_toolbarModeStream = widget.toolbarModeStream.stream.listen((mode) {
updateMode(mode);
});
}
@override
void dispose() {
_selectionStream.cancel();
_toolbarModeStream.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Material(
type: MaterialType.transparency,
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
border: Border.all(
width: 2,
color: Theme.of(context).colorScheme.primary,
),
borderRadius: const BorderRadius.all(
Radius.circular(25),
),
),
constraints: const BoxConstraints(
maxWidth: 300,
minWidth: 300,
maxHeight: 300,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: SingleChildScrollView(
child: AnimatedSize(
duration: FluffyThemes.animationDuration,
child: Column(
children: [
child ?? const SizedBox(),
SizedBox(height: child == null ? 0 : 20),
],
),
),
),
),
Row(
mainAxisSize: MainAxisSize.min,
children: MessageMode.values.map((mode) {
return IconButton(
icon: Icon(_getIconData(mode)),
onPressed:
_enabledButton(mode) ? () => updateMode(mode) : null,
);
}).toList() +
[
IconButton(
icon: Icon(Icons.adaptive.more_outlined),
onPressed: showMore,
),
],
),
],
),
),
);
}
}

View file

@ -0,0 +1,111 @@
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
import 'package:fluffychat/pangea/models/pangea_representation_event.dart';
import 'package:fluffychat/pangea/utils/bot_style.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
class MessageTranslationCard extends StatefulWidget {
final PangeaMessageEvent messageEvent;
final bool immersionMode;
const MessageTranslationCard({
super.key,
required this.messageEvent,
required this.immersionMode,
});
@override
MessageTranslationCardState createState() => MessageTranslationCardState();
}
class MessageTranslationCardState extends State<MessageTranslationCard> {
RepresentationEvent? repEvent;
bool _fetchingRepresentation = false;
String? translationLangCode() {
final String? l1Code =
MatrixState.pangeaController.languageController.activeL1Code(
roomID: widget.messageEvent.room.id,
);
if (widget.immersionMode) return l1Code;
final String? l2Code =
MatrixState.pangeaController.languageController.activeL2Code(
roomID: widget.messageEvent.room.id,
);
final String? originalWrittenCode =
widget.messageEvent.originalWritten?.content.langCode;
return l1Code == originalWrittenCode ? l2Code : l1Code;
}
void fetchRepresentation(BuildContext context) {
final String? langCode = translationLangCode();
if (langCode == null) return;
repEvent = widget.messageEvent.representationByLanguage(
langCode,
);
if (repEvent == null && mounted) {
setState(() => _fetchingRepresentation = true);
widget.messageEvent
.representationByLanguageGlobal(
context: context,
langCode: langCode,
)
.onError(
(error, stackTrace) => ErrorHandler.logError(
e: error,
s: stackTrace,
),
)
.then((RepresentationEvent? event) => repEvent = event)
.whenComplete(
() {
setState(() => _fetchingRepresentation = false);
},
);
} else {
if (mounted) setState(() {});
}
}
@override
void initState() {
super.initState();
fetchRepresentation(context);
}
@override
void dispose() {
super.dispose();
setState(() => _fetchingRepresentation = false);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8),
child: _fetchingRepresentation
? SizedBox(
height: 14,
width: 14,
child: CircularProgressIndicator(
strokeWidth: 2.0,
color: Theme.of(context).colorScheme.primary,
),
)
: repEvent != null
? Text(
repEvent!.text,
style: BotStyle.text(context),
)
: Text(
L10n.of(context)!.oopsSomethingWentWrong,
style: BotStyle.text(context),
),
);
}
}

View file

@ -0,0 +1,166 @@
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/chat/events/message_content.dart';
import 'package:fluffychat/pangea/enum/use_type.dart';
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
import 'package:fluffychat/pangea/widgets/chat/message_toolbar.dart';
import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart';
import '../../../config/app_config.dart';
class OverlayMessage extends StatelessWidget {
final Event event;
final bool selected;
final Timeline timeline;
// #Pangea
// final LanguageModel? selectedDisplayLang;
final bool immersionMode;
// final bool definitions;
final bool ownMessage;
final ToolbarDisplayController toolbarController;
final double? width;
// Pangea#
const OverlayMessage(
this.event, {
this.selected = false,
required this.timeline,
// #Pangea
required this.immersionMode,
required this.ownMessage,
required this.toolbarController,
this.width,
// Pangea#
super.key,
});
@override
Widget build(BuildContext context) {
if (event.type != EventTypes.Message ||
event.messageType == EventTypes.KeyVerificationRequest) {
return const SizedBox.shrink();
}
var color = Theme.of(context).colorScheme.surfaceVariant;
final textColor = ownMessage
? Theme.of(context).colorScheme.onPrimaryContainer
: Theme.of(context).colorScheme.onBackground;
final borderRadius = BorderRadius.only(
topLeft: !ownMessage
? const Radius.circular(4)
: const Radius.circular(AppConfig.borderRadius),
topRight: const Radius.circular(AppConfig.borderRadius),
bottomLeft: const Radius.circular(AppConfig.borderRadius),
bottomRight: ownMessage
? const Radius.circular(4)
: const Radius.circular(AppConfig.borderRadius),
);
final noBubble = {
MessageTypes.Video,
MessageTypes.Image,
MessageTypes.Sticker,
}.contains(event.messageType) &&
!event.redacted;
final noPadding = {
MessageTypes.File,
MessageTypes.Audio,
}.contains(event.messageType);
if (ownMessage) {
color = Theme.of(context).colorScheme.primaryContainer;
}
// #Pangea
final pangeaMessageEvent = PangeaMessageEvent(
event: event,
timeline: timeline,
ownMessage: ownMessage,
);
// Pangea#
return Material(
color: noBubble ? Colors.transparent : color,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: borderRadius,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
AppConfig.borderRadius,
),
),
padding: noBubble || noPadding
? EdgeInsets.zero
: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
constraints: BoxConstraints(
maxWidth: width ?? FluffyThemes.columnWidth * 1.25,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MessageContent(
event,
textColor: textColor,
borderRadius: borderRadius,
selected: selected,
pangeaMessageEvent: pangeaMessageEvent,
immersionMode: immersionMode,
toolbarController: toolbarController,
),
if (event.hasAggregatedEvents(
timeline,
RelationshipTypes.edit,
) // #Pangea
||
(pangeaMessageEvent.showUseType)
// Pangea#
)
Padding(
padding: const EdgeInsets.only(
top: 4.0,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
// #Pangea
if (pangeaMessageEvent.showUseType) ...[
pangeaMessageEvent.useType.iconView(
context,
textColor.withAlpha(164),
),
const SizedBox(width: 4),
],
if (event.hasAggregatedEvents(
timeline,
RelationshipTypes.edit,
)) ...[
// Pangea#
Icon(
Icons.edit_outlined,
color: textColor.withAlpha(164),
size: 14,
),
Text(
' - ${event.originServerTs.localizedTimeShort(context)}',
style: TextStyle(
color: textColor.withAlpha(164),
fontSize: 12,
),
),
],
],
),
),
],
),
),
);
}
}

View file

@ -0,0 +1,138 @@
import 'dart:developer';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/pages/chat/events/audio_player.dart';
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:just_audio/just_audio.dart';
import 'package:matrix/matrix.dart';
class TextToSpeechButton extends StatefulWidget {
final ChatController controller;
final Event selectedEvent;
const TextToSpeechButton({
super.key,
required this.controller,
required this.selectedEvent,
});
@override
_TextToSpeechButtonState createState() => _TextToSpeechButtonState();
}
class _TextToSpeechButtonState extends State<TextToSpeechButton> {
final AudioPlayer _audioPlayer = AudioPlayer();
late PangeaMessageEvent _pangeaMessageEvent;
bool _isLoading = false;
@override
void dispose() {
_audioPlayer.dispose();
super.dispose();
}
@override
void initState() {
super.initState();
_pangeaMessageEvent = PangeaMessageEvent(
event: widget.selectedEvent,
timeline: widget.controller.timeline!,
ownMessage:
widget.selectedEvent.senderId == Matrix.of(context).client.userID,
);
}
Event? get localAudioEvent =>
langCode != null && text != null && text!.isNotEmpty
? _pangeaMessageEvent.getAudioLocal(langCode!, text!)
: null;
String? get langCode =>
widget.controller.choreographer.messageOptions.selectedDisplayLang
?.langCode ??
widget.controller.choreographer.l2LangCode;
String? get text => langCode != null
? _pangeaMessageEvent.representationByLanguage(langCode!)?.text
: null;
Future<void> _getAudio() async {
try {
if (!mounted) return;
if (text == null || text!.isEmpty) return;
if (langCode == null || langCode!.isEmpty) return;
setState(() => _isLoading = true);
await _pangeaMessageEvent.getAudioGlobal(langCode!);
setState(() => _isLoading = false);
} catch (e) {
setState(() => _isLoading = false);
debugger(when: kDebugMode);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(L10n.of(context)!.errorGettingAudio),
),
);
ErrorHandler.logError(
e: Exception(),
s: StackTrace.current,
m: 'text is null or empty in text_to_speech_button.dart',
data: {'selectedEvent': widget.selectedEvent, 'langCode': langCode},
);
}
}
@override
Widget build(BuildContext context) {
if (_isLoading) {
return const Center(child: CircularProgressIndicator());
}
final playButton = InkWell(
borderRadius: BorderRadius.circular(64),
onTap: text == null || text!.isEmpty ? null : _getAudio,
child: Material(
color: AppConfig.primaryColor.withAlpha(64),
borderRadius: BorderRadius.circular(64),
child: const Icon(
// Change the icon based on some condition. If you have an audio player state, use it here.
Icons.play_arrow_outlined,
color: AppConfig.primaryColor,
),
),
);
return localAudioEvent == null
? Opacity(
opacity: text == null || text!.isEmpty ? 0.5 : 1,
child: SizedBox(
width: 44, // Match the size of the button in AudioPlayerState
height: 36,
child: Padding(
//only left side of the button is padded to match the padding of the AudioPlayerState
padding: const EdgeInsets.only(left: 8),
child: playButton,
),
),
)
: Container(
constraints: const BoxConstraints(
maxWidth: 250,
),
child: Column(
children: [
AudioPlayerWidget(
localAudioEvent!,
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
],
),
);
}
}

View file

@ -2,43 +2,31 @@ import 'dart:developer';
import 'dart:ui';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pages/chat/events/html_message.dart';
import 'package:fluffychat/pangea/choreographer/controllers/choreographer.dart';
import 'package:fluffychat/pangea/constants/language_keys.dart';
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
import 'package:fluffychat/pangea/models/language_model.dart';
import 'package:fluffychat/pangea/models/pangea_message_event.dart';
import 'package:fluffychat/pangea/models/pangea_representation_event.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:fluffychat/pangea/utils/show_defintion_util.dart';
import 'package:fluffychat/pangea/widgets/chat/message_context_menu.dart';
import 'package:fluffychat/pangea/widgets/chat/message_toolbar.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import '../../models/pangea_match_model.dart';
import '../../models/pangea_representation_event.dart';
import '../../utils/instructions.dart';
class PangeaRichText extends StatefulWidget {
final PangeaMessageEvent pangeaMessageEvent;
final TextStyle? style;
final bool selected;
final LanguageModel? selectedDisplayLang;
final bool immersionMode;
final bool definitions;
final Choreographer? choreographer;
final ShowDefintionUtil? messageToolbar;
final ToolbarDisplayController toolbarController;
final TextStyle? style;
const PangeaRichText({
super.key,
required this.pangeaMessageEvent,
required this.selected,
required this.selectedDisplayLang,
required this.immersionMode,
required this.definitions,
this.choreographer,
required this.toolbarController,
this.style,
this.messageToolbar,
});
@override
@ -57,82 +45,103 @@ class PangeaRichTextState extends State<PangeaRichText> {
updateTextSpan();
}
void updateTextSpan() {
setState(() {
textSpan = getTextSpan();
});
}
@override
void didUpdateWidget(PangeaRichText oldWidget) {
super.didUpdateWidget(oldWidget);
updateTextSpan();
}
void updateTextSpan() {
setState(() {
textSpan = getTextSpan(context);
widget.messageToolbar?.messageText = textSpan;
});
String getTextSpan() {
if (widget.pangeaMessageEvent.eventId.contains("webdebug")) {
debugger(when: kDebugMode);
}
final RepresentationEvent? repEvent =
widget.pangeaMessageEvent.representationByLanguage(
widget.pangeaMessageEvent.messageDisplayLangCode,
);
if (repEvent == null) {
setState(() => _fetchingRepresentation = true);
widget.pangeaMessageEvent
.representationByLanguageGlobal(
context: context,
langCode: widget.pangeaMessageEvent.messageDisplayLangCode,
)
.onError((error, stackTrace) => ErrorHandler.logError())
.then((_) {
widget.toolbarController.toolbar?.textSelection.setMessageText(
repEvent?.text ?? widget.pangeaMessageEvent.body,
);
}).whenComplete(() {
if (mounted) {
setState(() => _fetchingRepresentation = false);
}
});
return widget.pangeaMessageEvent.body;
}
return repEvent.text;
}
@override
Widget build(BuildContext context) {
//TODO - take out of build function of every message
// if (areLanguagesSet) {
if (!widget.selected &&
widget.selectedDisplayLang != null &&
widget.selectedDisplayLang!.langCode != LanguageKeys.unknownLanguage) {
pangeaController.instructions.show(
context,
InstructionsEnum.clickMessage,
widget.pangeaMessageEvent.eventId,
);
} else if (blur > 0) {
pangeaController.instructions.show(
context,
InstructionsEnum.blurMeansTranslate,
widget.pangeaMessageEvent.eventId,
);
}
final Widget richText = widget.pangeaMessageEvent.isHtml
? HtmlMessage(
html: textSpan,
room: widget.pangeaMessageEvent.room,
textColor: widget.style?.color ?? Colors.black,
messageToolbar: widget.messageToolbar,
)
: SelectableText.rich(
onSelectionChanged: (selection, cause) =>
widget.messageToolbar?.onTextSelection(
selectedText: selection,
cause: cause,
context: context,
),
focusNode: widget.messageToolbar?.focusNode,
contextMenuBuilder: (context, state) =>
widget.messageToolbar?.contextMenuOverride(
context: context,
textSelection: state,
) ??
const SizedBox(),
TextSpan(
text: textSpan,
style: widget.style,
children: [
if (widget.selected && (_fetchingRepresentation))
const WidgetSpan(
child: Padding(
padding: EdgeInsets.only(left: 5.0),
child: SizedBox(
height: 14,
width: 14,
child: CircularProgressIndicator(
strokeWidth: 2.0,
color: AppConfig.secondaryColor,
),
),
),
),
],
),
final Widget richText = SelectableText.rich(
onSelectionChanged: (selection, cause) {
if (cause == SelectionChangedCause.longPress &&
!widget.toolbarController.highlighted) {
widget.toolbarController.controller.onSelectMessage(
widget.pangeaMessageEvent.event,
);
return;
}
widget.toolbarController.toolbar?.textSelection
.onTextSelection(selection);
},
onTap: () => widget.toolbarController.showToolbar(context),
focusNode: widget.toolbarController.focusNode,
contextMenuBuilder: (context, state) =>
MessageContextMenu.contextMenuOverride(
context: context,
textSelection: state,
onDefine: () => widget.toolbarController.showToolbar(
context,
mode: MessageMode.definition,
),
onListen: () => widget.toolbarController.showToolbar(
context,
mode: MessageMode.play,
),
),
TextSpan(
text: textSpan,
style: widget.style,
children: [
if (_fetchingRepresentation)
const WidgetSpan(
child: Padding(
padding: EdgeInsets.only(left: 5.0),
child: SizedBox(
height: 14,
width: 14,
child: CircularProgressIndicator(
strokeWidth: 2.0,
color: AppConfig.secondaryColor,
),
),
),
),
],
),
);
return blur > 0
? ImageFiltered(
@ -142,55 +151,6 @@ class PangeaRichTextState extends State<PangeaRichText> {
: richText;
}
String getTextSpan(BuildContext context) {
final String? displayLangCode =
widget.selected ? widget.selectedDisplayLang?.langCode : userL2LangCode;
if (displayLangCode == null || !widget.immersionMode) {
return widget.pangeaMessageEvent.body;
}
if (widget.pangeaMessageEvent.eventId.contains("webdebug")) {
debugger(when: kDebugMode);
return widget.pangeaMessageEvent.body;
}
final RepresentationEvent? repEvent =
widget.pangeaMessageEvent.representationByLanguage(
displayLangCode,
);
if (repEvent == null) {
_fetchingRepresentation = true;
setState(() => {});
widget.pangeaMessageEvent
.representationByLanguageGlobal(
context: context,
langCode: displayLangCode,
)
.onError((error, stackTrace) => ErrorHandler.logError())
.whenComplete(() => setState(() => _fetchingRepresentation = false));
return widget.pangeaMessageEvent.body;
}
if (repEvent.event?.eventId.contains("web") ?? false) {
Sentry.addBreadcrumb(
Breadcrumb.fromJson({"repEvent.event": repEvent.event?.toJson()}),
);
Sentry.addBreadcrumb(
Breadcrumb(
message:
"representationByLanguageGlobal returned RepEvent with event ID containing 'web' - ${repEvent.event?.eventId}",
),
);
}
return widget.pangeaMessageEvent.isHtml
? repEvent.formatBody() ?? repEvent.text
: repEvent.text;
}
bool get areLanguagesSet =>
userL2LangCode != null && userL2LangCode != LanguageKeys.unknownLanguage;

View file

@ -79,6 +79,18 @@ class WordDataCardController extends State<WordDataCard> {
super.initState();
}
@override
void didUpdateWidget(covariant WordDataCard oldWidget) {
if (oldWidget.word != widget.word) {
if (!widget.hasInfo) {
getContextualDefinition();
} else {
getWordNet();
}
}
super.didUpdateWidget(oldWidget);
}
Future<void> getContextualDefinition() async {
ContextualDefinitionRequestModel? req;
try {
@ -89,7 +101,14 @@ class WordDataCardController extends State<WordDataCard> {
fullTextLang: widget.fullTextLang,
wordLang: widget.wordLang,
);
if (mounted) setState(() => isLoadingContextualDefinition = true);
if (!mounted) return;
setState(() {
contextualDefinitionRes = null;
definitionError = null;
isLoadingContextualDefinition = true;
});
contextualDefinitionRes = await controller.definitions.get(req);
if (contextualDefinitionRes == null) {
definitionError = Exception("Error getting definition");
@ -159,54 +178,57 @@ class WordDataCardView extends StatelessWidget {
return Scrollbar(
thumbVisibility: true,
controller: scrollController,
child: SingleChildScrollView(
controller: scrollController,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CardHeader(
text: controller.widget.word,
botExpression: BotExpression.down,
),
if (controller.widget.choiceFeedback != null)
Text(
controller.widget.choiceFeedback!,
style: BotStyle.text(context),
child: Expanded(
child: SingleChildScrollView(
controller: scrollController,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CardHeader(
text: controller.widget.word,
botExpression: BotExpression.down,
),
const SizedBox(height: 5.0),
if (controller.wordData != null && controller.wordNetError == null)
WordNetInfo(
wordData: controller.wordData!,
activeL1: controller.activeL1!,
activeL2: controller.activeL2!,
),
if (controller.isLoadingWordNet) const PCircular(),
const SizedBox(height: 5.0),
// if (controller.widget.hasInfo &&
// !controller.isLoadingContextualDefinition &&
// controller.contextualDefinitionRes == null)
// Material(
// type: MaterialType.transparency,
// child: ListTile(
// leading: const BotFace(
// width: 40, expression: BotExpression.surprised),
// title: Text(L10n.of(context)!.askPangeaBot),
// onTap: controller.handleGetDefinitionButtonPress,
// ),
// ),
if (controller.isLoadingContextualDefinition) const PCircular(),
if (controller.contextualDefinitionRes != null)
Text(
controller.contextualDefinitionRes!.text,
style: BotStyle.text(context),
),
if (controller.definitionError != null)
Text(
L10n.of(context)!.sorryNoResults,
style: BotStyle.text(context),
),
],
if (controller.widget.choiceFeedback != null)
Text(
controller.widget.choiceFeedback!,
style: BotStyle.text(context),
),
const SizedBox(height: 5.0),
if (controller.wordData != null &&
controller.wordNetError == null)
WordNetInfo(
wordData: controller.wordData!,
activeL1: controller.activeL1!,
activeL2: controller.activeL2!,
),
if (controller.isLoadingWordNet) const PCircular(),
const SizedBox(height: 5.0),
// if (controller.widget.hasInfo &&
// !controller.isLoadingContextualDefinition &&
// controller.contextualDefinitionRes == null)
// Material(
// type: MaterialType.transparency,
// child: ListTile(
// leading: const BotFace(
// width: 40, expression: BotExpression.surprised),
// title: Text(L10n.of(context)!.askPangeaBot),
// onTap: controller.handleGetDefinitionButtonPress,
// ),
// ),
if (controller.isLoadingContextualDefinition) const PCircular(),
if (controller.contextualDefinitionRes != null)
Text(
controller.contextualDefinitionRes!.text,
style: BotStyle.text(context),
),
if (controller.definitionError != null)
Text(
L10n.of(context)!.sorryNoResults,
style: BotStyle.text(context),
),
],
),
),
),
);

View file

@ -1,3 +1,4 @@
import 'package:fluffychat/pangea/constants/model_keys.dart';
import 'package:matrix/matrix.dart';
import '../../config/app_config.dart';
@ -18,6 +19,9 @@ extension IsStateExtension on Event {
(!AppConfig.hideUnknownEvents || isEventTypeKnown) &&
// remove state events that we don't want to render
(isState || !AppConfig.hideAllStateEvents) &&
// #Pangea
content.tryGet(ModelKey.transcription) == null &&
// Pangea#
// hide unimportant state events
(!AppConfig.hideUnimportantStateEvents ||
!isState ||

View file

@ -6,7 +6,6 @@
#include "generated_plugin_registrant.h"
#include <desktop_drop/desktop_drop_plugin.h>
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
#include <dynamic_color/dynamic_color_plugin.h>
#include <emoji_picker_flutter/emoji_picker_flutter_plugin.h>
@ -20,9 +19,6 @@
#include <window_to_front/window_to_front_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) desktop_drop_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopDropPlugin");
desktop_drop_plugin_register_with_registrar(desktop_drop_registrar);
g_autoptr(FlPluginRegistrar) desktop_lifecycle_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopLifecyclePlugin");
desktop_lifecycle_plugin_register_with_registrar(desktop_lifecycle_registrar);

View file

@ -3,7 +3,6 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
desktop_drop
desktop_lifecycle
dynamic_color
emoji_picker_flutter

View file

@ -8,7 +8,6 @@ import Foundation
import appkit_ui_element_colors
import audio_session
import connectivity_plus
import desktop_drop
import desktop_lifecycle
import device_info_plus
import dynamic_color
@ -47,7 +46,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppkitUiElementColorsPlugin.register(with: registry.registrar(forPlugin: "AppkitUiElementColorsPlugin"))
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))
DesktopLifecyclePlugin.register(with: registry.registrar(forPlugin: "DesktopLifecyclePlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))

View file

@ -769,6 +769,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"leaveEmptyToClearStatus",
"select",
@ -797,6 +798,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -1589,6 +1592,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -1622,6 +1626,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -2414,6 +2420,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -2447,6 +2454,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -3239,6 +3248,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -3272,6 +3282,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -4064,6 +4076,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -4097,6 +4110,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -4878,6 +4893,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"initAppError",
"databaseBuildErrorBody",
"sessionLostBody",
@ -4891,6 +4907,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -5683,6 +5701,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -5716,6 +5735,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -6508,6 +6529,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -6541,6 +6563,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -6554,6 +6578,9 @@
],
"es": [
"errorGettingAudio",
"define",
"listen",
"showDefinition"
],
@ -7327,6 +7354,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"leaveEmptyToClearStatus",
"select",
@ -7355,6 +7383,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -8136,6 +8166,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"initAppError",
"databaseBuildErrorBody",
"sessionLostBody",
@ -8149,6 +8180,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -8941,6 +8974,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -8974,6 +9008,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -9766,6 +9802,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -9799,6 +9836,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -10591,6 +10630,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -10624,6 +10664,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -11416,6 +11458,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -11449,6 +11492,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -12230,6 +12275,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"initAppError",
"databaseBuildErrorBody",
"sessionLostBody",
@ -12243,6 +12289,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -13035,6 +13083,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -13068,6 +13117,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -13860,6 +13911,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -13893,6 +13945,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -14677,6 +14731,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"leaveEmptyToClearStatus",
"select",
@ -14705,6 +14760,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -15497,6 +15554,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -15530,6 +15588,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -16322,6 +16382,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -16355,6 +16416,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -17147,6 +17210,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -17180,6 +17244,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -17962,6 +18028,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"leaveEmptyToClearStatus",
"select",
@ -17990,6 +18057,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -18782,6 +18851,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -18815,6 +18885,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -19607,6 +19679,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -19640,6 +19713,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -20432,6 +20507,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -20465,6 +20541,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -21257,6 +21335,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -21290,6 +21369,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -22082,6 +22163,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -22115,6 +22197,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -22907,6 +22991,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -22940,6 +23025,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -23732,6 +23819,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -23765,6 +23853,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -24557,6 +24647,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -24590,6 +24681,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -25371,6 +25464,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"initAppError",
"databaseBuildErrorBody",
"sessionLostBody",
@ -25384,6 +25478,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -26176,6 +26272,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -26209,6 +26306,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -27001,6 +27100,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -27034,6 +27134,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -27816,6 +27918,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"addChatOrSubSpace",
"subspace",
"thisDevice",
@ -27832,6 +27935,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -28624,6 +28729,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -28657,6 +28763,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -29449,6 +29557,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -29482,6 +29591,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -30274,6 +30385,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -30307,6 +30419,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -31099,6 +31213,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -31132,6 +31247,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -31924,6 +32041,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -31957,6 +32075,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -32749,6 +32869,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -32782,6 +32903,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -33564,6 +33687,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"leaveEmptyToClearStatus",
"select",
@ -33592,6 +33716,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -34374,6 +34500,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"leaveEmptyToClearStatus",
"select",
@ -34402,6 +34529,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -35194,6 +35323,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -35227,6 +35357,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -36009,6 +36141,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"leaveEmptyToClearStatus",
"select",
@ -36037,6 +36170,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",
@ -36829,6 +36964,7 @@
"successfullySubscribed",
"clickToManageSubscription",
"emptyInviteWarning",
"errorGettingAudio",
"nothingFound",
"wrongRecoveryKey",
"startConversation",
@ -36862,6 +36998,8 @@
"alreadyInSpace",
"pleaseChooseAUsername",
"chooseAUsername",
"define",
"listen",
"addConversationBot",
"addConversationBotDesc",
"convoBotSettingsTitle",

View file

@ -337,14 +337,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.2.3"
desktop_drop:
dependency: "direct main"
description:
name: desktop_drop
sha256: d55a010fe46c8e8fcff4ea4b451a9ff84a162217bdb3b2a0aa1479776205e15d
url: "https://pub.dev"
source: hosted
version: "0.4.4"
desktop_lifecycle:
dependency: "direct main"
description:

View file

@ -20,7 +20,9 @@ dependencies:
chewie: ^1.7.1
collection: ^1.17.2
cupertino_icons: any
desktop_drop: ^0.4.4
# #Pangea
# desktop_drop: ^0.4.4
# Pangea#
desktop_notifications: ^0.6.3
device_info_plus: ^9.1.0
dynamic_color: ^1.6.8
@ -145,7 +147,6 @@ flutter:
- assets/
# #Pangea
- assets/pangea/
- .env
- assets/pangea/bot_faces/
# Pangea#
- assets/sounds/

View file

@ -7,7 +7,6 @@
#include "generated_plugin_registrant.h"
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
#include <desktop_drop/desktop_drop_plugin.h>
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h>
#include <emoji_picker_flutter/emoji_picker_flutter_plugin_c_api.h>
@ -26,8 +25,6 @@
void RegisterPlugins(flutter::PluginRegistry* registry) {
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
DesktopDropPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DesktopDropPlugin"));
DesktopLifecyclePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DesktopLifecyclePlugin"));
DynamicColorPluginCApiRegisterWithRegistrar(

View file

@ -4,7 +4,6 @@
list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus
desktop_drop
desktop_lifecycle
dynamic_color
emoji_picker_flutter