getNotificationText static method

Future<String> getNotificationText(
  1. NIMMessage message
)

Implementation

static Future<String> getNotificationText(NIMMessage message) async {
  if (message.messageAttachment is NIMTeamNotificationAttachment) {
    NIMTeamNotificationAttachment attachment =
        message.messageAttachment as NIMTeamNotificationAttachment;
    switch (attachment.type) {
      case NIMTeamNotificationTypes.inviteMember:
        return buildInviteMemberNotification(message.sessionId!,
            message.fromAccount!, attachment as NIMMemberChangeAttachment);
      case NIMTeamNotificationTypes.kickMember:
        return buildKickMemberNotification(
            message.sessionId!, attachment as NIMMemberChangeAttachment);
      case NIMTeamNotificationTypes.leaveTeam:
        return buildMemberLeaveNotification(
            message.sessionId!, message.fromAccount!);
      case NIMTeamNotificationTypes.dismissTeam:
        return buildTeamDismissNotification(
            message.sessionId!, message.fromAccount!);
      case NIMTeamNotificationTypes.updateTeam:
        return buildUpdateTeamNotification(message.sessionId!,
            message.fromAccount!, attachment as NIMUpdateTeamAttachment);
      case NIMTeamNotificationTypes.passTeamApply:
        return buildManagerPassTeamApplyNotification(
            message.sessionId!, attachment as NIMMemberChangeAttachment);
      case NIMTeamNotificationTypes.transferOwner:
        return buildTeamTransOwnerNotification(message.sessionId!,
            message.fromAccount!, attachment as NIMMemberChangeAttachment);
      case NIMTeamNotificationTypes.addTeamManager:
        return buildTeamAddManagerNotification(
            message.sessionId!, attachment as NIMMemberChangeAttachment);
      case NIMTeamNotificationTypes.removeTeamManager:
        return buildTeamRemoveManagerNotification(
            message.sessionId!, attachment as NIMMemberChangeAttachment);
      case NIMTeamNotificationTypes.acceptInvite:
        return buildAcceptInviteNotification(message.sessionId!,
            message.fromAccount!, attachment as NIMMemberChangeAttachment);
      case NIMTeamNotificationTypes.muteTeamMember:
        return buildMuteTeamNotification(
            message.sessionId!, attachment as NIMMuteMemberAttachment);
    }
    return S.of().chatMessageUnknownNotification;
  } else {
    return S.of().chatMessageUnknownNotification;
  }
}