NIMTeamNotificationAttachment.createTeamNotificationAttachment constructor

NIMTeamNotificationAttachment.createTeamNotificationAttachment(
  1. Map<String, dynamic> map
)

Implementation

factory NIMTeamNotificationAttachment.createTeamNotificationAttachment(
    Map<String, dynamic> map) {
  final int type = map['type'] as int;
  switch (type) {
    case NIMTeamNotificationTypes.acceptInvite:
    case NIMTeamNotificationTypes.inviteMember:
    case NIMTeamNotificationTypes.addTeamManager:
    case NIMTeamNotificationTypes.kickMember:
    case NIMTeamNotificationTypes.transferOwner:
    case NIMTeamNotificationTypes.passTeamApply:
    case NIMTeamNotificationTypes.removeTeamManager:
    case NIMSuperTeamNotificationTypes.invite:
    case NIMSuperTeamNotificationTypes.changeOwner:
    case NIMSuperTeamNotificationTypes.addManager:
    case NIMSuperTeamNotificationTypes.removeManager:
    case NIMSuperTeamNotificationTypes.applyPass:
    case NIMSuperTeamNotificationTypes.inviteAccept:
    case NIMSuperTeamNotificationTypes.kick:
      return NIMMemberChangeAttachment.fromMap(map);
    case NIMTeamNotificationTypes.dismissTeam:
    case NIMSuperTeamNotificationTypes.dismiss:
      return NIMDismissAttachment.fromMap(map);
    case NIMTeamNotificationTypes.leaveTeam:
    case NIMSuperTeamNotificationTypes.leave:
      return NIMLeaveTeamAttachment.fromMap(map);
    case NIMTeamNotificationTypes.muteTeamMember:
    case NIMSuperTeamNotificationTypes.muteList:
      return NIMMuteMemberAttachment.fromMap(map);
    case NIMTeamNotificationTypes.updateTeam:
    case NIMSuperTeamNotificationTypes.updateInfo:
      return NIMUpdateTeamAttachment.fromMap(map);
    default:
      return NIMTeamNotificationAttachment.fromMap(map);
  }
}