Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider route delay for accurate start ride button disabled state #352

Merged
merged 3 commits into from
Mar 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/screens/route-details/components/start-ride-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ export const StartRideButton = observer(function StartRideButton(props: StartRid
* We are also correcting the user's timezone to Asia/Jerusalem, so if foreign users are playing with the
* feature, it'll allow them to start a ride as if they were at Israel at the moment.
*/
const isRouteInPast = isAfter(timezoneCorrection(new Date()).getTime(), route.arrivalTime)
const isRouteInFuture = differenceInMinutes(route.departureTime, timezoneCorrection(new Date()).getTime()) > 60
const isRouteInPast = isAfter(timezoneCorrection(new Date()).getTime(), route.arrivalTime + route.delay * 60000)
const isRouteInFuture =
differenceInMinutes(route.departureTime + route.delay * 60000, timezoneCorrection(new Date()).getTime()) > 60

const areActivitiesDisabled = Platform.select({
ios: () => !canRunLiveActivities || !(ride?.activityAuthorizationInfo?.areActivitiesEnabled ?? true),
Expand Down
Loading