getNotificationText static method

Future<String> getNotificationText(
  1. NIMMessage message
)

Implementation

static Future<String> getNotificationText(NIMMessage message) async {
  if (message.attachment is NIMMessageNotificationAttachment) {
    NIMMessageNotificationAttachment attachment =
        message.attachment as NIMMessageNotificationAttachment;
    var teamId = (await NimCore.instance.conversationIdUtil
            .conversationTargetId(message.conversationId!))
        .data!;
    switch (attachment.type) {
      case NIMMessageNotificationType.teamInvite:
        return buildInviteMemberNotification(
            teamId, message.senderId!, attachment);
      case NIMMessageNotificationType.teamKick:
        return buildKickMemberNotification(teamId, attachment);
      case NIMMessageNotificationType.teamLeave:
        return buildMemberLeaveNotification(teamId, message.senderId!);
      case NIMMessageNotificationType.teamDismiss:
        return buildTeamDismissNotification(teamId, message.senderId!);
      case NIMMessageNotificationType.teamUpdateTInfo:
        return buildUpdateTeamNotification(
            teamId, message.senderId!, attachment);
      case NIMMessageNotificationType.teamApplyPass:
        return buildManagerPassTeamApplyNotification(teamId, attachment);
      case NIMMessageNotificationType.teamOwnerTransfer:
        return buildTeamTransOwnerNotification(
            teamId, message.senderId!, attachment);
      case NIMMessageNotificationType.teamAddManager:
        return buildTeamAddManagerNotification(teamId, attachment);
      case NIMMessageNotificationType.teamRemoveManager:
        return buildTeamRemoveManagerNotification(teamId, attachment);
      case NIMMessageNotificationType.teamInviteAccept:
        return buildAcceptInviteNotification(
            teamId, message.senderId!, attachment);
      case NIMMessageNotificationType.teamBannedTeamMember:
        return buildMuteTeamNotification(teamId, attachment);
      default:
        return S.of().chatMessageUnknownNotification;
    }
  } else {
    return S.of().chatMessageUnknownNotification;
  }
}