checkAndShowReplies method

dynamic checkAndShowReplies(
  1. User? user,
  2. Group? group
)

Implementation

checkAndShowReplies(User? user, Group? group) async {
  Map<String, dynamic>? apiMap;

  if (configuration != null && configuration?.apiConfiguration != null) {
    apiMap = await configuration?.apiConfiguration!(user, group);
  }

  Map<String, dynamic> id = {};
  String receiverId = "";
  if (user != null) {
    receiverId = user.uid;
    id['uid'] = receiverId;
  } else if (group != null) {
    receiverId = group.guid;
    id['guid'] = receiverId;
  }

  CometChatUIEvents.showPanel(
    id,
    CustomUIPosition.composerBottom,
    (context) => AISmartRepliesView(
      style: configuration?.smartRepliesStyle,
      theme: configuration?.theme ?? cometChatTheme,
      user: user,
      group: group,
      emptyStateText: configuration?.emptyStateText,
      errorStateText: configuration?.errorStateText,
      onError: configuration?.onError,
      customView: configuration?.customView,
      loadingStateText: configuration?.loadingStateText,
      emptyIconUrl: configuration?.emptyIconUrl,
      loadingStateView: configuration?.loadingStateView,
      loadingIconUrl: configuration?.loadingIconUrl,
      errorStateView: configuration?.errorStateView,
      emptyStateView: configuration?.emptyStateView,
      errorIconUrl: configuration?.errorIconUrl,
      apiConfiguration: apiMap,
    ),
  );
}