| | |
| | | nextStartSite: any, |
| | | nextEndSite: any |
| | | ) => { |
| | | const routePoints = extractRoutePoints(routeResponse); |
| | | const extractedRoutePoints = extractRoutePoints(routeResponse); |
| | | const servedPoints = extractServedPoints(routeResponse); |
| | | const routeMeta = |
| | | routeResponse?.content?.route || |
| | |
| | | |
| | | setRouteDistance(distance); |
| | | setRouteDuration(duration); |
| | | applyRoutePointsRef.current(routePoints); |
| | | applyRoutePointsRef.current(extractedRoutePoints); |
| | | |
| | | const direction = normalizeDirection( |
| | | routeResponse?.direction ?? |
| | |
| | | routeMeta?.direction ?? |
| | | routeResponse?.vehicleDirection |
| | | ); |
| | | const vehiclePoint = resolveVehiclePoint(routePoints, servedPoints); |
| | | const vehiclePoint = resolveVehiclePoint(extractedRoutePoints, servedPoints); |
| | | if (vehiclePoint && [4, 5, 6].includes(mappedStatus)) { |
| | | updateVehicleLocationRef.current( |
| | | vehiclePoint.latitude, |
| | |
| | | setVehicleDirectionRef.current(direction); |
| | | } else { |
| | | setVehicleDirectionRef.current( |
| | | getDirectionByPoints(vehiclePoint, routePoints[1]) |
| | | getDirectionByPoints(vehiclePoint, extractedRoutePoints[1]) |
| | | ); |
| | | } |
| | | } |
| | | |
| | | const center = getCenterPoint([ |
| | | ...routePoints, |
| | | ...extractedRoutePoints, |
| | | ...(nextStartSite ? [nextStartSite] : []), |
| | | ...(nextEndSite ? [nextEndSite] : []) |
| | | ]); |
| | |
| | | cancelled = true; |
| | | clearInterval(timer); |
| | | }; |
| | | }, [orderId, setRouteDistance, setRouteDuration]); |
| | | }, [orderId, setRouteDistance, setRouteDuration, buildSite, resolveExpiredState, syncShareRoute]); |
| | | |
| | | const goHome = () => { |
| | | Taro.reLaunch({ url: "/pages/robotaxi/home/index" }); |