|  |  |  | @ -36,22 +36,60 @@ class LocationUtils { | 
		
	
		
			
				|  |  |  |  |     isGMSDevice = GmsCheck().checkGmsAvailability(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void getLocation({Function(LatLng)? onSuccess, VoidCallback? onFailure,bool isShowConfirmDialog = false}) async { | 
		
	
		
			
				|  |  |  |  |   // final defaultCallbackForLocationDenied = (){ | 
		
	
		
			
				|  |  |  |  |   //   showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |   //     title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), | 
		
	
		
			
				|  |  |  |  |   //     navigationService.navigatorKey.currentContext!, | 
		
	
		
			
				|  |  |  |  |   //     child: Utils.getWarningWidget( | 
		
	
		
			
				|  |  |  |  |   //         loadingText: | 
		
	
		
			
				|  |  |  |  |   //         "Please grant location permission from app settings to see better results" | 
		
	
		
			
				|  |  |  |  |   //             .needTranslation, | 
		
	
		
			
				|  |  |  |  |   //         isShowActionButtons: true, | 
		
	
		
			
				|  |  |  |  |   //         onCancelTap: () { | 
		
	
		
			
				|  |  |  |  |   //           navigationService.pop(); | 
		
	
		
			
				|  |  |  |  |   //         }, | 
		
	
		
			
				|  |  |  |  |   //         onConfirmTap: () async { | 
		
	
		
			
				|  |  |  |  |   //           navigationService.pop(); | 
		
	
		
			
				|  |  |  |  |   //           openAppSettings(); | 
		
	
		
			
				|  |  |  |  |   //         }), | 
		
	
		
			
				|  |  |  |  |   //     callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |   //     isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |   //     isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |   //   ); | 
		
	
		
			
				|  |  |  |  |   // } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void getLocation( | 
		
	
		
			
				|  |  |  |  |       {Function(LatLng)? onSuccess, | 
		
	
		
			
				|  |  |  |  |       VoidCallback? onFailure, | 
		
	
		
			
				|  |  |  |  |       bool isShowConfirmDialog = false, | 
		
	
		
			
				|  |  |  |  |       VoidCallback? onLocationDeniedForever}) async { | 
		
	
		
			
				|  |  |  |  |     this.isShowConfirmDialog = isShowConfirmDialog; | 
		
	
		
			
				|  |  |  |  |     if (Platform.isIOS) { | 
		
	
		
			
				|  |  |  |  |       getCurrentLocation(onFailure: onFailure, onSuccess: onSuccess); | 
		
	
		
			
				|  |  |  |  |       getCurrentLocation( | 
		
	
		
			
				|  |  |  |  |           onFailure: onFailure, | 
		
	
		
			
				|  |  |  |  |           onSuccess: onSuccess, | 
		
	
		
			
				|  |  |  |  |           onLocationDeniedForever: onLocationDeniedForever); | 
		
	
		
			
				|  |  |  |  |       return; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (await isGMSDevice ?? true) { | 
		
	
		
			
				|  |  |  |  |       getCurrentLocation(onFailure: onFailure, onSuccess: onSuccess); | 
		
	
		
			
				|  |  |  |  |       getCurrentLocation( | 
		
	
		
			
				|  |  |  |  |           onFailure: onFailure, | 
		
	
		
			
				|  |  |  |  |           onSuccess: onSuccess, | 
		
	
		
			
				|  |  |  |  |           onLocationDeniedForever: onLocationDeniedForever); | 
		
	
		
			
				|  |  |  |  |       return; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     getHMSLocation(onFailure: onFailure, onSuccess: onSuccess); | 
		
	
		
			
				|  |  |  |  |     getHMSLocation( | 
		
	
		
			
				|  |  |  |  |         onFailure: onFailure, | 
		
	
		
			
				|  |  |  |  |         onSuccess: onSuccess, | 
		
	
		
			
				|  |  |  |  |         onLocationDeniedForever: onLocationDeniedForever); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void getCurrentLocation({Function(LatLng)? onSuccess, VoidCallback? onFailure, }) async { | 
		
	
		
			
				|  |  |  |  |   void getCurrentLocation( | 
		
	
		
			
				|  |  |  |  |       {Function(LatLng)? onSuccess, | 
		
	
		
			
				|  |  |  |  |       VoidCallback? onFailure, | 
		
	
		
			
				|  |  |  |  |       VoidCallback? onLocationDeniedForever}) async { | 
		
	
		
			
				|  |  |  |  |     var location = Location(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     bool isLocationEnabled = await location.serviceEnabled(); | 
		
	
	
		
			
				
					|  |  |  | @ -74,14 +112,15 @@ class LocationUtils { | 
		
	
		
			
				|  |  |  |  |         return; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } else if (permissionGranted == LocationPermission.deniedForever) { | 
		
	
		
			
				|  |  |  |  |       if (onFailure == null && isShowConfirmDialog) { | 
		
	
		
			
				|  |  |  |  |       appState.resetLocation(); | 
		
	
		
			
				|  |  |  |  |       if(onLocationDeniedForever == null && isShowConfirmDialog){ | 
		
	
		
			
				|  |  |  |  |         showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |           title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), | 
		
	
		
			
				|  |  |  |  |           navigationService.navigatorKey.currentContext!, | 
		
	
		
			
				|  |  |  |  |           child: Utils.getWarningWidget( | 
		
	
		
			
				|  |  |  |  |               loadingText: | 
		
	
		
			
				|  |  |  |  |                   "Please grant location permission from app settings to see better results" | 
		
	
		
			
				|  |  |  |  |                       .needTranslation, | 
		
	
		
			
				|  |  |  |  |               "Please grant location permission from app settings to see better results" | 
		
	
		
			
				|  |  |  |  |                   .needTranslation, | 
		
	
		
			
				|  |  |  |  |               isShowActionButtons: true, | 
		
	
		
			
				|  |  |  |  |               onCancelTap: () { | 
		
	
		
			
				|  |  |  |  |                 navigationService.pop(); | 
		
	
	
		
			
				
					|  |  |  | @ -94,9 +133,8 @@ class LocationUtils { | 
		
	
		
			
				|  |  |  |  |           isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |           isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |         ); | 
		
	
		
			
				|  |  |  |  |         return; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       onFailure?.call(); | 
		
	
		
			
				|  |  |  |  |       onLocationDeniedForever?.call(); | 
		
	
		
			
				|  |  |  |  |       return; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -215,7 +253,10 @@ class LocationUtils { | 
		
	
		
			
				|  |  |  |  |     appState.userLong = locationData.longitude; | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void getHMSLocation({VoidCallback? onFailure, Function(LatLng p1)? onSuccess}) async { | 
		
	
		
			
				|  |  |  |  |   void getHMSLocation( | 
		
	
		
			
				|  |  |  |  |       {VoidCallback? onFailure, | 
		
	
		
			
				|  |  |  |  |       Function(LatLng p1)? onSuccess, | 
		
	
		
			
				|  |  |  |  |       VoidCallback? onLocationDeniedForever}) async { | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       var location = Location(); | 
		
	
		
			
				|  |  |  |  |       HmsLocation.FusedLocationProviderClient locationService = HmsLocation.FusedLocationProviderClient()..initFusedLocationService(); | 
		
	
	
		
			
				
					|  |  |  | @ -236,7 +277,32 @@ class LocationUtils { | 
		
	
		
			
				|  |  |  |  |       LocationPermission permissionGranted = await Geolocator.checkPermission(); | 
		
	
		
			
				|  |  |  |  |       if (permissionGranted == LocationPermission.denied) { | 
		
	
		
			
				|  |  |  |  |         permissionGranted = await Geolocator.requestPermission(); | 
		
	
		
			
				|  |  |  |  |         if (permissionGranted != LocationPermission.whileInUse && permissionGranted != LocationPermission.always) { | 
		
	
		
			
				|  |  |  |  |         if (permissionGranted == LocationPermission.deniedForever) { | 
		
	
		
			
				|  |  |  |  |           appState.resetLocation(); | 
		
	
		
			
				|  |  |  |  |           if(onLocationDeniedForever == null && isShowConfirmDialog){ | 
		
	
		
			
				|  |  |  |  |             showCommonBottomSheetWithoutHeight( | 
		
	
		
			
				|  |  |  |  |               title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), | 
		
	
		
			
				|  |  |  |  |               navigationService.navigatorKey.currentContext!, | 
		
	
		
			
				|  |  |  |  |               child: Utils.getWarningWidget( | 
		
	
		
			
				|  |  |  |  |                   loadingText: | 
		
	
		
			
				|  |  |  |  |                   "Please grant location permission from app settings to see better results" | 
		
	
		
			
				|  |  |  |  |                       .needTranslation, | 
		
	
		
			
				|  |  |  |  |                   isShowActionButtons: true, | 
		
	
		
			
				|  |  |  |  |                   onCancelTap: () { | 
		
	
		
			
				|  |  |  |  |                     navigationService.pop(); | 
		
	
		
			
				|  |  |  |  |                   }, | 
		
	
		
			
				|  |  |  |  |                   onConfirmTap: () async { | 
		
	
		
			
				|  |  |  |  |                     navigationService.pop(); | 
		
	
		
			
				|  |  |  |  |                     openAppSettings(); | 
		
	
		
			
				|  |  |  |  |                   }), | 
		
	
		
			
				|  |  |  |  |               callBackFunc: () {}, | 
		
	
		
			
				|  |  |  |  |               isFullScreen: false, | 
		
	
		
			
				|  |  |  |  |               isCloseButtonVisible: true, | 
		
	
		
			
				|  |  |  |  |             ); | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |           onLocationDeniedForever?.call(); | 
		
	
		
			
				|  |  |  |  |           return; | 
		
	
		
			
				|  |  |  |  |         } else if (permissionGranted != LocationPermission.whileInUse && permissionGranted != LocationPermission.always) { | 
		
	
		
			
				|  |  |  |  |           appState.resetLocation(); | 
		
	
		
			
				|  |  |  |  |           onFailure?.call(); | 
		
	
		
			
				|  |  |  |  |           return; | 
		
	
	
		
			
				
					|  |  |  | 
 |