setGroupInfo method
Implementation
Future<V2TimCallback> setGroupInfo({
required V2TimGroupInfo info,
}) async {
try {
final updateGroupParams = {
"groupID": info.groupID,
"name": info.groupName,
"avatar": info.faceUrl,
"introduction": info.introduction,
"notification": info.notification,
"muteAllMembers": info.isAllMuted,
"joinOption": GroupAddOptWeb.convertGroupAddOptToWeb(info.groupAddOpt),
"groupCustomField":
V2TimGroupCreate.convertGroupCustomInfoFromDartToWeb(
info.customInfo ?? {})
};
if ((info.groupName ?? '').isEmpty) {
updateGroupParams.remove("name");
}
if ((info.customInfo ?? {}).isEmpty) {
updateGroupParams.remove("groupCustomField");
}
final res = await wrappedPromiseToFuture(
timeweb!.updateGroupProfile(mapToJSObj(updateGroupParams)));
if (res.code == 0) {
// if (jsToMap(res.data)['group'] != null) {
// final groupInfo = V2TimGroupCreate.convertGroupResultFromWebToDart(
// jsToMap(jsToMap(res.data)['group']));
// print(groupInfo);
// return CommonUtils.returnSuccessForCb(groupInfo);
// }
return CommonUtils.returnSuccessForCb(null);
} else {
return CommonUtils.returnError('set group info failed');
}
} catch (error) {
return CommonUtils.returnError(error);
}
}