|
|
|
|
@ -48,7 +48,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
bool currentUserTyping = false;
|
|
|
|
|
int? cTypingUserId = 0;
|
|
|
|
|
|
|
|
|
|
//Chat
|
|
|
|
|
//Chat Home Page Counter
|
|
|
|
|
int chatUConvCounter = 0;
|
|
|
|
|
|
|
|
|
|
Future<void> getUserAutoLoginToken() async {
|
|
|
|
|
@ -376,8 +376,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
setMsgTune();
|
|
|
|
|
if (isChatScreenActive && data.first.currentUserId == receiverID) {
|
|
|
|
|
userChatHistory.insert(0, data.first);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (searchedChats != null) {
|
|
|
|
|
for (ChatUser user in searchedChats!) {
|
|
|
|
|
if (user.id == data.first.currentUserId) {
|
|
|
|
|
@ -387,6 +386,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
sort();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Object> list = [
|
|
|
|
|
{
|
|
|
|
|
@ -749,10 +749,13 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
for (ChatUser user in searchedChats!) {
|
|
|
|
|
if (user.id == favoriteChatUser.response!.targetUserId!) {
|
|
|
|
|
user.isFav = favoriteChatUser.response!.isFav;
|
|
|
|
|
dynamic contain = favUsersList!.where((ChatUser element) => element.id == favoriteChatUser.response!.targetUserId!);
|
|
|
|
|
if (contain.isEmpty) {
|
|
|
|
|
favUsersList.add(user);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -788,6 +791,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void clearAll() {
|
|
|
|
|
print("----------------- Disposed ---------------------------");
|
|
|
|
|
searchedChats = pChatHistory;
|
|
|
|
|
search.clear();
|
|
|
|
|
isChatScreenActive = false;
|
|
|
|
|
@ -799,6 +803,37 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
sFileType = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void disposeData() {
|
|
|
|
|
search.clear();
|
|
|
|
|
isChatScreenActive = false;
|
|
|
|
|
receiverID = 0;
|
|
|
|
|
paginationVal = 0;
|
|
|
|
|
message.text = '';
|
|
|
|
|
isFileSelected = false;
|
|
|
|
|
repliedMsg = [];
|
|
|
|
|
sFileType = "";
|
|
|
|
|
deleteData();
|
|
|
|
|
favUsersList.clear();
|
|
|
|
|
searchedChats!.clear();
|
|
|
|
|
pChatHistory!.clear();
|
|
|
|
|
chatHubConnection.stop();
|
|
|
|
|
AppState().chatDetails = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void deleteData() {
|
|
|
|
|
List<ChatUser> exists = [], unique = [];
|
|
|
|
|
exists.addAll(searchedChats!);
|
|
|
|
|
exists.addAll(favUsersList!);
|
|
|
|
|
Map<String, ChatUser> profileMap = {};
|
|
|
|
|
for (ChatUser item in exists) {
|
|
|
|
|
profileMap[item.email!] = item;
|
|
|
|
|
}
|
|
|
|
|
unique = profileMap.values.toList();
|
|
|
|
|
for (ChatUser element in unique!) {
|
|
|
|
|
deleteFile(element.id.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void getUserImages() async {
|
|
|
|
|
List<String> emails = [];
|
|
|
|
|
List<ChatUser> exists = [], unique = [];
|
|
|
|
|
@ -909,4 +944,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
await chatHubConnection.invoke("GetChatCounversationCount", args: [userId]);
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void userTypingInvoke({required int currentUser, required int reciptUser}) async {
|
|
|
|
|
logger.d([reciptUser, currentUser]);
|
|
|
|
|
await chatHubConnection.invoke("UserTypingAsync", args: [reciptUser, currentUser]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|