buildGroupChangeInfoText static method
Implementation
static String buildGroupChangeInfoText(V2TimGroupChangeInfo? info) {
if (info == null) {
return "";
}
String res = "";
int type = info.type ?? 0;
switch (type) {
case 0:
res = "";
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_NAME:
res = tL10n.changedGroupNameTo(info.value ?? "empty");
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_INTRODUCTION:
res = tL10n.changedGroupDescriptionTo(info.value ?? "empty");
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_NOTIFICATION:
res = tL10n.changedGroupAnnouncementTo(info.value ?? "empty");
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_FACE_URL:
res = tL10n.changedGroupAvatar;
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_OWNER:
res = tL10n.transferredGroupOwnershipTo(info.value ?? "empty");
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_CUSTOM:
res = tL10n.changedGroupCustomInfo;
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_SHUT_UP_ALL:
if (info.boolValue == true) {
res = tL10n.enabledGroupMute;
} else {
res = tL10n.disabledGroupMute;
}
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_RECEIVE_MESSAGE_OPT:
int value = info.intValue ?? 0;
String conf = "";
if (value == 0) {
conf = tL10n.receiveMessages;
} else if (value == 1) {
conf = tL10n.doNotReceiveMessages;
} else {
conf = tL10n.receiveMessagesWhenOnlineOnly;
}
res = tL10n.changedGroupMessageReceptionTo(conf);
break;
case GroupChangeInfoType.V2TIM_GROUP_INFO_CHANGE_TYPE_GROUP_ADD_OPT:
int value = info.intValue ?? 2;
String conf = "";
if (value == 0) {
conf = tL10n.disallowJoinGroup;
} else if (value == 1) {
conf = tL10n.joinGroupNeedApproval;
} else {
conf = tL10n.joinGroupDirectly;
}
res = tL10n.changedApplyToJoinGroupTo(conf);
break;
case 12:
int value = info.intValue ?? 2;
String conf = "";
if (value == 0) {
conf = tL10n.disallowInviting;
} else if (value == 1) {
conf = tL10n.requireApprovalForInviting;
} else {
conf = tL10n.joinDirectlyBeenInvited;
}
res = tL10n.changedInviteToJoinGroupTo(conf);
break;
}
return res;
}