SimformSolutionsPvtLtd / flutter_chatview

Highly customisable chat UI with reply and reaction functionality.
https://pub.dev/packages/chatview
MIT License
296 stars 131 forks source link

Set the reaction to the exist message #224

Closed limwlee closed 2 months ago

limwlee commented 2 months ago

I have received the data from socket but I try to set the reaction to the exist message, it doesnt work. Its no error no somthing so I not sure am I right if I code like this....

                    try {
                      //Find message id by waMessageId
                      final message = Provider.of<ConversationMessageProvider>(
                              context,
                              listen: false)
                          .findWaIdById(waMessageId);
                      print('Found message with id: ${message?.id}');

                      //Find the message is exist
                      final messageExists = chatController!.initialMessageList
                          .any((msg) => msg.id == message!.id);
                      print('Message index: $messageExists');

                      //If exist then set reaction
                      if (messageExists) {
                        print('Found message at index: $messageExists');
                        chatController!.setReaction(
                            emoji: emoji,
                            messageId: message!.id.toString(),
                            userId: senderId);
                      }
                    } on Exception catch (e) {
                      print('Error finding message: $e');
                    }
limwlee commented 2 months ago

ok solve it