|
|
|
|
@ -87,11 +87,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
token: AppState().chatDetails!.response!.token,
|
|
|
|
|
);
|
|
|
|
|
ChatUserModel favUList = userToList(favRes.body);
|
|
|
|
|
GetUserChatHistoryNotDeliveredAsync(
|
|
|
|
|
userId: int.parse(
|
|
|
|
|
AppState().chatDetails!.response!.id.toString(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (favUList.response != null && recentChat.response != null) {
|
|
|
|
|
favUsersList = favUList.response!;
|
|
|
|
|
favUsersList.sort(
|
|
|
|
|
@ -119,7 +115,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future GetUserChatHistoryNotDeliveredAsync({required int userId}) async {
|
|
|
|
|
Future getUserChatHistoryNotDeliveredAsync({required int userId}) async {
|
|
|
|
|
await hubConnection.invoke(
|
|
|
|
|
"GetUserChatHistoryNotDeliveredAsync",
|
|
|
|
|
args: [userId],
|
|
|
|
|
@ -157,7 +153,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
).reversed.toList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
await GetUserChatHistoryNotDeliveredAsync(
|
|
|
|
|
await getUserChatHistoryNotDeliveredAsync(
|
|
|
|
|
userId: senderUID,
|
|
|
|
|
);
|
|
|
|
|
isLoading = false;
|
|
|
|
|
@ -274,6 +270,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
);
|
|
|
|
|
if (hubConnection.state != HubConnectionState.Connected) {
|
|
|
|
|
await hubConnection.start();
|
|
|
|
|
getUserChatHistoryNotDeliveredAsync(
|
|
|
|
|
userId: int.parse(
|
|
|
|
|
AppState().chatDetails!.response!.id.toString(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
|
|
|
|
|
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
|
|
|
|
|
// hubConnection.on("OnSeenChatUserAsync", onChatSeen);
|
|
|
|
|
@ -565,14 +566,14 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
if (isFileSelected && !isMsgReply) {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
logger.d("Normal Attachment Message");
|
|
|
|
|
//logger.d("Normal Attachment Message");
|
|
|
|
|
dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile);
|
|
|
|
|
String? ext = getFileExtension(selectedFile.path);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
sendChatToServer(chatEventId: 2, fileTypeId: getFileType(ext.toString()), targetUserId: targetUserId, targetUserName: targetUserName, isAttachment: true, chatReplyId: null, isReply: false);
|
|
|
|
|
}
|
|
|
|
|
if (!isFileSelected && isMsgReply) {
|
|
|
|
|
logger.d("Normal Text Message With Reply");
|
|
|
|
|
// logger.d("Normal Text Message With Reply");
|
|
|
|
|
if (message.text == null || message.text.isEmpty) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -580,7 +581,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
chatEventId: 1, fileTypeId: null, targetUserId: targetUserId, targetUserName: targetUserName, chatReplyId: repliedMsg.first.userChatHistoryId, isAttachment: false, isReply: true);
|
|
|
|
|
}
|
|
|
|
|
if (isFileSelected && isMsgReply) {
|
|
|
|
|
logger.d("Attachment Message With Reply");
|
|
|
|
|
// logger.d("Attachment Message With Reply");
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile);
|
|
|
|
|
String? ext = getFileExtension(selectedFile.path);
|
|
|
|
|
|