diff --git a/examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js b/examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js index d72075232..e3e49d6e8 100644 --- a/examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js +++ b/examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/ServiceCard/index.js @@ -163,7 +163,7 @@ const ServiceCard = ({ service, withBorder }) => { ) : getDescription(isFutureRide)} - {service.isPriceEstimated ? ( + {service.isPriceEstimated && showPrice ? ( {i18n.t('rideDetails.estimatedFare')} @@ -181,7 +181,7 @@ const ServiceCard = ({ service, withBorder }) => { {!isFutureRide && ( {getDescription()} - {service.isPriceEstimated ? ( + {service.isPriceEstimated && showPrice ? ( {service.availableSeats} diff --git a/examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/index.js b/examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/index.js index 77bc73bd7..5dc3be9e5 100644 --- a/examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/index.js +++ b/examples/client/Locomotion/src/pages/ActiveRide/RideDrawer/RideOptions/ServiceOptions/index.js @@ -4,6 +4,7 @@ import { Text } from 'react-native'; import { getCouponText } from '../../../../../context/newRideContext/utils'; import { RidePageContext } from '../../../../../context/newRideContext'; import { UserContext } from '../../../../../context/user'; +import SettingsContext from '../../../../../context/settings'; import ServiceCard from './ServiceCard'; import { ServiceOptionsContainer } from './styles'; import { serviceCardSkeleton } from './ServiceCard/skeleton'; @@ -14,11 +15,16 @@ const SUCCESS_COLOR = '#25B861'; const ServiceOptions = () => { const { serviceEstimations, stopRequestInterval } = useContext(RidePageContext); + const { showPrice, loadShowPrice } = SettingsContext.useContainer(); + const { coupon } = useContext(UserContext); const isDebuggingEnabled = (typeof atob !== 'undefined'); const { setTopBarProps } = useContext(BottomSheetContext); useEffect(() => () => stopRequestInterval(), []); + useEffect(() => { + loadShowPrice(); + }, []); const clearTopBar = () => { setTopBarProps(INITIAL_TOP_BAR_PROPS); @@ -43,7 +49,8 @@ const ServiceOptions = () => { useEffect(() => { if (coupon && coupon.status !== 'error') { setCouponTopBar(); - } else if ((serviceEstimations || []).some(estimation => estimation.isPriceEstimated)) { + } else if (showPrice + && (serviceEstimations || []).some(estimation => estimation.isPriceEstimated)) { setEstimateFareTopBar(); } diff --git a/examples/client/Locomotion/src/pages/RidePriceBreakdown/index.tsx b/examples/client/Locomotion/src/pages/RidePriceBreakdown/index.tsx index ba4db2bd2..a1393ec33 100644 --- a/examples/client/Locomotion/src/pages/RidePriceBreakdown/index.tsx +++ b/examples/client/Locomotion/src/pages/RidePriceBreakdown/index.tsx @@ -19,6 +19,7 @@ import { import { PaymentMethodInterface } from '../../context/payments/interface'; import * as navigationService from '../../services/navigation'; import PriceBreakdown from '../../Components/PriceBreakdown'; +import SettingsContext from '../../context/settings'; type RidePriceBreakdownParams = { rideId: string, @@ -38,6 +39,8 @@ const RidePriceBreakDown = () => { getRidePriceCalculation, getRideFromApi, } = useContext(RidePageContext); + const { showPrice, loadShowPrice } = SettingsContext.useContainer(); + const updatePriceCalculation = async () => { try { @@ -75,6 +78,9 @@ const RidePriceBreakDown = () => { useEffect(() => { updateRideFromApi(); }, []); + useEffect(() => { + loadShowPrice(); + }, []); return ( @@ -97,7 +103,8 @@ const RidePriceBreakDown = () => { { (priceCalculation && isPriceEstimated(priceCalculation.calculationBasis) - && !RIDE_FINAL_STATES.includes(localRide?.state || '')) + && !RIDE_FINAL_STATES.includes(localRide?.state || '') + && showPrice) ? ( {i18n.t('ridePriceBreakdown.estimatedText')} diff --git a/examples/client/Locomotion/src/popups/FareBreakdownPopup/index.tsx b/examples/client/Locomotion/src/popups/FareBreakdownPopup/index.tsx index 682ad7d4e..874c7c3ea 100644 --- a/examples/client/Locomotion/src/popups/FareBreakdownPopup/index.tsx +++ b/examples/client/Locomotion/src/popups/FareBreakdownPopup/index.tsx @@ -51,7 +51,7 @@ const FareBreakdownPopup = ({ - {service.isPriceEstimated && ( + {service.isPriceEstimated && showPrice && ( {`${i18n.t('ridePriceBreakdown.estimatedText')}`} @@ -59,7 +59,7 @@ const FareBreakdownPopup = ({ )} - {service.isPriceEstimated && } + {service.isPriceEstimated && showPrice && } {showPrice && (