|
|
|
|
@ -36,7 +36,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
String chatCID = '';
|
|
|
|
|
bool isLoading = true;
|
|
|
|
|
bool isChatScreenActive = false;
|
|
|
|
|
int ReceiverID = 0;
|
|
|
|
|
int receiverID = 0;
|
|
|
|
|
|
|
|
|
|
late File selectedFile;
|
|
|
|
|
bool isFileSelected = false;
|
|
|
|
|
@ -144,7 +144,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
if (isNewChat) userChatHistory = [];
|
|
|
|
|
if (!loadMore) paginationVal = 0;
|
|
|
|
|
isChatScreenActive = true;
|
|
|
|
|
ReceiverID = receiverUID;
|
|
|
|
|
receiverID = receiverUID;
|
|
|
|
|
Response response = await ChatApiClient().getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
|
|
|
|
|
if (response.statusCode == 204) {
|
|
|
|
|
if (isNewChat) {
|
|
|
|
|
@ -163,7 +163,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
isLoading = false;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
|
|
markRead(userChatHistory, receiverUID);
|
|
|
|
|
if (isChatScreenActive && receiverUID == receiverID) {
|
|
|
|
|
markRead(userChatHistory, receiverUID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
generateConvId();
|
|
|
|
|
}
|
|
|
|
|
@ -374,7 +376,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setMsgTune();
|
|
|
|
|
if (isChatScreenActive && data.first.currentUserId == ReceiverID) {
|
|
|
|
|
if (isChatScreenActive && data.first.currentUserId == receiverID) {
|
|
|
|
|
userChatHistory.insert(0, data.first);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -389,7 +391,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List list = [
|
|
|
|
|
{"userChatHistoryId": data.first.userChatHistoryId, "TargetUserId": temp.first.targetUserId, "isDelivered": true, "isSeen": isChatScreenActive ? true : false}
|
|
|
|
|
{"userChatHistoryId": data.first.userChatHistoryId, "TargetUserId": temp.first.targetUserId, "isDelivered": true, "isSeen": isChatScreenActive && data.first.currentUserId == receiverID ? true : false}
|
|
|
|
|
];
|
|
|
|
|
updateUserChatHistoryOnMsg(list);
|
|
|
|
|
invokeChatCounter(userId: AppState().chatDetails!.response!.id!);
|
|
|
|
|
@ -751,6 +753,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
searchedChats = pChatHistory;
|
|
|
|
|
search.clear();
|
|
|
|
|
isChatScreenActive = false;
|
|
|
|
|
receiverID = 0;
|
|
|
|
|
paginationVal = 0;
|
|
|
|
|
message.text = '';
|
|
|
|
|
isFileSelected = false;
|
|
|
|
|
@ -764,6 +767,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
searchedChats = pChatHistory;
|
|
|
|
|
search.clear();
|
|
|
|
|
isChatScreenActive = false;
|
|
|
|
|
receiverID = 0;
|
|
|
|
|
paginationVal = 0;
|
|
|
|
|
message.text = '';
|
|
|
|
|
isFileSelected = false;
|
|
|
|
|
|