Skip to content

Commit

Permalink
lts/enh/added-rideid-and-driverid-in-StopDetectionReq
Browse files Browse the repository at this point in the history
  • Loading branch information
rupakkorde authored and khuzema786 committed Nov 15, 2024
1 parent f00da81 commit 595075d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,12 @@ async fn process_driver_locations(
// }
// }
// }
if let Some(location) = stop_detected.as_ref() {
if let (Some(location), Some(ride_id)) = (stop_detected.as_ref(), driver_ride_id.as_ref()) {
let _ = trigger_stop_detection_event(
&data.stop_detection.stop_detection_update_callback_url,
location,
ride_id.to_owned(),
driver_id.to_owned(),
)
.await;
}
Expand Down
4 changes: 4 additions & 0 deletions crates/location_tracking_service/src/outbound/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ pub async fn trigger_fcm_dobpp(
pub async fn trigger_stop_detection_event(
stop_detection_callback_url: &Url,
location: &Point,
ride_id: RideId,
driver_id: DriverId,
) -> Result<APISuccess, AppError> {
call_api::<APISuccess, StopDetectionReq>(
Protocol::Http1,
Expand All @@ -117,6 +119,8 @@ pub async fn trigger_stop_detection_event(
vec![("content-type", "application/json")],
Some(StopDetectionReq {
location: location.to_owned(),
ride_id,
driver_id,
}),
)
.await
Expand Down
2 changes: 2 additions & 0 deletions crates/location_tracking_service/src/outbound/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub struct TriggerFcmReq {
#[serde(rename_all = "camelCase")]
pub struct StopDetectionReq {
pub location: Point,
pub ride_id: RideId,
pub driver_id: DriverId,
}

// Live activity notification trigger for IOS
Expand Down

0 comments on commit 595075d

Please sign in to comment.