agree method
void
agree(
- SystemMessage message
Implementation
void agree(SystemMessage message) async {
if (message.status == SystemMessageStatus.init &&
message.fromAccount?.isNotEmpty == true) {
NIMResult<void>? result;
if (message.type == SystemMessageType.addFriend) {
result = await ContactRepo.acceptAddFriend(message.fromAccount!, true);
} else if (message.type == SystemMessageType.applyJoinTeam) {
result = await ContactRepo.agreeTeamApply(
message.targetId!, message.fromAccount!);
} else if (message.type == SystemMessageType.teamInvite) {
result = await ContactRepo.acceptTeamInvite(
message.targetId!, message.fromAccount!);
}
if (result?.isSuccess == true) {
var index =
systemMessages.indexWhere((e) => e.messageId == message.messageId);
if (index >= 0) {
ContactRepo.setVerifyStatus(
message.messageId!, SystemMessageStatus.passed);
message.status = SystemMessageStatus.passed;
systemMessages[index] = message;
notifyListeners();
}
}
}
}