setGroupMemberInfo static method
Implementation
static Future<V2TimCallback> setGroupMemberInfo({
required String groupID,
required String userID,
String? nameCard,
Map<String, String>? customInfo,
}) async {
List<Map<String, dynamic>> arr = List.empty(growable: true);
int flag = 0x00;
if (nameCard != null) {
flag = flag | 0x01 << 3;
}
if (customInfo != null && customInfo.isNotEmpty) {
customInfo.forEach((key, value) {
arr.add({
"group_member_info_custom_string_info_key": key,
"group_member_info_custom_string_info_value": value,
});
});
}
if (arr.isNotEmpty) {
flag = flag | 0x01 << 4;
}
String param = json.encode({
"group_modify_member_info_group_id": groupID,
"group_modify_member_info_identifier": userID,
"group_modify_member_info_name_card": nameCard,
"group_modify_member_info_custom_info": arr,
"group_modify_member_info_modify_flag": flag,
});
String userData = Tools.generateUserData();
Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
Pointer<Uint8> json_group_modifymeminfo_param = Tools.string2PointerInt8(param);
int res = desktopSDK.D_TIMGroupModifyMemberInfo(json_group_modifymeminfo_param, user_data);
if (res != TIMResult.TIM_SUCC) {
return V2TimCallback.fromJson({
"code": res,
"desc": "",
});
} else {
Map<String, dynamic> data = await getAsyncData(apiKey: userData);
return V2TimCallback.fromJson({
"code": data["code"],
"desc": data["desc"],
});
}
}