|
|
|
|
@ -8,6 +8,7 @@ import 'package:http/http.dart';
|
|
|
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/api_routes/api_manager.dart';
|
|
|
|
|
import 'package:test_sa/controllers/api_routes/urls.dart';
|
|
|
|
|
import 'package:test_sa/controllers/notification/firebase_notification_manger.dart';
|
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
|
import 'package:test_sa/modules/cx_module/chat/model/chat_attachment_model.dart';
|
|
|
|
|
@ -44,6 +45,16 @@ class ChatApiClient {
|
|
|
|
|
ChatLoginResponse? chatLoginResponse;
|
|
|
|
|
|
|
|
|
|
Future<ChatLoginResponse?> getChatLoginToken(int moduleId, int requestId, String title, String employeeNumber, String assigneeEmployeeNumber) async {
|
|
|
|
|
String platform;
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
platform = "IOS";
|
|
|
|
|
} else {
|
|
|
|
|
if (await FirebaseNotificationManger.isGoogleServicesAvailable()) {
|
|
|
|
|
platform = "GOOGLE";
|
|
|
|
|
} else {
|
|
|
|
|
platform = "HUAWEI";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Response response = await ApiClient().postJsonForResponse(URLs.chatSdkToken, {
|
|
|
|
|
"apiKey": URLs.chatApiKey,
|
|
|
|
|
"employeeNumber": employeeNumber,
|
|
|
|
|
@ -53,7 +64,11 @@ class ChatApiClient {
|
|
|
|
|
"moduleCode": moduleId.toString(),
|
|
|
|
|
"referenceId": requestId.toString(),
|
|
|
|
|
// "referenceType": "ticket",
|
|
|
|
|
"title": title
|
|
|
|
|
"title": title,
|
|
|
|
|
"deviceToken": FirebaseNotificationManger.token,
|
|
|
|
|
"isHuaweiDevice": platform == "HUAWEI",
|
|
|
|
|
"platform": platform,
|
|
|
|
|
"voIPToken": null
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!kReleaseMode) {
|
|
|
|
|
|