|
|
|
@ -57,56 +57,6 @@ import 'model/user_chat_history_model.dart';
|
|
|
|
late HubConnection chatHubConnection;
|
|
|
|
late HubConnection chatHubConnection;
|
|
|
|
|
|
|
|
|
|
|
|
class ChatProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
class ChatProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
// ScrollController scrollController = ScrollController();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// TextEditingController message = TextEditingController();
|
|
|
|
|
|
|
|
// TextEditingController search = TextEditingController();
|
|
|
|
|
|
|
|
// TextEditingController searchGroup = TextEditingController();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// List<ChatUser>? pChatHistory, searchedChats;
|
|
|
|
|
|
|
|
// String chatCID = '';
|
|
|
|
|
|
|
|
// bool isLoading = true;
|
|
|
|
|
|
|
|
// bool isChatScreenActive = false;
|
|
|
|
|
|
|
|
// int receiverID = 0;
|
|
|
|
|
|
|
|
// late File selectedFile;
|
|
|
|
|
|
|
|
// String sFileType = "";
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// List<ChatUser> favUsersList = [];
|
|
|
|
|
|
|
|
// int paginationVal = 0;
|
|
|
|
|
|
|
|
// int? cTypingUserId = 0;
|
|
|
|
|
|
|
|
// bool isTextMsg = false, isReplyMsg = false, isAttachmentMsg = false, isVoiceMsg = false;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // Audio Recoding Work
|
|
|
|
|
|
|
|
// Timer? _timer;
|
|
|
|
|
|
|
|
// int _recodeDuration = 0;
|
|
|
|
|
|
|
|
// bool isRecoding = false;
|
|
|
|
|
|
|
|
// bool isPause = false;
|
|
|
|
|
|
|
|
// bool isPlaying = false;
|
|
|
|
|
|
|
|
// String? path;
|
|
|
|
|
|
|
|
// String? musicFile;
|
|
|
|
|
|
|
|
// late Directory appDirectory;
|
|
|
|
|
|
|
|
// late RecorderController recorderController;
|
|
|
|
|
|
|
|
// late PlayerController playerController;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
|
|
|
|
|
|
|
|
// List<ChatUser> teamMembersList = [];
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // groups.GetUserGroups userGroups = groups.GetUserGroups();
|
|
|
|
|
|
|
|
// Material.TextDirection textDirection = Material.TextDirection.ltr;
|
|
|
|
|
|
|
|
// bool isRTL = false;
|
|
|
|
|
|
|
|
// String msgText = "";
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// //Chat Home Page Counter
|
|
|
|
|
|
|
|
// int chatUConvCounter = 0;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // late List<groupchathistory.GetGroupChatHistoryAsync> groupChatHistory, groupChatReplyData;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// /// Search Provider
|
|
|
|
|
|
|
|
// List<ChatUser>? chatUsersList = [];
|
|
|
|
|
|
|
|
// int pageNo = 1;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// bool disbaleChatForThisUser = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isTyping = false;
|
|
|
|
bool isTyping = false;
|
|
|
|
|
|
|
|
|
|
|
|
bool chatLoginTokenLoading = false;
|
|
|
|
bool chatLoginTokenLoading = false;
|
|
|
|
@ -164,11 +114,13 @@ class ChatProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
chatLoginTokenLoading = true;
|
|
|
|
chatLoginTokenLoading = true;
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
chatLoginResponse = await ChatApiClient().getChatLoginToken(moduleId, requestId, title, myId);
|
|
|
|
chatLoginResponse = await ChatApiClient().getChatLoginToken(moduleId, requestId, title, myId, assigneeEmployeeNumber);
|
|
|
|
chatParticipantModel = await ChatApiClient().loadParticipants(moduleId, requestId, assigneeEmployeeNumber);
|
|
|
|
chatParticipantModel = await ChatApiClient().loadParticipants(moduleId, requestId, assigneeEmployeeNumber);
|
|
|
|
sender = chatParticipantModel?.participants?.singleWhere((participant) => participant.employeeNumber == myId);
|
|
|
|
sender = chatParticipantModel?.participants?.firstWhere((participant) => participant.employeeNumber == myId);
|
|
|
|
recipient = chatParticipantModel?.participants?.singleWhere((participant) => participant.employeeNumber == assigneeEmployeeNumber);
|
|
|
|
recipient = chatParticipantModel?.participants?.firstWhere((participant) => participant.employeeNumber == assigneeEmployeeNumber);
|
|
|
|
} catch (ex) {}
|
|
|
|
} catch (ex) {
|
|
|
|
|
|
|
|
print(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
chatLoginTokenLoading = false;
|
|
|
|
chatLoginTokenLoading = false;
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|