diff --git a/lib/modules/cm_module/views/service_request_detail_main_view.dart b/lib/modules/cm_module/views/service_request_detail_main_view.dart index 1f2008d8..3d0c6688 100644 --- a/lib/modules/cm_module/views/service_request_detail_main_view.dart +++ b/lib/modules/cm_module/views/service_request_detail_main_view.dart @@ -34,10 +34,13 @@ class ServiceRequestDetailMain extends StatefulWidget { class _ServiceRequestDetailMainState extends State { late ServiceRequestDetailProvider _requestProvider; + static const int moduleId = 3; + @override void initState() { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) { + Provider.of(context, listen: false).reset(); getInitialData(); }); } @@ -93,7 +96,7 @@ class _ServiceRequestDetailMainState extends State { } else { ServiceRequestDetailProvider provider = Provider.of(context, listen: false); if (provider.currentWorkOrder?.data?.status?.value == 2) { - getChatToken(1, provider.currentWorkOrder?.data?.workOrderNo ?? ""); + getChatToken(moduleId, provider.currentWorkOrder?.data?.workOrderNo ?? ""); return Consumer(builder: (pContext, requestProvider, _) { return IconButton( icon: const Icon(Icons.chat_bubble), @@ -102,7 +105,7 @@ class _ServiceRequestDetailMainState extends State { context, CupertinoPageRoute( builder: (context) => ChatPage( - moduleId: 1, + moduleId: 3, requestId: widget.requestId, title: _requestProvider.currentWorkOrder?.data?.workOrderNo ?? "", readOnly: _requestProvider.isReadOnlyRequest, diff --git a/lib/modules/cx_module/chat/chat_page.dart b/lib/modules/cx_module/chat/chat_page.dart index aff8bceb..84f85c75 100644 --- a/lib/modules/cx_module/chat/chat_page.dart +++ b/lib/modules/cx_module/chat/chat_page.dart @@ -164,7 +164,7 @@ class _ChatPageState extends State { decorationColor: AppColor.white10, ), ).onPress(() { - Navigator.push(context, CupertinoPageRoute(builder: (context) => ViewAllAttachmentPage(moduleId: 1, requestId: widget.requestId))); + Navigator.push(context, CupertinoPageRoute(builder: (context) => ViewAllAttachmentPage(moduleId: widget.moduleId, requestId: widget.requestId))); }), ], ), @@ -744,12 +744,12 @@ class _ChatPageState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ if (chatResponse?.downloadUrl != null) ...[ - if (chatResponse!.fileTypeResponse!.fileKind.toString().toLowerCase() == "audio") ChatAudioPlayer(chatResponse!.fileTypeResponse!, chatResponse.downloadUrl!) - ], - Text( - contentMsg, - style: AppTextStyles.bodyText2.copyWith(color: AppColor.white10), - ).paddingOnly(end: 6 * length).toShimmer(context: context, isShow: loading), + ChatFileViewer(chatResponse!.downloadUrl!, chatResponse.fileTypeResponse!), + ] else + Text( + contentMsg, + style: AppTextStyles.bodyText2.copyWith(color: AppColor.white10), + ).paddingOnly(end: 6 * length).toShimmer(context: context, isShow: loading), if (loading) 4.height, Align( alignment: Alignment.centerRight, diff --git a/lib/modules/cx_module/chat/chat_provider.dart b/lib/modules/cx_module/chat/chat_provider.dart index 0d00a6f3..043369d7 100644 --- a/lib/modules/cx_module/chat/chat_provider.dart +++ b/lib/modules/cx_module/chat/chat_provider.dart @@ -194,7 +194,6 @@ class ChatProvider with ChangeNotifier, DiagnosticableTreeMixin { // } catch (e) {} // } - Future connectToHub(int moduleId, int requestId, String myId, String assigneeEmployeeNumber) async { userChatHistoryLoading = true; notifyListeners();