|
|
|
|
@ -28,7 +28,7 @@ import 'helper/chat_file_picker.dart';
|
|
|
|
|
import 'helper/chat_file_viewer.dart';
|
|
|
|
|
import 'model/get_single_user_chat_list_model.dart';
|
|
|
|
|
import 'model/user_chat_history_model.dart';
|
|
|
|
|
|
|
|
|
|
//Need to refactor this ...
|
|
|
|
|
enum ChatState { idle, voiceRecordingStarted, voiceRecordingCompleted }
|
|
|
|
|
|
|
|
|
|
class ChatPage extends StatefulWidget {
|
|
|
|
|
@ -66,7 +66,10 @@ class _ChatPageState extends State<ChatPage> {
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
loadChatHistory();
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
loadChatHistory();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
playerController.addListener(() async {
|
|
|
|
|
// if (playerController.playerState == PlayerState.playing && playerController.maxDuration == await playerController.getDuration()) {
|
|
|
|
|
// await playerController.stopPlayer();
|
|
|
|
|
@ -75,7 +78,7 @@ class _ChatPageState extends State<ChatPage> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loadChatHistory() {
|
|
|
|
|
void loadChatHistory() async {
|
|
|
|
|
// // String assigneeEmployeeNumber = Provider.of<ServiceRequestDetailProvider>(context, listen: false).currentWorkOrder?.data?.assignedEmployee?.employeeId ?? "";
|
|
|
|
|
// // String myEmployeeId = context.userProvider.user!.username!;
|
|
|
|
|
// //
|
|
|
|
|
@ -99,7 +102,12 @@ class _ChatPageState extends State<ChatPage> {
|
|
|
|
|
? Provider.of<ServiceRequestDetailProvider>(context, listen: false).currentWorkOrder!.data!.workOrderCreatedBy!.employeeId!
|
|
|
|
|
: Provider.of<ServiceRequestDetailProvider>(context, listen: false).currentWorkOrder!.data!.workOrderContactPerson.first.employeeId!))
|
|
|
|
|
: "");
|
|
|
|
|
Provider.of<ChatProvider>(context, listen: false).connectToHub(widget.moduleId, widget.requestId, myEmployeeId, receiver, widget.readOnly, isMounted: mounted);
|
|
|
|
|
final chatProvider = context.read<ChatProvider>();
|
|
|
|
|
chatProvider.connectToHub(widget.moduleId, widget.requestId, myEmployeeId, receiver, widget.readOnly, isMounted: mounted);
|
|
|
|
|
bool readStatus = await chatProvider.resetCount(moduleId: widget.moduleId, referenceNo: widget.requestId, userId: context.userProvider.user?.id);
|
|
|
|
|
if (readStatus) {
|
|
|
|
|
chatProvider.chatParticipantModel?.unreadCount = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|