updateFavouriteStatus static method

Future<void> updateFavouriteStatus({
  1. required String messageId,
  2. required String chatUserJid,
  3. required bool isFavourite,
  4. required String chatType,
  5. required dynamic flyCallBack(
    1. FlyResponse response
    ),
})

This method updates the favourite status of a specific message for a chat user. The favourite status can be set to true or false. Upon completion, the flyCallBack function is invoked with a FlyResponse object, which contains information about the success or failure of the operation.

Parameters: messageId - The unique identifier of the message whose favourite status is to be updated. chatUserJid - The JID (Jabber ID) of the chat user for whom the message's favourite status is updated. isFavourite - A boolean value indicating the new favourite status of the message. chatType - The type of chat (e.g., "groupchat" or "chat") to specify in which chat's context the operation is performed.

Returns: flyCallBack - A callback function that is called with a FlyResponse object upon completion.

Example usage:

await Mirrorfly.updateFavouriteStatus(
  messageId: "messageId123",
  chatUserJid: "user123@example.com",
  isFavourite: true,
  chatType: "chat",
  flyCallBack: (response) {
    if (response.isSuccess) {
      print("Message favourite status updated successfully");
    } else {
      print("Failed to update message favourite status: ${response.errorMessage}");
    }
  },
);

Implementation

///
/// Returns:
///   [flyCallBack] - A callback function that is called with a [FlyResponse] object upon completion.
///
/// Example usage:
/// ```dart
/// await Mirrorfly.updateFavouriteStatus(
///   messageId: "messageId123",
///   chatUserJid: "user123@example.com",
///   isFavourite: true,
///   chatType: "chat",
///   flyCallBack: (response) {
///     if (response.isSuccess) {
///       print("Message favourite status updated successfully");
///     } else {
///       print("Failed to update message favourite status: ${response.errorMessage}");
///     }
///   },
/// );
/// ```
static Future<void> updateFavouriteStatus(
    {required String messageId,
    required String chatUserJid,
    required bool isFavourite,
    required String chatType,
    required Function(FlyResponse response) flyCallBack}) {
  return FlyChatFlutterPlatform.instance.updateFavouriteStatus(
      messageId, chatUserJid, isFavourite, chatType, flyCallBack);
}