|  |  |  | @ -16,6 +16,8 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/extensions/string_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/itg/itg_main_response.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/itg/itg_response_model.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/privilege_list_model.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -158,39 +160,72 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb | 
		
	
		
			
				|  |  |  |  |     _refreshController.refreshCompleted(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   int ermIndex = 0; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void handleErmChannel(List<ItgResponseData> list) async { | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       if (ermIndex == list.length) { | 
		
	
		
			
				|  |  |  |  |         return; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       ItgMainRes? response = await DashboardApiClient().getAdvertisementDetail(list[ermIndex].notificationMasterId ?? ""); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       if (response!.mohemmItgResponseItem!.result!.data != null) { | 
		
	
		
			
				|  |  |  |  |         if (list[ermIndex].notificationType == "Survey") { | 
		
	
		
			
				|  |  |  |  |           await Navigator.pushNamed(context, AppRoutes.survey, arguments: response.mohemmItgResponseItem!.result!.data!.first); | 
		
	
		
			
				|  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |           await Navigator.pushNamed(context, AppRoutes.advertisement, arguments: { | 
		
	
		
			
				|  |  |  |  |             "masterId": list[ermIndex].notificationMasterId, | 
		
	
		
			
				|  |  |  |  |             "advertisement": response.mohemmItgResponseItem!.result!.data!.first.advertisement, | 
		
	
		
			
				|  |  |  |  |           }); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       ermIndex++; | 
		
	
		
			
				|  |  |  |  |       handleErmChannel(list); | 
		
	
		
			
				|  |  |  |  |     } catch (ex) { | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |       return; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void checkERMChannel() { | 
		
	
		
			
				|  |  |  |  |     data.getITGNotification().then((val) { | 
		
	
		
			
				|  |  |  |  |     data.getITGNotification().then((val) async { | 
		
	
		
			
				|  |  |  |  |       if (val!.result!.data != null) { | 
		
	
		
			
				|  |  |  |  |         print("-------------------- Survey ----------------------------"); | 
		
	
		
			
				|  |  |  |  |         if (val.result!.data!.first.notificationType == "Survey") { | 
		
	
		
			
				|  |  |  |  |           DashboardApiClient().getAdvertisementDetail(val.result!.data!.first.notificationMasterId ?? "").then( | 
		
	
		
			
				|  |  |  |  |             (value) { | 
		
	
		
			
				|  |  |  |  |               if (value!.mohemmItgResponseItem!.statusCode == 200) { | 
		
	
		
			
				|  |  |  |  |                 if (value.mohemmItgResponseItem!.result!.data != null) { | 
		
	
		
			
				|  |  |  |  |                   // Navigator.pushNamed(context, AppRoutes.survey, arguments: val.result!.data); | 
		
	
		
			
				|  |  |  |  |                   Navigator.pushNamed(context, AppRoutes.survey, arguments: value.mohemmItgResponseItem!.result!.data!.first); | 
		
	
		
			
				|  |  |  |  |                   // Navigator.pushNamed(context, AppRoutes.advertisement, arguments: { | 
		
	
		
			
				|  |  |  |  |                   //   "masterId": val.result!.data!.notificationMasterId, | 
		
	
		
			
				|  |  |  |  |                   //   "advertisement": value.mohemmItgResponseItem!.result!.data!.advertisement, | 
		
	
		
			
				|  |  |  |  |                   // }); | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |               } | 
		
	
		
			
				|  |  |  |  |             }, | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |           print("------------------------------------------- Ads --------------------"); | 
		
	
		
			
				|  |  |  |  |           DashboardApiClient().getAdvertisementDetail(val.result!.data!.first.notificationMasterId ?? "").then( | 
		
	
		
			
				|  |  |  |  |             (value) { | 
		
	
		
			
				|  |  |  |  |               if (value!.mohemmItgResponseItem!.statusCode == 200) { | 
		
	
		
			
				|  |  |  |  |                 if (value.mohemmItgResponseItem!.result!.data != null) { | 
		
	
		
			
				|  |  |  |  |                   Navigator.pushNamed(context, AppRoutes.advertisement, arguments: { | 
		
	
		
			
				|  |  |  |  |                     "masterId": val.result!.data!.first.notificationMasterId, | 
		
	
		
			
				|  |  |  |  |                     "advertisement": value.mohemmItgResponseItem!.result!.data!.first.advertisement, | 
		
	
		
			
				|  |  |  |  |                   }); | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |               } | 
		
	
		
			
				|  |  |  |  |             }, | 
		
	
		
			
				|  |  |  |  |           ); | 
		
	
		
			
				|  |  |  |  |         ermIndex = 0; | 
		
	
		
			
				|  |  |  |  |         val.result?.data?.removeWhere((element) => element.notificationType == "Announcement"); | 
		
	
		
			
				|  |  |  |  |         handleErmChannel(val.result?.data ?? []); | 
		
	
		
			
				|  |  |  |  |         { | 
		
	
		
			
				|  |  |  |  |           // if (ERMvalue.notificationType == "Survey") { | 
		
	
		
			
				|  |  |  |  |           //   await DashboardApiClient().getAdvertisementDetail(val.result!.data!.first.notificationMasterId ?? "").then( | 
		
	
		
			
				|  |  |  |  |           //         (value) async { | 
		
	
		
			
				|  |  |  |  |           //       if (value!.mohemmItgResponseItem!.statusCode == 200) { | 
		
	
		
			
				|  |  |  |  |           //         if (value.mohemmItgResponseItem!.result!.data != null) { | 
		
	
		
			
				|  |  |  |  |           //           // Navigator.pushNamed(context, AppRoutes.survey, arguments: val.result!.data); | 
		
	
		
			
				|  |  |  |  |           //           await Navigator.pushNamed(context, AppRoutes.survey, arguments: value.mohemmItgResponseItem!.result!.data!.first); | 
		
	
		
			
				|  |  |  |  |           //           // Navigator.pushNamed(context, AppRoutes.advertisement, arguments: { | 
		
	
		
			
				|  |  |  |  |           //           //   "masterId": val.result!.data!.notificationMasterId, | 
		
	
		
			
				|  |  |  |  |           //           //   "advertisement": value.mohemmItgResponseItem!.result!.data!.advertisement, | 
		
	
		
			
				|  |  |  |  |           //           // }); | 
		
	
		
			
				|  |  |  |  |           //         } | 
		
	
		
			
				|  |  |  |  |           //       } | 
		
	
		
			
				|  |  |  |  |           //     }, | 
		
	
		
			
				|  |  |  |  |           //   ); | 
		
	
		
			
				|  |  |  |  |           // } else { | 
		
	
		
			
				|  |  |  |  |           //   print("------------------------------------------- Ads --------------------"); | 
		
	
		
			
				|  |  |  |  |           //   await DashboardApiClient().getAdvertisementDetail(ERMvalue.notificationMasterId ?? "").then( | 
		
	
		
			
				|  |  |  |  |           //         (value) async { | 
		
	
		
			
				|  |  |  |  |           //       if (value!.mohemmItgResponseItem!.statusCode == 200) { | 
		
	
		
			
				|  |  |  |  |           //         if (value.mohemmItgResponseItem!.result!.data != null) { | 
		
	
		
			
				|  |  |  |  |           //           await Navigator.pushNamed(context, AppRoutes.advertisement, arguments: { | 
		
	
		
			
				|  |  |  |  |           //             "masterId": val.result!.data!.first.notificationMasterId, | 
		
	
		
			
				|  |  |  |  |           //             "advertisement": value.mohemmItgResponseItem!.result!.data!.first.advertisement, | 
		
	
		
			
				|  |  |  |  |           //           }); | 
		
	
		
			
				|  |  |  |  |           //         } | 
		
	
		
			
				|  |  |  |  |           //       } | 
		
	
		
			
				|  |  |  |  |           //     }, | 
		
	
		
			
				|  |  |  |  |           //   ); | 
		
	
		
			
				|  |  |  |  |           // } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
	
		
			
				
					|  |  |  | @ -535,7 +570,8 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb | 
		
	
		
			
				|  |  |  |  |                                     ], | 
		
	
		
			
				|  |  |  |  |                                   ), | 
		
	
		
			
				|  |  |  |  |                                 ).onPress(() { | 
		
	
		
			
				|  |  |  |  |                                   Navigator.pushNamed(context, AppRoutes.marathonTutorialScreen); | 
		
	
		
			
				|  |  |  |  |                                   checkERMChannel(); | 
		
	
		
			
				|  |  |  |  |                                   // Navigator.pushNamed(context, AppRoutes.marathonTutorialScreen); | 
		
	
		
			
				|  |  |  |  |                                 }), | 
		
	
		
			
				|  |  |  |  |                         ], | 
		
	
		
			
				|  |  |  |  |                       ), | 
		
	
	
		
			
				
					|  |  |  | 
 |