updateFavouriteStatus method

  1. @override
Future<void> updateFavouriteStatus(
  1. String messageID,
  2. String chatUserJID,
  3. bool isFavourite,
  4. String chatType,
  5. dynamic callback(
    1. FlyResponse response
    )?,
)
override

This method is used to update the favourite status of a message.

Implementation

@override
Future<void> updateFavouriteStatus(
    String messageID,
    String chatUserJID,
    bool isFavourite,
    String chatType,
    Function(FlyResponse response)? callback) async {
  //favouriteMessage
  bool? favResponse;
  try {
    favResponse = await mirrorFlyMethodChannel
        .invokeMethod<bool>('updateFavouriteStatus', {
      "messageID": messageID,
      "chatUserJID": chatUserJID,
      "isFavourite": isFavourite,
      "chatType": chatType,
    });
    LogMessage.d("Favourite Msg Response ", " $favResponse");
    callback?.call(FlyResponse(true, FlyConstants.empty, FlyConstants.empty));
    // return favResponse;
  } on PlatformException catch (e) {
    LogMessage.d("Platform Exception =", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(e.code, e.message, e.details)));
  } on Exception catch (e) {
    LogMessage.d("Exception ", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
        FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
  }
}