convertToSystemInfoFromRecall static method
RecallMessageSystemMessage
convertToSystemInfoFromRecall(
- V2TimMessage message,
- V2TimUserFullInfo? operateUser,
- String? reason
Implementation
static RecallMessageSystemMessage convertToSystemInfoFromRecall(
V2TimMessage message, V2TimUserFullInfo? operateUser, String? reason) {
V2TimUserFullInfo revokerInfo;
if (message.revokerInfo != null && message.revokerInfo!.userID != null && message.revokerInfo!.userID!.isNotEmpty) {
revokerInfo = message.revokerInfo!;
} else if (operateUser != null) {
revokerInfo = operateUser;
} else {
revokerInfo = V2TimUserFullInfo(userID: message.sender, nickName: message.nickName);
}
final messageSender = message.sender ?? "";
String operator = revokerInfo.nickName ?? '';
if (operator.isEmpty) {
operator = revokerInfo.userID ?? '';
}
bool isInGroup = false;
if (message.userID != null && message.userID!.isNotEmpty) {
isInGroup = false;
} else if (message.groupID != null && message.groupID!.isNotEmpty) {
isInGroup = true;
}
bool isRecalledBySelf = false;
if (revokerInfo.userID == messageSender) {
isRecalledBySelf = message.isSelf ?? false;
}
return RecallMessageSystemMessage(
groupID: message.groupID ?? "",
recallMessageOperator: operator,
isRecalledBySelf: isRecalledBySelf,
isInGroup: isInGroup,
recallReason: reason ?? "",
);
}