don't try to send again if selectedEvents in empty, log more detailed error

pull/1490/head
ggurdin 1 year ago
parent 1cd7e65aa3
commit a498fd252b
No known key found for this signature in database
GPG Key ID: A01CB41737CBB478

@ -1167,6 +1167,13 @@ class ChatController extends State<ChatPageWithRoom>
}
void sendAgainAction() {
// #Pangea
if (selectedEvents.isEmpty) {
ErrorHandler.logError(e: "No selected events in send again action");
clearSelectedEvents();
return;
}
// Pangea#
final event = selectedEvents.first;
if (event.status.isError) {
event.sendAgain();

@ -96,43 +96,67 @@ class ChatInputRow extends StatelessWidget {
else
// Pangea#
controller.selectedEvents.length == 1
? controller.selectedEvents.first
.getDisplayEvent(controller.timeline!)
.status
.isSent
? SizedBox(
height: height,
child: TextButton(
onPressed: controller.replyAction,
child: Row(
children: <Widget>[
// #Pangea
// Text(L10n.of(context)!.reply),
// const Icon(Icons.keyboard_arrow_right),
const Icon(Symbols.reply),
const SizedBox(width: 6),
Text(L10n.of(context)!.reply),
// Pangea#
],
),
),
)
: SizedBox(
height: height,
child: TextButton(
onPressed: controller.sendAgainAction,
child: Row(
children: <Widget>[
Text(L10n.of(context)!.tryToSendAgain),
const SizedBox(width: 4),
const Icon(Icons.send_outlined, size: 16),
],
),
),
)
?
// #Pangea
// controller.selectedEvents.first
// .getDisplayEvent(controller.timeline!)
// .status
// .isSent
// ?
// Pangea#
SizedBox(
height: height,
child: TextButton(
onPressed: controller.replyAction,
child: Row(
children: <Widget>[
// #Pangea
// Text(L10n.of(context)!.reply),
// const Icon(Icons.keyboard_arrow_right),
const Icon(Symbols.reply),
const SizedBox(width: 6),
Text(L10n.of(context)!.reply),
// Pangea#
],
),
),
)
// #Pangea
// : SizedBox(
// height: height,
// child: TextButton(
// onPressed: controller.sendAgainAction,
// child: Row(
// children: <Widget>[
// Text(L10n.of(context)!.tryToSendAgain),
// const SizedBox(width: 4),
// const Icon(Icons.send_outlined, size: 16),
// ],
// ),
// ),
// )
// Pangea#
: const SizedBox.shrink(),
// #Pangea
PangeaReactionsPicker(controller),
if (controller.selectedEvents.length == 1 &&
!controller.selectedEvents.first
.getDisplayEvent(controller.timeline!)
.status
.isSent)
SizedBox(
height: height,
child: TextButton(
onPressed: controller.sendAgainAction,
child: Row(
children: <Widget>[
Text(L10n.of(context)!.tryToSendAgain),
const SizedBox(width: 4),
const Icon(Icons.send_outlined, size: 16),
],
),
),
),
// Pangea#
]
: <Widget>[

Loading…
Cancel
Save