|
|
|
@ -148,7 +148,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
({String? connectionId}) {},
|
|
|
|
|
);
|
|
|
|
|
if (hubConnection.state != HubConnectionState.Connected) {
|
|
|
|
|
print("================= Connection Established ==========================");
|
|
|
|
|
if (kDebugMode) {
|
|
|
|
|
print("================= Connection Established ==========================");
|
|
|
|
|
}
|
|
|
|
|
await hubConnection.start();
|
|
|
|
|
hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
|
|
|
|
|
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
|
|
|
|
@ -176,7 +178,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void userCountAsync(List<Object?>? args) {
|
|
|
|
|
List items = args!.toList();
|
|
|
|
|
dynamic items = args!.toList();
|
|
|
|
|
//logger.d("---------------------------------User Count Async -------------------------------------");
|
|
|
|
|
//logger.d(items);
|
|
|
|
|
// for (var user in searchedChats!) {
|
|
|
|
@ -188,8 +190,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void updateChatHistoryWindow(List<Object?>? args) {
|
|
|
|
|
List items = args!.toList();
|
|
|
|
|
print("---------------------------------Update Chat History Windows Async -------------------------------------");
|
|
|
|
|
dynamic items = args!.toList();
|
|
|
|
|
if (kDebugMode) {
|
|
|
|
|
print("---------------------------------Update Chat History Windows Async -------------------------------------");
|
|
|
|
|
}
|
|
|
|
|
logger.d(items);
|
|
|
|
|
// for (var user in searchedChats!) {
|
|
|
|
|
// if (user.id == items.first["id"]) {
|
|
|
|
@ -200,21 +204,25 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void chatNotDelivered(List<Object?>? args) {
|
|
|
|
|
List items = args!.toList();
|
|
|
|
|
print("--------------------------------- Chat Not Delivered Windows Async -------------------------------------");
|
|
|
|
|
dynamic items = args!.toList();
|
|
|
|
|
if (kDebugMode) {
|
|
|
|
|
print("--------------------------------- Chat Not Delivered Windows Async -------------------------------------");
|
|
|
|
|
}
|
|
|
|
|
logger.d(items);
|
|
|
|
|
// for (var user in searchedChats!) {
|
|
|
|
|
// if (user.id == items.first["id"]) {
|
|
|
|
|
// user.userStatus = items.first["userStatus"];
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// notifyListeners();
|
|
|
|
|
// notifyListeners();2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void changeStatus(List<Object?>? args) {
|
|
|
|
|
// print("================= Status Online // Offline ====================");
|
|
|
|
|
List items = args!.toList();
|
|
|
|
|
// logger.d(items);
|
|
|
|
|
if (kDebugMode) {
|
|
|
|
|
print("================= Status Online // Offline ====================");
|
|
|
|
|
}
|
|
|
|
|
dynamic items = args!.toList();
|
|
|
|
|
logger.d(items);
|
|
|
|
|
for (ChatUser user in searchedChats!) {
|
|
|
|
|
if (user.id == items.first["id"]) {
|
|
|
|
|
user.userStatus = items.first["userStatus"];
|
|
|
|
@ -348,7 +356,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
Future<void> sendChatToServer(
|
|
|
|
|
{required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async {
|
|
|
|
|
{required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async {
|
|
|
|
|
Uuid uuid = const Uuid();
|
|
|
|
|
SingleUserChatModel data = SingleUserChatModel(
|
|
|
|
|
chatEventId: chatEventId,
|
|
|
|
|