getNotificationText static method
Future<String>
getNotificationText(
- NIMMessage message, {
- NIMTeam? teamInfo,
})
Implementation
static Future<String> getNotificationText(
NIMMessage message, {
NIMTeam? teamInfo,
}) async {
if (message.attachment is NIMMessageNotificationAttachment) {
NIMMessageNotificationAttachment attachment =
message.attachment as NIMMessageNotificationAttachment;
var teamId = (teamInfo?.teamId) ??
(await NimCore.instance.conversationIdUtil.conversationTargetId(
message.conversationId!,
))
.data!;
switch (attachment.type) {
case NIMMessageNotificationType.teamInvite:
return buildInviteMemberNotification(
teamId,
message.senderId!,
attachment,
team: teamInfo,
);
case NIMMessageNotificationType.teamKick:
return buildKickMemberNotification(
teamId,
attachment,
team: teamInfo,
);
case NIMMessageNotificationType.teamLeave:
return buildMemberLeaveNotification(
teamId,
message.senderId!,
team: teamInfo,
);
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;
}
}