getGroupApplicationList static method
Future<V2TimValueCallback<V2TimGroupApplicationResult>>
getGroupApplicationList(
)
Implementation
static Future<V2TimValueCallback<V2TimGroupApplicationResult>> getGroupApplicationList() async {
String param = json.encode({"group_pendency_option_start_time": 0, "group_pendency_option_max_limited": 1000});
String userData = Tools.generateUserData();
Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
Pointer<Uint8> json_group_getpendence_list_param = Tools.string2PointerInt8(json.encode(param));
int res = desktopSDK.D_TIMGroupGetPendencyList(json_group_getpendence_list_param, user_data);
if (res != TIMResult.TIM_SUCC) {
return V2TimValueCallback<V2TimGroupApplicationResult>.fromJson({
"code": res,
"desc": "",
});
} else {
Map<String, dynamic> data = await getAsyncData(apiKey: userData);
Map<String, dynamic> nativeJson = json.decode(data["json_param"].isEmpty ? json.encode({}) : data["json_param"]);
List<Map<String, dynamic>> nativeList = List<Map<String, dynamic>>.from(nativeJson["group_pendency_result_pendency_array"] ?? []);
List<Map<String, dynamic>> dartList = List.empty(growable: true);
for (var element in nativeList) {
String auth = element["group_pendency_authentication"] ?? "";
String key = element["group_pendency_key"] ?? "";
String fromUser = element["group_pendency_form_identifier"] ?? "";
String toUser = element["group_pendency_to_identifier"] ?? "";
var addtime = element["group_pendency_add_time"];
String mapKey = "$fromUser-$toUser-$addtime";
if (auth.isNotEmpty) {
groupAuth[mapKey] = auth;
}
if (key.isNotEmpty) {
groupAuthKey[mapKey] = key;
}
dartList.add({
"groupID": element["group_pendency_group_id"],
"fromUser": element["group_pendency_form_identifier"],
"toUser": element["group_pendency_to_identifier"],
"addTime": element["group_pendency_add_time"],
"requestMsg": element["group_pendency_form_user_defined_data"],
"handledMsg": element["group_pendency_approval_msg"],
"type": element["group_pendency_pendency_type"],
"handleStatus": element["group_pendency_handled"],
"handleResult": element["group_pendency_handle_result"],
});
}
Map<String, dynamic> dartJson = Map<String, dynamic>.from({"unreadCount": nativeJson["group_pendency_result_unread_num"], "groupApplicationList": dartList});
return V2TimValueCallback<V2TimGroupApplicationResult>.fromJson({
"code": data["code"],
"desc": data["desc"],
"data": dartJson,
});
}
}