|
|
|
@ -36,6 +36,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
String chatCID = '';
|
|
|
|
String chatCID = '';
|
|
|
|
bool isLoading = true;
|
|
|
|
bool isLoading = true;
|
|
|
|
bool isChatScreenActive = false;
|
|
|
|
bool isChatScreenActive = false;
|
|
|
|
|
|
|
|
int ReceiverID = 0;
|
|
|
|
|
|
|
|
|
|
|
|
late File selectedFile;
|
|
|
|
late File selectedFile;
|
|
|
|
bool isFileSelected = false;
|
|
|
|
bool isFileSelected = false;
|
|
|
|
String sFileType = "";
|
|
|
|
String sFileType = "";
|
|
|
|
@ -142,6 +144,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
if (isNewChat) userChatHistory = [];
|
|
|
|
if (isNewChat) userChatHistory = [];
|
|
|
|
if (!loadMore) paginationVal = 0;
|
|
|
|
if (!loadMore) paginationVal = 0;
|
|
|
|
isChatScreenActive = true;
|
|
|
|
isChatScreenActive = true;
|
|
|
|
|
|
|
|
ReceiverID = receiverUID;
|
|
|
|
Response response = await ChatApiClient().getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
|
|
|
|
Response response = await ChatApiClient().getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal);
|
|
|
|
if (response.statusCode == 204) {
|
|
|
|
if (response.statusCode == 204) {
|
|
|
|
if (isNewChat) {
|
|
|
|
if (isNewChat) {
|
|
|
|
@ -371,13 +374,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setMsgTune();
|
|
|
|
setMsgTune();
|
|
|
|
if (isChatScreenActive) {
|
|
|
|
if (isChatScreenActive && data.first.currentUserId == ReceiverID) {
|
|
|
|
if (data.first.targetUserId == AppState().chatDetails!.response!.id) {
|
|
|
|
userChatHistory.insert(0, data.first);
|
|
|
|
userChatHistory.insert(0, data.first);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (searchedChats != null && !isChatScreenActive) {
|
|
|
|
if (searchedChats != null) {
|
|
|
|
for (ChatUser user in searchedChats!) {
|
|
|
|
for (ChatUser user in searchedChats!) {
|
|
|
|
if (user.id == data.first.currentUserId) {
|
|
|
|
if (user.id == data.first.currentUserId) {
|
|
|
|
int tempCount = user.unreadMessageCount ?? 0;
|
|
|
|
int tempCount = user.unreadMessageCount ?? 0;
|
|
|
|
|