|
|
|
|
@ -45,7 +45,7 @@ class ChatApiClient {
|
|
|
|
|
|
|
|
|
|
ChatLoginResponse? chatLoginResponse;
|
|
|
|
|
|
|
|
|
|
Future<ChatLoginResponse?> getChatLoginToken(int moduleId, int requestId, String title, String employeeNumber, String assigneeEmployeeNumber) async {
|
|
|
|
|
Future<String> myPlatform() async {
|
|
|
|
|
String platform;
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
platform = "IOS";
|
|
|
|
|
@ -56,6 +56,22 @@ class ChatApiClient {
|
|
|
|
|
platform = "HUAWEI";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return platform;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool> updateDeviceInfo(String employeeNumber) async {
|
|
|
|
|
final Map<String, dynamic> payload = {
|
|
|
|
|
"employeeNumber": employeeNumber,
|
|
|
|
|
"deviceToken": FirebaseNotificationManger.token,
|
|
|
|
|
"isHuaweiDevice": (await myPlatform()) == "HUAWEI",
|
|
|
|
|
"platform": await myPlatform(),
|
|
|
|
|
"voIPToken": FirebaseNotificationManger.voipToken,
|
|
|
|
|
};
|
|
|
|
|
final Response response = await ApiClient().postJsonForResponse(URLs.updateDeviceInfo, payload, token: chatLoginResponse!.token);
|
|
|
|
|
return response.statusCode == 200;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<ChatLoginResponse?> getChatLoginToken(int moduleId, int requestId, String title, String employeeNumber, String assigneeEmployeeNumber) async {
|
|
|
|
|
Response response = await ApiClient().postJsonForResponse(URLs.chatSdkToken, {
|
|
|
|
|
"apiKey": URLs.chatApiKey,
|
|
|
|
|
"employeeNumber": employeeNumber,
|
|
|
|
|
@ -67,8 +83,8 @@ class ChatApiClient {
|
|
|
|
|
// "referenceType": "ticket",
|
|
|
|
|
"title": title,
|
|
|
|
|
"deviceToken": FirebaseNotificationManger.token,
|
|
|
|
|
"isHuaweiDevice": platform == "HUAWEI",
|
|
|
|
|
"platform": platform,
|
|
|
|
|
"isHuaweiDevice": (await myPlatform()) == "HUAWEI",
|
|
|
|
|
"platform": await myPlatform(),
|
|
|
|
|
"voIPToken": FirebaseNotificationManger.voipToken,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -109,7 +125,6 @@ class ChatApiClient {
|
|
|
|
|
return response.statusCode == 200;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<List<ChatAttachment>> viewAllDocuments(int moduleId, int referenceId) async {
|
|
|
|
|
Response response = await ApiClient().getJsonForResponse("${URLs.chatHubUrlApi}/attachments/conversation?referenceId=$referenceId&moduleCode=$moduleId", token: chatLoginResponse!.token);
|
|
|
|
|
|
|
|
|
|
|